mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
Fixing type errors in tests
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import definition = require("ui/core/bindable");
|
||||
import * as definition from "ui/core/bindable";
|
||||
import { Observable, PropertyChangeData } from "data/observable";
|
||||
import { unsetValue, DependencyObservable, Property, PropertyMetadata, PropertyMetadataSettings, PropertyChangeData as DependencyPropertyChangeData } from "ui/core/dependency-observable";
|
||||
import { addWeakEventListener, removeWeakEventListener } from "ui/core/weak-event-listener";
|
||||
|
||||
@@ -7,7 +7,8 @@ declare module "ui/core/dependency-observable" {
|
||||
/**
|
||||
* Value specifing that Property value should be reset. Used when bindingContext on bound property is creared/null.
|
||||
*/
|
||||
export const unsetValue: Object;
|
||||
export const unsetValue: any;
|
||||
|
||||
/**
|
||||
* Interface used by Propery 'defaultValueGetter' function to specify if the default value returned by the native instance can be cached or not.
|
||||
* One example is - android.widget.Button background. It is state drawable so it cannot be reused/cached.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import bindable = require("ui/core/bindable");
|
||||
import dependencyObservable = require("ui/core/dependency-observable");
|
||||
import definition = require("ui/core/proxy");
|
||||
import * as bindable from "ui/core/bindable";
|
||||
import * as dependencyObservable from "ui/core/dependency-observable";
|
||||
import * as definition from "ui/core/proxy";
|
||||
import * as types from "utils/types";
|
||||
import * as observable from "data/observable";
|
||||
|
||||
|
||||
@@ -950,6 +950,14 @@ export abstract class ViewCommon extends ViewBase implements ViewDefinition {
|
||||
// // Check for a valid _nativeView instance
|
||||
// return !!this._nativeView;
|
||||
// }
|
||||
|
||||
public _getValue(): never {
|
||||
throw new Error("The View._setValue is obsolete. There is a new property system.")
|
||||
}
|
||||
|
||||
public _setValue(): never {
|
||||
throw new Error("The View._setValue is obsolete. There is a new property system.")
|
||||
}
|
||||
}
|
||||
|
||||
export function getLengthEffectiveValue(param: Length): number {
|
||||
@@ -1045,6 +1053,9 @@ export namespace PercentLength {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
export function equals(a: PercentLength, b: PercentLength): boolean {
|
||||
return a.value == b.value && a.unit == b.unit;
|
||||
}
|
||||
}
|
||||
|
||||
export namespace Length {
|
||||
@@ -1074,6 +1085,10 @@ export namespace Length {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
export function equals(a: Length, b: Length): boolean {
|
||||
return a.value == b.value && a.unit == b.unit;
|
||||
}
|
||||
}
|
||||
|
||||
export function booleanConverter(v: string): boolean {
|
||||
|
||||
@@ -202,7 +202,7 @@ export class View extends ViewCommon {
|
||||
|
||||
// Widgets like buttons and such have reference to their native view in both properties.
|
||||
if (this[NATIVE_VIEW] === this[ANDROID]) {
|
||||
this[NATIVE_VIEW] = undefined;
|
||||
(<any>this)[NATIVE_VIEW] = undefined;
|
||||
}
|
||||
|
||||
// Handle layout and content view
|
||||
|
||||
24
tns-core-modules/ui/core/view.d.ts
vendored
24
tns-core-modules/ui/core/view.d.ts
vendored
@@ -99,18 +99,18 @@ declare module "ui/core/view" {
|
||||
readonly unit: "dip" | "px";
|
||||
readonly value: number;
|
||||
}
|
||||
export namespace Length {
|
||||
export function parse(text: string): Length;
|
||||
export function equals(a: Length, b: Length): boolean;
|
||||
}
|
||||
|
||||
export interface PercentLength {
|
||||
readonly unit: "%" | "dip" | "px";
|
||||
readonly value: number;
|
||||
}
|
||||
|
||||
export namespace Length {
|
||||
function parse(text: string): Length;
|
||||
}
|
||||
|
||||
export namespace PercentLength {
|
||||
function parse(text: string): PercentLength;
|
||||
export function parse(text: string): PercentLength;
|
||||
export function equals(a: PercentLength, b: PercentLength): boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -555,7 +555,7 @@ declare module "ui/core/view" {
|
||||
* A property has changed on the native side directly - e.g. the user types in a TextField.
|
||||
*/
|
||||
public nativePropertyChanged(property: Property<any, any>, newValue: any): void;
|
||||
public bind(options: BindingOptions, source: any): void;
|
||||
public bind(options: BindingOptions, source?: any): void;
|
||||
public unbind(property: string): void;
|
||||
|
||||
isCollapsed: boolean;
|
||||
@@ -603,6 +603,16 @@ declare module "ui/core/view" {
|
||||
_setNativeViewFrame(nativeView: any, frame: any): void;
|
||||
// _onStylePropertyChanged(property: dependencyObservable.Property): void;
|
||||
//@endprivate
|
||||
|
||||
// /**
|
||||
// * __Obsolete:__ There is a new property system that does not rely on _getValue.
|
||||
// */
|
||||
// public _getValue(property: any): never;
|
||||
|
||||
// /**
|
||||
// * __Obsolete:__ There is a new property system that does not rely on _setValue.
|
||||
// */
|
||||
// public _setValue(property: any, value: any): never;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
2
tns-core-modules/ui/enums/enums.d.ts
vendored
2
tns-core-modules/ui/enums/enums.d.ts
vendored
@@ -1,6 +1,6 @@
|
||||
declare module "ui/enums" {
|
||||
|
||||
import animationModule = require("ui/animation");
|
||||
import * as animationModule from "ui/animation";
|
||||
|
||||
/**
|
||||
* Represents a soft keyboard flavor.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import definition = require("ui/image-cache");
|
||||
import observable = require("data/observable");
|
||||
import imageSource = require("image-source");
|
||||
import * as definition from "ui/image-cache";
|
||||
import * as observable from "data/observable";
|
||||
import * as imageSource from "image-source";
|
||||
|
||||
export interface DownloadRequest {
|
||||
url: string;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import common = require("./image-cache-common");
|
||||
import * as common from "./image-cache-common";
|
||||
|
||||
var LruBitmapCacheClass;
|
||||
function ensureLruBitmapCacheClass() {
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
* Contains the Cache class, which handles image download requests and caches the already downloaded images.
|
||||
*/
|
||||
declare module "ui/image-cache" {
|
||||
import observable = require("data/observable");
|
||||
import imageSource = require("image-source");
|
||||
import * as observable from "data/observable";
|
||||
import * as imageSource from "image-source";
|
||||
|
||||
/**
|
||||
* Represents a single download request.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import common = require("./image-cache-common");
|
||||
import trace = require("trace");
|
||||
import * as common from "./image-cache-common";
|
||||
import * as trace from "trace";
|
||||
import * as httpRequestModule from "http/http-request";
|
||||
|
||||
import * as utils from "utils/utils";
|
||||
|
||||
2
tns-core-modules/ui/page/page.d.ts
vendored
2
tns-core-modules/ui/page/page.d.ts
vendored
@@ -8,7 +8,7 @@ declare module "ui/page" {
|
||||
import { KeyframeAnimationInfo } from "ui/animation/keyframe-animation";
|
||||
|
||||
//@private
|
||||
import styleScope = require("ui/styling/style-scope");
|
||||
import * as styleScope from "ui/styling/style-scope";
|
||||
//@endprivate
|
||||
|
||||
export * from "ui/content-view";
|
||||
|
||||
@@ -1,17 +1,10 @@
|
||||
import { Background as BackgroundDefinition, BackgroundDrawParams } from "ui/styling/background";
|
||||
import { Color, layout } from "ui/core/view";
|
||||
import { ImageSource } from "image-source";
|
||||
import cssValue = require("css-value");
|
||||
|
||||
import * as cssValue from "css-value";
|
||||
import { CSSValue } from "css-value";
|
||||
export * from "ui/core/view";
|
||||
|
||||
interface CSSValue {
|
||||
type: string;
|
||||
string: string;
|
||||
unit?: string;
|
||||
value?: number;
|
||||
}
|
||||
|
||||
export class Background implements BackgroundDefinition {
|
||||
public static default = new Background();
|
||||
|
||||
@@ -202,7 +195,7 @@ export class Background implements BackgroundDefinition {
|
||||
|
||||
// size
|
||||
if (this.size) {
|
||||
let values = cssValue(this.size);
|
||||
let values = cssValue.parse(this.size);
|
||||
|
||||
if (values.length === 2) {
|
||||
let vx = values[0];
|
||||
@@ -281,7 +274,7 @@ export class Background implements BackgroundDefinition {
|
||||
}
|
||||
|
||||
private static parsePosition(pos: string): { x: CSSValue, y: CSSValue } {
|
||||
let values = cssValue(pos);
|
||||
let values = cssValue.parse(pos);
|
||||
|
||||
if (values.length === 2) {
|
||||
return {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { View } from "./background-common";
|
||||
import { isNullOrUndefined, isFunction, getClass } from "utils/types";
|
||||
import { CacheLayerType } from "utils/utils";
|
||||
import cssValue = require("css-value");
|
||||
import { parse } from "css-value";
|
||||
|
||||
export * from "./background-common"
|
||||
|
||||
@@ -171,7 +171,7 @@ function createNativeCSSValueArray(css: string): native.Array<org.nativescript.w
|
||||
return null;
|
||||
}
|
||||
|
||||
let cssValues = cssValue(css);
|
||||
let cssValues = parse(css);
|
||||
let nativeArray = Array.create(org.nativescript.widgets.CSSValue, cssValues.length);
|
||||
for (let i = 0, length = cssValues.length; i < length; i++) {
|
||||
nativeArray[i] = new org.nativescript.widgets.CSSValue(
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { FontBase, parseFontFamily, genericFontFamilies, parseFont, FontStyle, FontWeight } from "./font-common";
|
||||
import { enabled as traceEnabled, write as traceWrite, categories as traceCategories, messageType as traceMessageType } from "trace";
|
||||
import fs = require("file-system");
|
||||
import * as fs from "file-system";
|
||||
import * as utils from "utils/utils";
|
||||
|
||||
export class Font extends FontBase {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// declare module "ui/styling/style-property" {
|
||||
// import definition = require("ui/styling");
|
||||
// import observable = require("ui/core/dependency-observable");
|
||||
// import * as definition from "ui/styling";
|
||||
// import * as observable from "ui/core/dependency-observable";
|
||||
|
||||
// export type StyleProperty = Property;
|
||||
// export type ResolvedStylePropertyHandler = (property: Property | string, value: any) => void;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// import definition = require("ui/styling/style-property");
|
||||
// import types = require("utils/types");
|
||||
// import observable = require("ui/core/dependency-observable");
|
||||
// import * as definition from "ui/styling/style-property";
|
||||
// import * as types from "utils/types";
|
||||
// import * as observable from "ui/core/dependency-observable";
|
||||
|
||||
// var propertiesByName = {};
|
||||
// var propertiesByCssName = {};
|
||||
|
||||
@@ -7,7 +7,7 @@ import { File, knownFolders, path } from "file-system";
|
||||
import { CssAnimationParser } from "./css-animation-parser";
|
||||
import { isFileOrResourcePath } from "utils/utils";
|
||||
|
||||
import application = require("application");
|
||||
import * as application from "application";
|
||||
|
||||
const animationsSymbol: symbol = Symbol("animations");
|
||||
|
||||
|
||||
6
tns-core-modules/ui/styling/styling.d.ts
vendored
6
tns-core-modules/ui/styling/styling.d.ts
vendored
@@ -1,8 +1,8 @@
|
||||
// declare module "ui/styling" {
|
||||
// import observable = require("ui/core/dependency-observable");
|
||||
// import * as observable from "ui/core/dependency-observable";
|
||||
// import {Observable} from "data/observable";
|
||||
// import color = require("color");
|
||||
// import view = require("ui/core/view");
|
||||
// import * as color from "color";
|
||||
// import * as view from "ui/core/view";
|
||||
|
||||
// /**
|
||||
// * Represents an observable property which can have its value set form CSS style.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// import styleModule = require("./style");
|
||||
// import stylePropertyModule = require("./style-property");
|
||||
// import convertersModule = require("./converters");
|
||||
// import * as styleModule from "./style";
|
||||
// import * as stylePropertyModule from "./style-property";
|
||||
// import * as convertersModule from "./converters";
|
||||
|
||||
// // Exports form style-property module.
|
||||
// export var Property = stylePropertyModule.Property;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
// import view = require("ui/core/view");
|
||||
// import utils = require("utils/utils");
|
||||
// import style = require("ui/styling/style");
|
||||
// import font = require("ui/styling/font");
|
||||
// import enums = require("ui/enums");
|
||||
// import * as view from "ui/core/view";
|
||||
// import * as utils from "utils/utils";
|
||||
// import * as style from "ui/styling/style";
|
||||
// import * as font from "ui/styling/font";
|
||||
// import * as enums from "ui/enums";
|
||||
// import {device} from "platform";
|
||||
|
||||
// export class TextBaseStyler implements style.Styler {
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
// import view = require("ui/core/view");
|
||||
// import utils = require("utils/utils");
|
||||
// import style = require("ui/styling/style");
|
||||
// import font = require("ui/styling/font");
|
||||
// import enums = require("ui/enums");
|
||||
// import types = require("utils/types");
|
||||
// import * as view from "ui/core/view";
|
||||
// import * as utils from "utils/utils";
|
||||
// import * as style from "ui/styling/style";
|
||||
// import * as font from "ui/styling/font";
|
||||
// import * as enums from "ui/enums";
|
||||
// import * as types from "utils/types";
|
||||
// import { TextBase } from "ui/text-base";
|
||||
|
||||
// export class TextBaseStyler implements style.Styler {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// import definition = require("ui/text-view");
|
||||
// import textBase = require("ui/text-base");
|
||||
// import editableTextBase = require("ui/editable-text-base");
|
||||
// import * as definition from "ui/text-view";
|
||||
// import * as textBase from "ui/text-base";
|
||||
// import * as editableTextBase from "ui/editable-text-base";
|
||||
|
||||
// global.moduleMerge(textBase, exports);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user