diff --git a/.gitignore b/.gitignore index dd6efed86..e87afa0c2 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,7 @@ src/nativescript-angular/**/*.js .nvm tests/app/**/*.js +tests/app/global.d.ts tests/test-output.txt tests/app/nativescript-angular tests/app/global.d.ts diff --git a/ng-sample/package.json b/ng-sample/package.json index a3124138f..cea5e6426 100644 --- a/ng-sample/package.json +++ b/ng-sample/package.json @@ -23,15 +23,15 @@ }, "homepage": "https://github.com/NativeScript/template-hello-world", "dependencies": { - "tns-core-modules": "^1.6.0", - "angular2": "2.0.0-beta.6", + "tns-core-modules": "^1.7.0-angular-0", + "angular2": "2.0.0-beta.7", "parse5": "1.4.2", "punycode": "1.3.2", "querystring": "0.2.0", "url": "0.10.3", "reflect-metadata": "0.1.2", - "rxjs": "5.0.0-beta.0", - "zone.js": "0.5.14" + "rxjs": "5.0.0-beta.2", + "zone.js": "0.5.15" }, "devDependencies": { "grunt": "0.4.5", @@ -39,15 +39,15 @@ "grunt-contrib-copy": "0.8.0", "grunt-shell": "1.1.2", "grunt-ts": "5.0.0-beta.5", - "nativescript-dev-typescript": "^0.2.2", + "nativescript-dev-typescript": "^0.3.1", "shelljs": "^0.5.3", - "typescript": "^1.7.5", + "typescript": "1.8.2", "webpack": "^1.12.9" }, "nativescript": { "id": "org.nativescript.ngsample", "tns-android": { - "version": "1.6.0" + "version": "1.6.2" } } } \ No newline at end of file diff --git a/package.json b/package.json index 8ec728514..d6106e20b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "nativescript-angular", - "version": "0.0.33", + "version": "0.0.34", "description": "", "homepage": "http://www.telerik.com", "bugs": "http://www.telerik.com", @@ -14,16 +14,16 @@ }, "scripts": {}, "dependencies": { - "tns-core-modules": "^1.6.1-angular-0", - "angular2": "2.0.0-beta.6", + "tns-core-modules": "^1.7.0-angular-0", + "angular2": "2.0.0-beta.7", "es6-shim": "^0.33.3", "parse5": "1.4.2", "punycode": "1.3.2", "querystring": "0.2.0", "url": "0.10.3", "reflect-metadata": "0.1.2", - "rxjs": "5.0.0-beta.0", - "zone.js": "0.5.14" + "rxjs": "5.0.0-beta.2", + "zone.js": "0.5.15" }, "devDependencies": { "grunt": "0.4.5", @@ -34,6 +34,6 @@ "grunt-env": "0.4.4", "grunt-ts": "5.0.0-beta.5", "shelljs": "^0.5.3", - "typescript": "1.7.3" + "typescript": "1.8.2" } } diff --git a/src/global.d.ts b/src/global.d.ts index a36f402da..cdc8796b9 100644 --- a/src/global.d.ts +++ b/src/global.d.ts @@ -1,9 +1,14 @@ /// -interface Map { - keys(): Array; - values(): Array; +//Compatibility interfaces for rxjs + +interface IteratorResult { + done: boolean; + value?: T; } -declare type MapConstructor = typeof Map; -declare type SetConstructor = typeof Set; +interface Iterator { + next(value?: any): IteratorResult; + return?(value?: any): IteratorResult; + throw?(e?: any): IteratorResult; +} diff --git a/src/nativescript-angular/application.ts b/src/nativescript-angular/application.ts index d61635f23..7f4b48939 100644 --- a/src/nativescript-angular/application.ts +++ b/src/nativescript-angular/application.ts @@ -1,10 +1,16 @@ //Import globals before the zone, so the latter can patch the global functions import 'globals'; + +//prevent a crash in zone patches +global.HTMLElement = function() {} +global.document = {}; import "zone.js/dist/zone.js" +global.HTMLElement = undefined; +global.document = undefined; + import 'reflect-metadata'; import './polyfills/array'; import {isPresent, Type} from 'angular2/src/facade/lang'; -import {Promise, PromiseWrapper} from 'angular2/src/facade/async'; import {platform, ComponentRef, PLATFORM_DIRECTIVES, PLATFORM_PIPES} from 'angular2/core'; import {bind, provide, Provider} from 'angular2/src/core/di'; import {DOM} from 'angular2/src/platform/dom/dom_adapter'; diff --git a/src/nativescript-angular/directives/list-view.ts b/src/nativescript-angular/directives/list-view.ts index 0baffbbcb..bbc8bd253 100644 --- a/src/nativescript-angular/directives/list-view.ts +++ b/src/nativescript-angular/directives/list-view.ts @@ -1,5 +1,9 @@ -import {HostListener, Host, Directive, Component, ContentChild, EmbeddedViewRef, TemplateRef, ViewContainerRef} from 'angular2/core'; -import {View} from 'ui'; +import { + HostListener, Host, Directive, + Component, ContentChild, EmbeddedViewRef, + TemplateRef, ViewContainerRef +} from 'angular2/core'; +import {View} from 'ui/core/view'; import {NgView} from '../view-util' const NG_VIEW = "_ngViewRef"; @@ -87,4 +91,4 @@ function getSingleViewFromViewRef(viewRef: EmbeddedViewRef): View { } return getSingleViewRecursive(viewRef.rootNodes, 0); -} \ No newline at end of file +} diff --git a/src/nativescript-angular/router/page-router-outlet.ts b/src/nativescript-angular/router/page-router-outlet.ts index 5655e2183..28d7e967b 100644 --- a/src/nativescript-angular/router/page-router-outlet.ts +++ b/src/nativescript-angular/router/page-router-outlet.ts @@ -3,18 +3,21 @@ import {isBlank, isPresent} from 'angular2/src/facade/lang'; import {StringMapWrapper} from 'angular2/src/facade/collection'; import {Directive, Attribute, DynamicComponentLoader, ComponentRef, ElementRef, -Injector, provide, Type, Component, OpaqueToken, Inject} from 'angular2/core'; + Injector, provide, Type, Component, OpaqueToken, Inject} from 'angular2/core'; import * as routerHooks from 'angular2/src/router/lifecycle_annotations'; -import { hasLifecycleHook} from 'angular2/src/router/route_lifecycle_reflector'; - -import { ComponentInstruction, RouteParams, RouteData, RouterOutlet, LocationStrategy, Router, -OnActivate, OnDeactivate, CanReuse, OnReuse } from 'angular2/router'; - -import { topmost } from "ui"; -import { Page, NavigatedData } from "ui/page"; -import { log } from "./common"; -import { NSLocationStrategy } from "./ns-location-strategy"; +import {hasLifecycleHook} from 'angular2/src/router/route_lifecycle_reflector'; + +import { + ComponentInstruction, RouteParams, RouteData, + RouterOutlet, LocationStrategy, Router, + OnActivate, OnDeactivate, CanReuse, OnReuse +} from 'angular2/router'; + +import {topmost} from "ui/frame"; +import {Page, NavigatedData} from "ui/page"; +import {log} from "./common"; +import {NSLocationStrategy} from "./ns-location-strategy"; let COMPONENT = new OpaqueToken("COMPONENT"); diff --git a/tests/app/global.d.ts b/tests/app/global.d.ts deleted file mode 100644 index a36f402da..000000000 --- a/tests/app/global.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -/// - -interface Map { - keys(): Array; - values(): Array; -} - -declare type MapConstructor = typeof Map; -declare type SetConstructor = typeof Set; diff --git a/tests/package.json b/tests/package.json index 3bc78ad40..060b324fe 100644 --- a/tests/package.json +++ b/tests/package.json @@ -2,7 +2,7 @@ "nativescript": { "id": "org.nativescript.helloworldng", "tns-android": { - "version": "1.6.0" + "version": "1.6.2" } }, "name": "nativescript-hello-world-ng", @@ -27,16 +27,16 @@ }, "homepage": "http://nativescript.org", "dependencies": { - "angular2": "2.0.0-beta.6", + "tns-core-modules": "^1.7.0-angular-0", + "angular2": "2.0.0-beta.7", "nativescript-unit-test-runner": "^0.2.8", "parse5": "1.4.2", "punycode": "1.3.2", "querystring": "0.2.0", "reflect-metadata": "0.1.2", - "rxjs": "5.0.0-beta.0", - "tns-core-modules": "1.6.0", "url": "0.10.3", - "zone.js": "0.5.14" + "rxjs": "5.0.0-beta.2", + "zone.js": "0.5.15" }, "devDependencies": { "chai": "^3.5.0", @@ -45,8 +45,8 @@ "karma-mocha": "^0.2.1", "karma-nativescript-launcher": "^0.3.1", "mocha": "^2.4.5", - "nativescript-dev-typescript": "^0.2.2", + "nativescript-dev-typescript": "^0.3.1", "shelljs": "^0.5.3", - "typescript": "^1.7.5" + "typescript": "1.8.2" } } \ No newline at end of file diff --git a/tests/typings/chai.d.ts b/tests/typings/chai.d.ts new file mode 100644 index 000000000..113158d83 --- /dev/null +++ b/tests/typings/chai.d.ts @@ -0,0 +1,283 @@ +// Type definitions for chai 1.7.2 +// Project: http://chaijs.com/ +// Definitions by: Jed Hunsaker , Bart van der Schoor +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module chai { + export class AssertionError { + constructor(message: string, _props?: any, ssf?: Function); + name: string; + message: string; + showDiff: boolean; + stack: string; + } + + function expect(target: any, message?: string): Expect; + + export var assert: Assert; + export var config: Config; + + export interface Config { + includeStack: boolean; + } + + // Provides a way to extend the internals of Chai + function use(fn: (chai: any, utils: any) => void): any; + + interface ExpectStatic { + (target: any): Expect; + } + + interface Assertions { + attr(name: string, value?: string): any; + css(name: string, value?: string): any; + data(name: string, value?: string): any; + class(className: string): any; + id(id: string): any; + html(html: string): any; + text(text: string): any; + value(value: string): any; + visible: any; + hidden: any; + selected: any; + checked: any; + disabled: any; + empty: any; + exist: any; + } + + interface Expect extends LanguageChains, NumericComparison, TypeComparison, Assertions { + not: Expect; + deep: Deep; + a: TypeComparison; + an: TypeComparison; + include: Include; + contain: Include; + ok: Expect; + true: Expect; + false: Expect; + null: Expect; + undefined: Expect; + exist: Expect; + empty: Expect; + arguments: Expect; + Arguments: Expect; + equal: Equal; + equals: Equal; + eq: Equal; + eql: Equal; + eqls: Equal; + property: Property; + ownProperty: OwnProperty; + haveOwnProperty: OwnProperty; + length: Length; + lengthOf: Length; + match(RegularExpression: RegExp, message?: string): Expect; + string(string: string, message?: string): Expect; + keys: Keys; + key(string: string): Expect; + throw: Throw; + throws: Throw; + Throw: Throw; + respondTo(method: string, message?: string): Expect; + itself: Expect; + satisfy(matcher: Function, message?: string): Expect; + closeTo(expected: number, delta: number, message?: string): Expect; + members: Members; + } + + interface LanguageChains { + to: Expect; + be: Expect; + been: Expect; + is: Expect; + that: Expect; + and: Expect; + have: Expect; + with: Expect; + at: Expect; + of: Expect; + same: Expect; + } + + interface NumericComparison { + above: NumberComparer; + gt: NumberComparer; + greaterThan: NumberComparer; + least: NumberComparer; + gte: NumberComparer; + below: NumberComparer; + lt: NumberComparer; + lessThan: NumberComparer; + most: NumberComparer; + lte: NumberComparer; + within(start: number, finish: number, message?: string): Expect; + } + + interface NumberComparer { + (value: number, message?: string): Expect; + } + + interface TypeComparison { + (type: string, message?: string): Expect; + instanceof: InstanceOf; + instanceOf: InstanceOf; + } + + interface InstanceOf { + (constructor: Object, message?: string): Expect; + } + + interface Deep { + equal: Equal; + property: Property; + } + + interface Equal { + (value: any, message?: string): Expect; + } + + interface Property { + (name: string, value?: any, message?: string): Expect; + } + + interface OwnProperty { + (name: string, message?: string): Expect; + } + + interface Length extends LanguageChains, NumericComparison { + (length: number, message?: string): Expect; + } + + interface Include { + (value: Object, message?: string): Expect; + (value: string, message?: string): Expect; + (value: number, message?: string): Expect; + keys: Keys; + members: Members; + } + + interface Keys { + (...keys: string[]): Expect; + (keys: any[]): Expect; + } + + interface Members { + (set: any[], message?: string): Expect; + } + + interface Throw { + (): Expect; + (expected: string, message?: string): Expect; + (expected: RegExp, message?: string): Expect; + (constructor: Error, expected?: string, message?: string): Expect; + (constructor: Error, expected?: RegExp, message?: string): Expect; + (constructor: Function, expected?: string, message?: string): Expect; + (constructor: Function, expected?: RegExp, message?: string): Expect; + } + + export interface Assert { + (express: any, msg?: string):void; + + fail(actual?: any, expected?: any, msg?: string, operator?: string):void; + + ok(val: any, msg?: string):void; + notOk(val: any, msg?: string):void; + + equal(act: any, exp: any, msg?: string):void; + notEqual(act: any, exp: any, msg?: string):void; + + strictEqual(act: any, exp: any, msg?: string):void; + notStrictEqual(act: any, exp: any, msg?: string):void; + + deepEqual(act: any, exp: any, msg?: string):void; + notDeepEqual(act: any, exp: any, msg?: string):void; + + isTrue(val: any, msg?: string):void; + isFalse(val: any, msg?: string):void; + + isNull(val: any, msg?: string):void; + isNotNull(val: any, msg?: string):void; + + isUndefined(val: any, msg?: string):void; + isDefined(val: any, msg?: string):void; + + isFunction(val: any, msg?: string):void; + isNotFunction(val: any, msg?: string):void; + + isObject(val: any, msg?: string):void; + isNotObject(val: any, msg?: string):void; + + isArray(val: any, msg?: string):void; + isNotArray(val: any, msg?: string):void; + + isString(val: any, msg?: string):void; + isNotString(val: any, msg?: string):void; + + isNumber(val: any, msg?: string):void; + isNotNumber(val: any, msg?: string):void; + + isBoolean(val: any, msg?: string):void; + isNotBoolean(val: any, msg?: string):void; + + typeOf(val: any, type: string, msg?: string):void; + notTypeOf(val: any, type: string, msg?: string):void; + + instanceOf(val: any, type: Function, msg?: string):void; + notInstanceOf(val: any, type: Function, msg?: string):void; + + include(exp: string, inc: any, msg?: string):void; + include(exp: any[], inc: any, msg?: string):void; + + notInclude(exp: string, inc: any, msg?: string):void; + notInclude(exp: any[], inc: any, msg?: string):void; + + match(exp: any, re: RegExp, msg?: string):void; + notMatch(exp: any, re: RegExp, msg?: string):void; + + property(obj: Object, prop: string, msg?: string):void; + notProperty(obj: Object, prop: string, msg?: string):void; + deepProperty(obj: Object, prop: string, msg?: string):void; + notDeepProperty(obj: Object, prop: string, msg?: string):void; + + propertyVal(obj: Object, prop: string, val: any, msg?: string):void; + propertyNotVal(obj: Object, prop: string, val: any, msg?: string):void; + + deepPropertyVal(obj: Object, prop: string, val: any, msg?: string):void; + deepPropertyNotVal(obj: Object, prop: string, val: any, msg?: string):void; + + lengthOf(exp: any, len: number, msg?: string):void; + //alias frenzy + throw(fn: Function, msg?: string):void; + throw(fn: Function, regExp: RegExp):void; + throw(fn: Function, errType: Function, msg?: string):void; + throw(fn: Function, errType: Function, regExp: RegExp):void; + + throws(fn: Function, msg?: string):void; + throws(fn: Function, regExp: RegExp):void; + throws(fn: Function, errType: Function, msg?: string):void; + throws(fn: Function, errType: Function, regExp: RegExp):void; + + Throw(fn: Function, msg?: string):void; + Throw(fn: Function, regExp: RegExp):void; + Throw(fn: Function, errType: Function, msg?: string):void; + Throw(fn: Function, errType: Function, regExp: RegExp):void; + + doesNotThrow(fn: Function, msg?: string):void; + doesNotThrow(fn: Function, regExp: RegExp):void; + doesNotThrow(fn: Function, errType: Function, msg?: string):void; + doesNotThrow(fn: Function, errType: Function, regExp: RegExp):void; + + operator(val: any, operator: string, val2: any, msg?: string):void; + closeTo(act: number, exp: number, delta: number, msg?: string):void; + + sameMembers(set1: any[], set2: any[], msg?: string):void; + includeMembers(set1: any[], set2: any[], msg?: string):void; + + ifError(val: any, msg?: string):void; + } +} + +declare module "chai" { +export = chai; +}