diff --git a/nativescript-angular/animations.ts b/nativescript-angular/animations/animations.module.ts similarity index 87% rename from nativescript-angular/animations.ts rename to nativescript-angular/animations/animations.module.ts index 7b5f2d2f3..7f2b3adea 100644 --- a/nativescript-angular/animations.ts +++ b/nativescript-angular/animations/animations.module.ts @@ -13,10 +13,10 @@ import { ɵBrowserAnimationBuilder as BrowserAnimationBuilder, } from "@angular/platform-browser/animations"; -import { NativeScriptAnimationEngine } from "./animations/animation-engine"; -import { NativeScriptAnimationDriver } from "./animations/animation-driver"; -import { NativeScriptModule } from "./nativescript.module"; -import { NativeScriptRendererFactory } from "./renderer"; +import { NativeScriptAnimationEngine } from "./animation-engine"; +import { NativeScriptAnimationDriver } from "./animation-driver"; +import { NativeScriptModule } from "../nativescript.module"; +import { NativeScriptRendererFactory } from "../renderer"; @Injectable() export class InjectableAnimationEngine extends NativeScriptAnimationEngine { diff --git a/nativescript-angular/animations/index.ts b/nativescript-angular/animations/index.ts new file mode 100644 index 000000000..d5754740b --- /dev/null +++ b/nativescript-angular/animations/index.ts @@ -0,0 +1 @@ +export * from "./animations.module"; diff --git a/nativescript-angular/collection-facade.ts b/nativescript-angular/collection-facade.ts deleted file mode 100644 index 08c2f6742..000000000 --- a/nativescript-angular/collection-facade.ts +++ /dev/null @@ -1,134 +0,0 @@ -/* tslint:disable */ -//Copied unexported functions from @angular/core/src/facade/collection -import { - isJsObject, isArray, getSymbolIterator, - isPresent, isBlank -} from "./lang-facade"; - -export function isListLikeIterable(obj: any): boolean { - if (!isJsObject(obj)) return false; - return isArray(obj) || - (!(obj instanceof Map) && // JS Map are iterables but return entries as [k, v] - getSymbolIterator() in obj); // JS Iterable have a Symbol.iterator prop -} - -export class ListWrapper { - // JS has no way to express a statically fixed size list, but dart does so we - // keep both methods. - static createFixedSize(size: number): any[] { return new Array(size); } - static createGrowableSize(size: number): any[] { return new Array(size); } - static clone(array: T[]): T[] { return array.slice(0); } - static forEachWithIndex(array: T[], fn: (t: T, n: number) => void) { - for (let i = 0; i < array.length; i++) { - fn(array[i], i); - } - } - static first(array: T[]): T { - if (!array) return null; - return array[0]; - } - static last(array: T[]): T { - if (!array || array.length == 0) return null; - return array[array.length - 1]; - } - static indexOf(array: T[], value: T, startIndex: number = 0): number { - return array.indexOf(value, startIndex); - } - static contains(list: T[], el: T): boolean { return list.indexOf(el) !== -1; } - static reversed(array: T[]): T[] { - let a = ListWrapper.clone(array); - return a.reverse(); - } - static concat(a: any[], b: any[]): any[] { return a.concat(b); } - static insert(list: T[], index: number, value: T) { list.splice(index, 0, value); } - static removeAt(list: T[], index: number): T { - let res = list[index]; - list.splice(index, 1); - return res; - } - static removeAll(list: T[], items: T[]) { - for (let i = 0; i < items.length; ++i) { - let index = list.indexOf(items[i]); - list.splice(index, 1); - } - } - static remove(list: T[], el: T): boolean { - let index = list.indexOf(el); - if (index > -1) { - list.splice(index, 1); - return true; - } - return false; - } - static clear(list: any[]) { list.length = 0; } - static isEmpty(list: any[]): boolean { return list.length == 0; } - static fill(list: any[], value: any, start: number = 0, end: number = null) { - (list).fill(value, start, end === null ? list.length : end); - } - static equals(a: any[], b: any[]): boolean { - if (a.length != b.length) return false; - for (let i = 0; i < a.length; ++i) { - if (a[i] !== b[i]) return false; - } - return true; - } - static slice(l: T[], from: number = 0, to: number = null): T[] { - return l.slice(from, to === null ? undefined : to); - } - static splice(l: T[], from: number, length: number): T[] { return l.splice(from, length); } - static sort(l: T[], compareFn?: (a: T, b: T) => number) { - if (isPresent(compareFn)) { - l.sort(compareFn); - } else { - l.sort(); - } - } - static toString(l: T[]): string { return l.toString(); } - static toJSON(l: T[]): string { return JSON.stringify(l); } - - static maximum(list: T[], predicate: (t: T) => number): T { - if (list.length == 0) { - return null; - } - let solution: any /** TODO #???? */ = null; - let maxValue = -Infinity; - for (let index = 0; index < list.length; index++) { - let candidate = list[index]; - if (isBlank(candidate)) { - continue; - } - let candidateValue = predicate(candidate); - if (candidateValue > maxValue) { - solution = candidate; - maxValue = candidateValue; - } - } - return solution; - } - - static flatten(list: Array): T[] { - let target: any[] = []; - _flattenArray(list, target); - return target; - } - - static addAll(list: Array, source: Array): void { - for (let i = 0; i < source.length; i++) { - list.push(source[i]); - } - } -} - -function _flattenArray(source: any[], target: any[]): any[] { - if (isPresent(source)) { - for (let i = 0; i < source.length; i++) { - let item = source[i]; - if (isArray(item)) { - _flattenArray(item, target); - } else { - target.push(item); - } - } - } - return target; -} diff --git a/nativescript-angular/directives.ts b/nativescript-angular/directives.ts deleted file mode 100644 index 2e07c59d5..000000000 --- a/nativescript-angular/directives.ts +++ /dev/null @@ -1,42 +0,0 @@ -import { ListViewComponent, TemplateKeyDirective } from "./directives/list-view-comp"; -import { TabViewDirective, TabViewItemDirective } from "./directives/tab-view"; -import { - ActionBarComponent, - ActionBarScope, - ActionItemDirective, - NavigationButtonDirective -} from "./directives/action-bar"; -import { AndroidFilterComponent, IosFilterComponent } from "./directives/platform-filters"; - -export const NS_DIRECTIVES = [ - ListViewComponent, - TemplateKeyDirective, - TabViewDirective, - TabViewItemDirective, - ActionBarComponent, - ActionBarScope, - ActionItemDirective, - NavigationButtonDirective, - AndroidFilterComponent, - IosFilterComponent, -]; - -export { - ListViewComponent, - SetupItemViewArgs, - TemplateKeyDirective -} from "./directives/list-view-comp"; -export { TextValueAccessor } from "./value-accessors/text-value-accessor"; -export { CheckedValueAccessor } from "./value-accessors/checked-value-accessor"; -export { DateValueAccessor } from "./value-accessors/date-value-accessor"; -export { TimeValueAccessor } from "./value-accessors/time-value-accessor"; -export { NumberValueAccessor } from "./value-accessors/number-value-accessor"; -export { SelectedIndexValueAccessor } from "./value-accessors/selectedIndex-value-accessor"; -export { TabViewDirective, TabViewItemDirective } from "./directives/tab-view"; -export { - ActionBarComponent, - ActionBarScope, - ActionItemDirective, - NavigationButtonDirective -} from "./directives/action-bar"; -export { AndroidFilterComponent, IosFilterComponent } from "./directives/platform-filters"; diff --git a/nativescript-angular/directives/index.ts b/nativescript-angular/directives/index.ts new file mode 100644 index 000000000..9a8a6fd69 --- /dev/null +++ b/nativescript-angular/directives/index.ts @@ -0,0 +1,37 @@ +import { ListViewComponent, TemplateKeyDirective } from "./list-view-comp"; +import { TabViewDirective, TabViewItemDirective } from "./tab-view"; +import { + ActionBarComponent, + ActionBarScope, + ActionItemDirective, + NavigationButtonDirective +} from "./action-bar"; +import { AndroidFilterComponent, IosFilterComponent } from "./platform-filters"; + +export { + ListViewComponent, + SetupItemViewArgs, + TemplateKeyDirective +} from "./list-view-comp"; + +export { TabViewDirective, TabViewItemDirective } from "./tab-view"; +export { + ActionBarComponent, + ActionBarScope, + ActionItemDirective, + NavigationButtonDirective +} from "./action-bar"; +export { AndroidFilterComponent, IosFilterComponent } from "./platform-filters"; + +export const NS_DIRECTIVES = [ + ListViewComponent, + TemplateKeyDirective, + TabViewDirective, + TabViewItemDirective, + ActionBarComponent, + ActionBarScope, + ActionItemDirective, + NavigationButtonDirective, + AndroidFilterComponent, + IosFilterComponent, +]; diff --git a/nativescript-angular/directives/list-view-comp.ts b/nativescript-angular/directives/list-view-comp.ts index f2237df90..351441cce 100644 --- a/nativescript-angular/directives/list-view-comp.ts +++ b/nativescript-angular/directives/list-view-comp.ts @@ -18,6 +18,7 @@ import { TemplateRef, ViewChild, ViewContainerRef, + ɵisListLikeIterable as isListLikeIterable } from "@angular/core"; import { ListView, ItemEventData } from "tns-core-modules/ui/list-view"; import { View, KeyedTemplate } from "tns-core-modules/ui/core/view"; @@ -26,7 +27,6 @@ import { ObservableArray } from "tns-core-modules/data/observable-array"; import { profile } from "tns-core-modules/profiling"; import { getSingleViewRecursive } from "../element-registry"; -import { isListLikeIterable } from "../collection-facade"; import { listViewLog, listViewError } from "../trace"; const NG_VIEW = "_ngViewRef"; diff --git a/nativescript-angular/dom-adapter.ts b/nativescript-angular/dom-adapter.ts index f577c5ae0..e228f92a5 100644 --- a/nativescript-angular/dom-adapter.ts +++ b/nativescript-angular/dom-adapter.ts @@ -2,7 +2,6 @@ import { Type } from "@angular/core"; import { ɵDomAdapter } from "@angular/platform-browser"; import { rendererLog } from "./trace"; -import { print } from "./lang-facade"; export class NativeScriptDomAdapter implements ɵDomAdapter { static makeCurrent() { @@ -27,15 +26,15 @@ export class NativeScriptDomAdapter implements ɵDomAdapter { } log(arg: any): void { - print(arg); + console.log(arg); } logError(arg: any): void { - print(arg); + console.log(arg); } logGroup(arg: any): void { - print(arg); + console.log(arg); } logGroupEnd(): void { diff --git a/nativescript-angular/forms.ts b/nativescript-angular/forms/forms.module.ts similarity index 51% rename from nativescript-angular/forms.ts rename to nativescript-angular/forms/forms.module.ts index e449fc79f..814b08727 100644 --- a/nativescript-angular/forms.ts +++ b/nativescript-angular/forms/forms.module.ts @@ -1,11 +1,13 @@ import { NgModule } from "@angular/core"; import { FormsModule } from "@angular/forms"; -import { TextValueAccessor } from "./value-accessors/text-value-accessor"; -import { CheckedValueAccessor } from "./value-accessors/checked-value-accessor"; -import { DateValueAccessor } from "./value-accessors/date-value-accessor"; -import { TimeValueAccessor } from "./value-accessors/time-value-accessor"; -import { NumberValueAccessor } from "./value-accessors/number-value-accessor"; -import { SelectedIndexValueAccessor } from "./value-accessors/selectedIndex-value-accessor"; +import { + TextValueAccessor, + CheckedValueAccessor, + DateValueAccessor, + TimeValueAccessor, + NumberValueAccessor, + SelectedIndexValueAccessor +} from "./value-accessors"; export const FORMS_DIRECTIVES = [ TextValueAccessor, diff --git a/nativescript-angular/forms/index.ts b/nativescript-angular/forms/index.ts new file mode 100644 index 000000000..a95e3e129 --- /dev/null +++ b/nativescript-angular/forms/index.ts @@ -0,0 +1 @@ +export * from "./forms.module"; diff --git a/nativescript-angular/value-accessors/base-value-accessor.ts b/nativescript-angular/forms/value-accessors/base-value-accessor.ts similarity index 100% rename from nativescript-angular/value-accessors/base-value-accessor.ts rename to nativescript-angular/forms/value-accessors/base-value-accessor.ts diff --git a/nativescript-angular/value-accessors/checked-value-accessor.ts b/nativescript-angular/forms/value-accessors/checked-value-accessor.ts similarity index 100% rename from nativescript-angular/value-accessors/checked-value-accessor.ts rename to nativescript-angular/forms/value-accessors/checked-value-accessor.ts diff --git a/nativescript-angular/value-accessors/date-value-accessor.ts b/nativescript-angular/forms/value-accessors/date-value-accessor.ts similarity index 100% rename from nativescript-angular/value-accessors/date-value-accessor.ts rename to nativescript-angular/forms/value-accessors/date-value-accessor.ts diff --git a/nativescript-angular/forms/value-accessors/index.ts b/nativescript-angular/forms/value-accessors/index.ts new file mode 100644 index 000000000..351151606 --- /dev/null +++ b/nativescript-angular/forms/value-accessors/index.ts @@ -0,0 +1,7 @@ +export * from "./base-value-accessor"; +export * from "./text-value-accessor"; +export * from "./checked-value-accessor"; +export * from "./date-value-accessor"; +export * from "./time-value-accessor"; +export * from "./number-value-accessor"; +export * from "./selectedIndex-value-accessor"; diff --git a/nativescript-angular/value-accessors/number-value-accessor.ts b/nativescript-angular/forms/value-accessors/number-value-accessor.ts similarity index 100% rename from nativescript-angular/value-accessors/number-value-accessor.ts rename to nativescript-angular/forms/value-accessors/number-value-accessor.ts diff --git a/nativescript-angular/value-accessors/selectedIndex-value-accessor.ts b/nativescript-angular/forms/value-accessors/selectedIndex-value-accessor.ts similarity index 100% rename from nativescript-angular/value-accessors/selectedIndex-value-accessor.ts rename to nativescript-angular/forms/value-accessors/selectedIndex-value-accessor.ts diff --git a/nativescript-angular/value-accessors/text-value-accessor.ts b/nativescript-angular/forms/value-accessors/text-value-accessor.ts similarity index 100% rename from nativescript-angular/value-accessors/text-value-accessor.ts rename to nativescript-angular/forms/value-accessors/text-value-accessor.ts diff --git a/nativescript-angular/value-accessors/time-value-accessor.ts b/nativescript-angular/forms/value-accessors/time-value-accessor.ts similarity index 100% rename from nativescript-angular/value-accessors/time-value-accessor.ts rename to nativescript-angular/forms/value-accessors/time-value-accessor.ts diff --git a/nativescript-angular/index.ts b/nativescript-angular/index.ts index 2270a8ac4..e5f4bfb8b 100644 --- a/nativescript-angular/index.ts +++ b/nativescript-angular/index.ts @@ -26,4 +26,4 @@ export { registerElement, } from "./element-registry"; -export * from "./value-accessors/base-value-accessor"; +export * from "./forms/value-accessors/base-value-accessor"; diff --git a/nativescript-angular/lang-facade.ts b/nativescript-angular/lang-facade.ts index 424b1c64a..31b567065 100644 --- a/nativescript-angular/lang-facade.ts +++ b/nativescript-angular/lang-facade.ts @@ -1,8 +1,3 @@ -/* tslint:disable */ -//Copied unexported functions from @angular/core/src/facade/lang -var globalScope = global; -export var global = globalScope; - export function isPresent(obj: any): boolean { return obj !== undefined && obj !== null; } @@ -10,58 +5,3 @@ export function isPresent(obj: any): boolean { export function isBlank(obj: any): boolean { return obj === undefined || obj === null; } - -export function isDate(obj: any): obj is Date { - return obj instanceof Date && !isNaN(obj.valueOf()); -} - -export function print(obj: Error | Object) { - console.log(obj); -} - -export function isJsObject(o: any): boolean { - return o !== null && (typeof o === 'function' || typeof o === 'object'); -} - -export function isArray(obj: any): boolean { - return Array.isArray(obj); -} - -// When Symbol.iterator doesn't exist, retrieves the key used in es6-shim -declare var Symbol: any; -let _symbolIterator: any = null; -export function getSymbolIterator(): string|symbol { - if (isBlank(_symbolIterator)) { - if (isPresent((globalScope).Symbol) && isPresent(Symbol.iterator)) { - _symbolIterator = Symbol.iterator; - } else { - // es6-shim specific logic - let keys = Object.getOwnPropertyNames(Map.prototype); - for (let i = 0; i < keys.length; ++i) { - let key = keys[i]; - if (key !== 'entries' && key !== 'size' && - (Map as any).prototype[key] === Map.prototype['entries']) { - _symbolIterator = key; - } - } - } - } - return _symbolIterator; -} - -export function setValueOnPath(global: any, path: string, value: any) { - let parts = path.split('.'); - let obj: any = global; - while (parts.length > 1) { - let name = parts.shift(); - if (obj.hasOwnProperty(name) && isPresent(obj[name])) { - obj = obj[name]; - } else { - obj = obj[name] = {}; - } - } - if (obj === undefined || obj === null) { - obj = {}; - } - obj[parts.shift()] = value; -} diff --git a/nativescript-angular/renderer.ts b/nativescript-angular/renderer.ts index f4edba521..cdf550fca 100644 --- a/nativescript-angular/renderer.ts +++ b/nativescript-angular/renderer.ts @@ -11,7 +11,6 @@ import { topmost } from "tns-core-modules/ui/frame"; import { profile } from "tns-core-modules/profiling"; import { APP_ROOT_VIEW, DEVICE, getRootPage } from "./platform-providers"; -import { isBlank } from "./lang-facade"; import { ViewUtil } from "./view-util"; import { NgView, InvisibleNode } from "./element-registry"; import { rendererLog as traceLog } from "./trace"; @@ -60,7 +59,7 @@ export class NativeScriptRendererFactory implements RendererFactory2 { } let renderer: NativeScriptRenderer = this.componentRenderers.get(type.id); - if (!isBlank(renderer)) { + if (renderer) { return renderer; } diff --git a/nativescript-angular/router/index.ts b/nativescript-angular/router/index.ts new file mode 100644 index 000000000..d13492a9e --- /dev/null +++ b/nativescript-angular/router/index.ts @@ -0,0 +1 @@ +export * from "./router.module"; diff --git a/nativescript-angular/router/ns-router-link-active.ts b/nativescript-angular/router/ns-router-link-active.ts index 0751ce573..9d0210e74 100644 --- a/nativescript-angular/router/ns-router-link-active.ts +++ b/nativescript-angular/router/ns-router-link-active.ts @@ -6,7 +6,7 @@ import { import { Subscription } from "rxjs/Subscription"; import { NavigationEnd, Router, UrlTree } from "@angular/router"; -import { containsTree } from "../router-url-tree"; +import { containsTree } from "./private-imports/router-url-tree"; import { NSRouterLink } from "./ns-router-link"; @@ -127,5 +127,4 @@ export class NSRouterLinkActive implements OnChanges, OnDestroy, AfterContentIni private hasActiveLinks(): boolean { return this.links.some(this.isLinkActive(this.router)); } - } diff --git a/nativescript-angular/router/page-router-outlet.ts b/nativescript-angular/router/page-router-outlet.ts index 8c165cfcc..2695026c4 100644 --- a/nativescript-angular/router/page-router-outlet.ts +++ b/nativescript-angular/router/page-router-outlet.ts @@ -19,7 +19,6 @@ import { profile } from "tns-core-modules/profiling"; import { BehaviorSubject } from "rxjs/BehaviorSubject"; -import { isPresent } from "../lang-facade"; import { DEVICE, PAGE_FACTORY, PageFactory } from "../platform-providers"; import { routerLog as log } from "../trace"; import { DetachedLoader } from "../common/detached-loader"; @@ -40,9 +39,9 @@ export const pageRouterActivatedSymbol = Symbol("page-router-activated"); export const loaderRefSymbol = Symbol("loader-ref"); export function destroyComponentRef(componentRef: ComponentRef) { - if (isPresent(componentRef)) { + if (componentRef) { const loaderRef = componentRef[loaderRefSymbol]; - if (isPresent(loaderRef)) { + if (loaderRef) { loaderRef.destroy(); } componentRef.destroy(); diff --git a/nativescript-angular/router-url-tree.ts b/nativescript-angular/router/private-imports/router-url-tree.ts similarity index 100% rename from nativescript-angular/router-url-tree.ts rename to nativescript-angular/router/private-imports/router-url-tree.ts diff --git a/nativescript-angular/router.ts b/nativescript-angular/router/router.module.ts similarity index 70% rename from nativescript-angular/router.ts rename to nativescript-angular/router/router.module.ts index 6bfc6b359..066c437d0 100644 --- a/nativescript-angular/router.ts +++ b/nativescript-angular/router/router.module.ts @@ -8,18 +8,18 @@ import { import { RouterModule, Routes, ExtraOptions, RouteReuseStrategy } from "@angular/router"; import { LocationStrategy, PlatformLocation } from "@angular/common"; import { Frame } from "tns-core-modules/ui/frame"; -import { NSRouterLink } from "./router/ns-router-link"; -import { NSRouterLinkActive } from "./router/ns-router-link-active"; -import { PageRouterOutlet } from "./router/page-router-outlet"; -import { NSLocationStrategy, LocationState } from "./router/ns-location-strategy"; -import { NativescriptPlatformLocation } from "./router/ns-platform-location"; -import { NSRouteReuseStrategy } from "./router/ns-route-reuse-strategy"; -import { RouterExtensions } from "./router/router-extensions"; -import { NativeScriptCommonModule } from "./common"; +import { NSRouterLink } from "./ns-router-link"; +import { NSRouterLinkActive } from "./ns-router-link-active"; +import { PageRouterOutlet } from "./page-router-outlet"; +import { NSLocationStrategy, LocationState } from "./ns-location-strategy"; +import { NativescriptPlatformLocation } from "./ns-platform-location"; +import { NSRouteReuseStrategy } from "./ns-route-reuse-strategy"; +import { RouterExtensions } from "./router-extensions"; +import { NativeScriptCommonModule } from "../common"; -export { PageRoute } from "./router/page-router-outlet"; -export { RouterExtensions } from "./router/router-extensions"; -export { NSModuleFactoryLoader } from "./router/ns-module-factory-loader"; +export { PageRoute } from "./page-router-outlet"; +export { RouterExtensions } from "./router-extensions"; +export { NSModuleFactoryLoader } from "./ns-module-factory-loader"; export type LocationState = LocationState; @NgModule({ diff --git a/ng-sample/app/examples/renderer-test.ts b/ng-sample/app/examples/renderer-test.ts index 7ceb33849..232aaed4a 100644 --- a/ng-sample/app/examples/renderer-test.ts +++ b/ng-sample/app/examples/renderer-test.ts @@ -1,7 +1,5 @@ import { Component, Directive, Host, ElementRef, Input } from "@angular/core"; import { Observable } from "data/observable"; -import { TextValueAccessor } from "nativescript-angular/value-accessors/text-value-accessor"; -import { CheckedValueAccessor } from "nativescript-angular/value-accessors/checked-value-accessor"; import { SegmentedBarItem } from "ui/segmented-bar"; diff --git a/tests/app/tests/value-accessor-tests.ts b/tests/app/tests/value-accessor-tests.ts index c1d6c53fc..57b7173ed 100644 --- a/tests/app/tests/value-accessor-tests.ts +++ b/tests/app/tests/value-accessor-tests.ts @@ -1,22 +1,24 @@ // make sure you import mocha-config before @angular/core -import {assert} from "./test-config"; -import {View} from "ui/core/view"; -import {Slider} from "ui/slider"; -import {Switch} from "ui/switch"; -import {DatePicker} from "ui/date-picker"; -import {TimePicker} from "ui/time-picker"; -import {ListPicker} from "ui/list-picker"; -import {TextField} from "ui/text-field"; -import {NumberValueAccessor} from "nativescript-angular/value-accessors/number-value-accessor"; -import {CheckedValueAccessor} from "nativescript-angular/value-accessors/checked-value-accessor"; -import {DateValueAccessor} from "nativescript-angular/value-accessors/date-value-accessor"; -import {TimeValueAccessor} from "nativescript-angular/value-accessors/time-value-accessor"; -import {SelectedIndexValueAccessor} from "nativescript-angular/value-accessors/selectedIndex-value-accessor"; -import {TextValueAccessor} from "nativescript-angular/value-accessors/text-value-accessor"; -import {ElementRef} from "@angular/core"; +import { assert } from "./test-config"; +import { View } from "ui/core/view"; +import { Slider } from "ui/slider"; +import { Switch } from "ui/switch"; +import { DatePicker } from "ui/date-picker"; +import { TimePicker } from "ui/time-picker"; +import { ListPicker } from "ui/list-picker"; +import { TextField } from "ui/text-field"; +import { + NumberValueAccessor, + CheckedValueAccessor, + DateValueAccessor, + TimeValueAccessor, + SelectedIndexValueAccessor, + TextValueAccessor +} from "nativescript-angular/forms/value-accessors"; +import { ElementRef } from "@angular/core"; class TestElementRef implements ElementRef { - constructor(public nativeElement: View) {}; + constructor(public nativeElement: View) { }; } class TestNumberValueAccessor extends NumberValueAccessor { @@ -138,7 +140,7 @@ describe("two-way binding via ng-model", () => { accessor.writeValue("blah"); assert.equal("blah", accessor.view.text); - accessor.writeValue({toString: () => "stringified"}); + accessor.writeValue({ toString: () => "stringified" }); assert.equal("stringified", accessor.view.text); }); });