refactor: Remove isDart from public API
BREAKING CHANGE: - `IS_DARTIUM` no longer exported
This commit is contained in:
parent
5c328adb4b
commit
b7837389d7
|
@ -7,8 +7,7 @@ import {
|
||||||
BaseException,
|
BaseException,
|
||||||
assertionsEnabled,
|
assertionsEnabled,
|
||||||
print,
|
print,
|
||||||
stringify,
|
stringify
|
||||||
isDart
|
|
||||||
} from 'angular2/src/facade/lang';
|
} from 'angular2/src/facade/lang';
|
||||||
import {BrowserDomAdapter} from 'angular2/src/dom/browser_adapter';
|
import {BrowserDomAdapter} from 'angular2/src/dom/browser_adapter';
|
||||||
import {DOM} from 'angular2/src/dom/dom_adapter';
|
import {DOM} from 'angular2/src/dom/dom_adapter';
|
||||||
|
@ -76,6 +75,7 @@ import {
|
||||||
import {internalView} from 'angular2/src/core/compiler/view_ref';
|
import {internalView} from 'angular2/src/core/compiler/view_ref';
|
||||||
import {APP_COMPONENT_REF_PROMISE, APP_COMPONENT} from './application_tokens';
|
import {APP_COMPONENT_REF_PROMISE, APP_COMPONENT} from './application_tokens';
|
||||||
import {wtfInit} from '../profile/wtf_init';
|
import {wtfInit} from '../profile/wtf_init';
|
||||||
|
import {EXCEPTION_BINDING} from './platform_bindings';
|
||||||
|
|
||||||
var _rootInjector: Injector;
|
var _rootInjector: Injector;
|
||||||
|
|
||||||
|
@ -146,7 +146,7 @@ function _injectorBindings(appComponentType): List<Type | Binding | List<any>> {
|
||||||
PipeResolver,
|
PipeResolver,
|
||||||
Parser,
|
Parser,
|
||||||
Lexer,
|
Lexer,
|
||||||
bind(ExceptionHandler).toFactory(() => new ExceptionHandler(DOM, isDart ? false : true), []),
|
EXCEPTION_BINDING,
|
||||||
bind(XHR).toValue(new XHRImpl()),
|
bind(XHR).toValue(new XHRImpl()),
|
||||||
ComponentUrlMapper,
|
ComponentUrlMapper,
|
||||||
UrlResolver,
|
UrlResolver,
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
library angular2.platform_bindings;
|
||||||
|
|
||||||
|
|
||||||
|
import 'package:angular2/di.dart';
|
||||||
|
import './exception_handler.dart';
|
||||||
|
import 'package:angular2/src/dom/dom_adapter.dart';
|
||||||
|
|
||||||
|
exceptionFactory() => new ExceptionHandler(DOM, true);
|
||||||
|
|
||||||
|
const EXCEPTION_BINDING = const Binding(ExceptionHandler, toFactory: exceptionFactory, deps: const []);
|
|
@ -0,0 +1,6 @@
|
||||||
|
import {bind} from 'angular2/di';
|
||||||
|
import {ExceptionHandler} from './exception_handler';
|
||||||
|
import {DOM} from 'angular2/src/dom/dom_adapter';
|
||||||
|
|
||||||
|
export const EXCEPTION_BINDING =
|
||||||
|
bind(ExceptionHandler).toFactory(() => new ExceptionHandler(DOM, false), []);
|
|
@ -5,8 +5,6 @@ import 'dart:math' as math;
|
||||||
import 'dart:convert' as convert;
|
import 'dart:convert' as convert;
|
||||||
import 'dart:async' show Future;
|
import 'dart:async' show Future;
|
||||||
|
|
||||||
bool isDart = true;
|
|
||||||
|
|
||||||
String getTypeNameForDebugging(Type type) => type.toString();
|
String getTypeNameForDebugging(Type type) => type.toString();
|
||||||
|
|
||||||
class Math {
|
class Math {
|
||||||
|
|
|
@ -15,8 +15,6 @@ export function getTypeNameForDebugging(type: Type): string {
|
||||||
return type['name'];
|
return type['name'];
|
||||||
}
|
}
|
||||||
|
|
||||||
export var isDart = false;
|
|
||||||
|
|
||||||
export class BaseException extends Error {
|
export class BaseException extends Error {
|
||||||
stack;
|
stack;
|
||||||
constructor(public message?: string, private _originalException?, private _originalStack?,
|
constructor(public message?: string, private _originalException?, private _originalStack?,
|
||||||
|
|
|
@ -28,8 +28,6 @@ import 'package:angular2/src/facade/collection.dart' show StringMapWrapper;
|
||||||
import 'test_injector.dart';
|
import 'test_injector.dart';
|
||||||
export 'test_injector.dart' show inject;
|
export 'test_injector.dart' show inject;
|
||||||
|
|
||||||
bool IS_DARTIUM = true;
|
|
||||||
|
|
||||||
List _testBindings = [];
|
List _testBindings = [];
|
||||||
Injector _injector;
|
Injector _injector;
|
||||||
bool _isCurrentTestAsync;
|
bool _isCurrentTestAsync;
|
||||||
|
|
|
@ -33,9 +33,6 @@ export interface NgMatchers extends jasmine.Matchers {
|
||||||
|
|
||||||
export var expect: (actual: any) => NgMatchers = <any>_global.expect;
|
export var expect: (actual: any) => NgMatchers = <any>_global.expect;
|
||||||
|
|
||||||
// TODO vsavkin: remove it and use lang/isDart instead
|
|
||||||
export var IS_DARTIUM = false;
|
|
||||||
|
|
||||||
export class AsyncTestCompleter {
|
export class AsyncTestCompleter {
|
||||||
_done: Function;
|
_done: Function;
|
||||||
|
|
||||||
|
|
|
@ -1,15 +1,5 @@
|
||||||
///<reference path="../../src/change_detection/pipe_transform.ts"/>
|
///<reference path="../../src/change_detection/pipe_transform.ts"/>
|
||||||
import {
|
import {ddescribe, describe, it, iit, xit, expect, beforeEach, afterEach} from 'angular2/test_lib';
|
||||||
ddescribe,
|
|
||||||
describe,
|
|
||||||
it,
|
|
||||||
iit,
|
|
||||||
xit,
|
|
||||||
expect,
|
|
||||||
beforeEach,
|
|
||||||
afterEach,
|
|
||||||
IS_DARTIUM
|
|
||||||
} from 'angular2/test_lib';
|
|
||||||
|
|
||||||
import {
|
import {
|
||||||
CONST_EXPR,
|
CONST_EXPR,
|
||||||
|
@ -51,6 +41,7 @@ import {JitProtoChangeDetector} from 'angular2/src/change_detection/jit_proto_ch
|
||||||
|
|
||||||
import {getDefinition} from './change_detector_config';
|
import {getDefinition} from './change_detector_config';
|
||||||
import {getFactoryById} from './generated/change_detector_classes';
|
import {getFactoryById} from './generated/change_detector_classes';
|
||||||
|
import {IS_DART} from '../platform';
|
||||||
|
|
||||||
const _DEFAULT_CONTEXT = CONST_EXPR(new Object());
|
const _DEFAULT_CONTEXT = CONST_EXPR(new Object());
|
||||||
|
|
||||||
|
@ -68,8 +59,8 @@ const _DEFAULT_CONTEXT = CONST_EXPR(new Object());
|
||||||
*/
|
*/
|
||||||
export function main() {
|
export function main() {
|
||||||
ListWrapper.forEach(['dynamic', 'JIT', 'Pregen'], (cdType) => {
|
ListWrapper.forEach(['dynamic', 'JIT', 'Pregen'], (cdType) => {
|
||||||
if (cdType == "JIT" && IS_DARTIUM) return;
|
if (cdType == "JIT" && IS_DART) return;
|
||||||
if (cdType == "Pregen" && !IS_DARTIUM) return;
|
if (cdType == "Pregen" && !IS_DART) return;
|
||||||
|
|
||||||
describe(`${cdType} Change Detector`, () => {
|
describe(`${cdType} Change Detector`, () => {
|
||||||
|
|
||||||
|
@ -141,7 +132,7 @@ export function main() {
|
||||||
() => { expect(_bindSimpleValue('1 != 1')).toEqual(['propName=false']); });
|
() => { expect(_bindSimpleValue('1 != 1')).toEqual(['propName=false']); });
|
||||||
|
|
||||||
it('should support == operations on coerceible', () => {
|
it('should support == operations on coerceible', () => {
|
||||||
var expectedValue = IS_DARTIUM ? 'false' : 'true';
|
var expectedValue = IS_DART ? 'false' : 'true';
|
||||||
expect(_bindSimpleValue('1 == true')).toEqual([`propName=${expectedValue}`]);
|
expect(_bindSimpleValue('1 == true')).toEqual([`propName=${expectedValue}`]);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import {ddescribe, describe, it, xit, iit, expect, beforeEach, IS_DARTIUM} from 'angular2/test_lib';
|
import {ddescribe, describe, it, xit, iit, expect, beforeEach} from 'angular2/test_lib';
|
||||||
import {BaseException, isBlank, isPresent} from 'angular2/src/facade/lang';
|
import {BaseException, isBlank, isPresent} from 'angular2/src/facade/lang';
|
||||||
import {reflector} from 'angular2/src/reflection/reflection';
|
import {reflector} from 'angular2/src/reflection/reflection';
|
||||||
import {MapWrapper, ListWrapper} from 'angular2/src/facade/collection';
|
import {MapWrapper, ListWrapper} from 'angular2/src/facade/collection';
|
||||||
|
@ -7,6 +7,7 @@ import {Unparser} from './unparser';
|
||||||
import {Lexer} from 'angular2/src/change_detection/parser/lexer';
|
import {Lexer} from 'angular2/src/change_detection/parser/lexer';
|
||||||
import {Locals} from 'angular2/src/change_detection/parser/locals';
|
import {Locals} from 'angular2/src/change_detection/parser/locals';
|
||||||
import {BindingPipe, LiteralPrimitive, AST} from 'angular2/src/change_detection/parser/ast';
|
import {BindingPipe, LiteralPrimitive, AST} from 'angular2/src/change_detection/parser/ast';
|
||||||
|
import {IS_DART} from '../../platform';
|
||||||
|
|
||||||
class TestData {
|
class TestData {
|
||||||
constructor(public a?: any, public b?: any, public fnReturnValue?: any) {}
|
constructor(public a?: any, public b?: any, public fnReturnValue?: any) {}
|
||||||
|
@ -224,7 +225,7 @@ export function main() {
|
||||||
expect(() => { expectEval('null?.a.a', td()).toEqual(null); }).toThrowError();
|
expect(() => { expectEval('null?.a.a', td()).toEqual(null); }).toThrowError();
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!IS_DARTIUM) {
|
if (!IS_DART) {
|
||||||
it('should return null when accessing a field on undefined', () => {
|
it('should return null when accessing a field on undefined', () => {
|
||||||
expect(() => { expectEval('_undefined?.a', td()).toEqual(null); }).not.toThrow();
|
expect(() => { expectEval('_undefined?.a', td()).toEqual(null); }).not.toThrow();
|
||||||
});
|
});
|
||||||
|
|
|
@ -8,8 +8,7 @@ import {
|
||||||
inject,
|
inject,
|
||||||
it,
|
it,
|
||||||
xdescribe,
|
xdescribe,
|
||||||
xit,
|
xit
|
||||||
IS_DARTIUM
|
|
||||||
} from 'angular2/test_lib';
|
} from 'angular2/test_lib';
|
||||||
import {isPresent, stringify} from 'angular2/src/facade/lang';
|
import {isPresent, stringify} from 'angular2/src/facade/lang';
|
||||||
import {bootstrap, ApplicationRef} from 'angular2/src/core/application';
|
import {bootstrap, ApplicationRef} from 'angular2/src/core/application';
|
||||||
|
@ -21,6 +20,7 @@ import {LifeCycle} from 'angular2/core';
|
||||||
import {ExceptionHandler} from 'angular2/src/core/exception_handler';
|
import {ExceptionHandler} from 'angular2/src/core/exception_handler';
|
||||||
import {Testability, TestabilityRegistry} from 'angular2/src/core/testability/testability';
|
import {Testability, TestabilityRegistry} from 'angular2/src/core/testability/testability';
|
||||||
import {DOCUMENT} from 'angular2/src/render/render';
|
import {DOCUMENT} from 'angular2/src/render/render';
|
||||||
|
import {IS_DART} from '../platform';
|
||||||
|
|
||||||
@Component({selector: 'hello-app'})
|
@Component({selector: 'hello-app'})
|
||||||
@View({template: '{{greeting}} world!'})
|
@View({template: '{{greeting}} world!'})
|
||||||
|
@ -109,7 +109,7 @@ export function main() {
|
||||||
|
|
||||||
it('should throw if no element is found', inject([AsyncTestCompleter], (async) => {
|
it('should throw if no element is found', inject([AsyncTestCompleter], (async) => {
|
||||||
var logger = new _ArrayLogger();
|
var logger = new _ArrayLogger();
|
||||||
var exceptionHandler = new ExceptionHandler(logger, IS_DARTIUM ? false : true);
|
var exceptionHandler = new ExceptionHandler(logger, IS_DART ? false : true);
|
||||||
|
|
||||||
var refPromise =
|
var refPromise =
|
||||||
bootstrap(HelloRootCmp, [bind(ExceptionHandler).toValue(exceptionHandler)]);
|
bootstrap(HelloRootCmp, [bind(ExceptionHandler).toValue(exceptionHandler)]);
|
||||||
|
@ -124,7 +124,7 @@ export function main() {
|
||||||
it('should invoke the default exception handler when bootstrap fails',
|
it('should invoke the default exception handler when bootstrap fails',
|
||||||
inject([AsyncTestCompleter], (async) => {
|
inject([AsyncTestCompleter], (async) => {
|
||||||
var logger = new _ArrayLogger();
|
var logger = new _ArrayLogger();
|
||||||
var exceptionHandler = new ExceptionHandler(logger, IS_DARTIUM ? false : true);
|
var exceptionHandler = new ExceptionHandler(logger, IS_DART ? false : true);
|
||||||
|
|
||||||
var refPromise =
|
var refPromise =
|
||||||
bootstrap(HelloRootCmp, [bind(ExceptionHandler).toValue(exceptionHandler)]);
|
bootstrap(HelloRootCmp, [bind(ExceptionHandler).toValue(exceptionHandler)]);
|
||||||
|
|
|
@ -8,7 +8,6 @@ import {
|
||||||
expect,
|
expect,
|
||||||
iit,
|
iit,
|
||||||
inject,
|
inject,
|
||||||
IS_DARTIUM,
|
|
||||||
it,
|
it,
|
||||||
SpyObject,
|
SpyObject,
|
||||||
proxy
|
proxy
|
||||||
|
|
|
@ -8,7 +8,6 @@ import {
|
||||||
expect,
|
expect,
|
||||||
iit,
|
iit,
|
||||||
inject,
|
inject,
|
||||||
IS_DARTIUM,
|
|
||||||
it,
|
it,
|
||||||
SpyObject,
|
SpyObject,
|
||||||
proxy
|
proxy
|
||||||
|
|
|
@ -9,7 +9,6 @@ import {
|
||||||
expect,
|
expect,
|
||||||
iit,
|
iit,
|
||||||
inject,
|
inject,
|
||||||
IS_DARTIUM,
|
|
||||||
beforeEachBindings,
|
beforeEachBindings,
|
||||||
it,
|
it,
|
||||||
xit,
|
xit,
|
||||||
|
@ -78,6 +77,7 @@ import {ElementRef} from 'angular2/src/core/compiler/element_ref';
|
||||||
import {TemplateRef} from 'angular2/src/core/compiler/template_ref';
|
import {TemplateRef} from 'angular2/src/core/compiler/template_ref';
|
||||||
|
|
||||||
import {DomRenderer} from 'angular2/src/render/dom/dom_renderer';
|
import {DomRenderer} from 'angular2/src/render/dom/dom_renderer';
|
||||||
|
import {IS_DART} from '../../platform';
|
||||||
|
|
||||||
const ANCHOR_ELEMENT = CONST_EXPR(new OpaqueToken('AnchorElement'));
|
const ANCHOR_ELEMENT = CONST_EXPR(new OpaqueToken('AnchorElement'));
|
||||||
|
|
||||||
|
@ -1330,7 +1330,7 @@ export function main() {
|
||||||
})));
|
})));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!IS_DARTIUM) {
|
if (!IS_DART) {
|
||||||
it('should report a meaningful error when a directive is undefined',
|
it('should report a meaningful error when a directive is undefined',
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder,
|
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder,
|
||||||
async) => {
|
async) => {
|
||||||
|
@ -1431,7 +1431,7 @@ export function main() {
|
||||||
}));
|
}));
|
||||||
|
|
||||||
describe('Property bindings', () => {
|
describe('Property bindings', () => {
|
||||||
if (!IS_DARTIUM) {
|
if (!IS_DART) {
|
||||||
it('should throw on bindings to unknown properties',
|
it('should throw on bindings to unknown properties',
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder,
|
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder,
|
||||||
async) => {
|
async) => {
|
||||||
|
|
|
@ -9,7 +9,6 @@ import {
|
||||||
expect,
|
expect,
|
||||||
iit,
|
iit,
|
||||||
inject,
|
inject,
|
||||||
IS_DARTIUM,
|
|
||||||
beforeEachBindings,
|
beforeEachBindings,
|
||||||
it,
|
it,
|
||||||
xit,
|
xit,
|
||||||
|
|
|
@ -8,7 +8,6 @@ import {
|
||||||
expect,
|
expect,
|
||||||
iit,
|
iit,
|
||||||
inject,
|
inject,
|
||||||
IS_DARTIUM,
|
|
||||||
it,
|
it,
|
||||||
SpyObject,
|
SpyObject,
|
||||||
proxy
|
proxy
|
||||||
|
|
|
@ -9,8 +9,7 @@ import {
|
||||||
it,
|
it,
|
||||||
xdescribe,
|
xdescribe,
|
||||||
xit,
|
xit,
|
||||||
TestComponentBuilder,
|
TestComponentBuilder
|
||||||
IS_DARTIUM
|
|
||||||
} from 'angular2/test_lib';
|
} from 'angular2/test_lib';
|
||||||
|
|
||||||
import {Directive, Component, View, LifecycleEvent} from 'angular2/angular2';
|
import {Directive, Component, View, LifecycleEvent} from 'angular2/angular2';
|
||||||
|
|
|
@ -9,7 +9,6 @@ import {
|
||||||
it,
|
it,
|
||||||
xdescribe,
|
xdescribe,
|
||||||
xit,
|
xit,
|
||||||
IS_DARTIUM,
|
|
||||||
Log
|
Log
|
||||||
} from 'angular2/test_lib';
|
} from 'angular2/test_lib';
|
||||||
import {BaseException} from 'angular2/src/facade/lang';
|
import {BaseException} from 'angular2/src/facade/lang';
|
||||||
|
@ -91,4 +90,4 @@ export function main() {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,6 @@ import {
|
||||||
expect,
|
expect,
|
||||||
iit,
|
iit,
|
||||||
inject,
|
inject,
|
||||||
IS_DARTIUM,
|
|
||||||
beforeEachBindings,
|
beforeEachBindings,
|
||||||
it,
|
it,
|
||||||
xit,
|
xit,
|
||||||
|
|
|
@ -8,7 +8,6 @@ import {
|
||||||
expect,
|
expect,
|
||||||
iit,
|
iit,
|
||||||
inject,
|
inject,
|
||||||
IS_DARTIUM,
|
|
||||||
beforeEachBindings,
|
beforeEachBindings,
|
||||||
it,
|
it,
|
||||||
xit,
|
xit,
|
||||||
|
@ -17,17 +16,15 @@ import {
|
||||||
Scope,
|
Scope,
|
||||||
inspectNativeElement
|
inspectNativeElement
|
||||||
} from 'angular2/test_lib';
|
} from 'angular2/test_lib';
|
||||||
|
|
||||||
import {global} from 'angular2/src/facade/lang';
|
import {global} from 'angular2/src/facade/lang';
|
||||||
import {APP_VIEW_POOL_CAPACITY} from 'angular2/src/core/compiler/view_pool';
|
import {APP_VIEW_POOL_CAPACITY} from 'angular2/src/core/compiler/view_pool';
|
||||||
|
|
||||||
import {Injectable, bind} from 'angular2/di';
|
import {Injectable, bind} from 'angular2/di';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
Directive,
|
Directive,
|
||||||
Component,
|
Component,
|
||||||
View,
|
View,
|
||||||
} from 'angular2/annotations';
|
} from 'angular2/annotations';
|
||||||
|
import {IS_DART} from '../platform';
|
||||||
|
|
||||||
@Component({selector: 'my-comp'})
|
@Component({selector: 'my-comp'})
|
||||||
@View({directives: []})
|
@View({directives: []})
|
||||||
|
@ -65,7 +62,7 @@ export function main() {
|
||||||
|
|
||||||
}));
|
}));
|
||||||
|
|
||||||
if (!IS_DARTIUM) {
|
if (!IS_DART) {
|
||||||
it('should provide a global function to inspect elements',
|
it('should provide a global function to inspect elements',
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb, async) => {
|
inject([TestComponentBuilder, AsyncTestCompleter], (tcb, async) => {
|
||||||
tcb.overrideTemplate(MyComp, '')
|
tcb.overrideTemplate(MyComp, '')
|
||||||
|
|
|
@ -9,7 +9,6 @@ import {
|
||||||
expect,
|
expect,
|
||||||
iit,
|
iit,
|
||||||
inject,
|
inject,
|
||||||
IS_DARTIUM,
|
|
||||||
it,
|
it,
|
||||||
xit,
|
xit,
|
||||||
} from 'angular2/test_lib';
|
} from 'angular2/test_lib';
|
||||||
|
@ -19,6 +18,7 @@ import {DOM} from 'angular2/src/dom/dom_adapter';
|
||||||
import {Component, View} from 'angular2/angular2';
|
import {Component, View} from 'angular2/angular2';
|
||||||
|
|
||||||
import {NgIf} from 'angular2/src/directives/ng_if';
|
import {NgIf} from 'angular2/src/directives/ng_if';
|
||||||
|
import {IS_DART} from '../platform';
|
||||||
|
|
||||||
export function main() {
|
export function main() {
|
||||||
describe('ng-if directive', () => {
|
describe('ng-if directive', () => {
|
||||||
|
@ -146,7 +146,7 @@ export function main() {
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
|
||||||
if (!IS_DARTIUM) {
|
if (!IS_DART) {
|
||||||
it('should not add the element twice if the condition goes from true to true (JS)',
|
it('should not add the element twice if the condition goes from true to true (JS)',
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
||||||
var html = '<div><copy-me template="ng-if numberCondition">hello</copy-me></div>';
|
var html = '<div><copy-me template="ng-if numberCondition">hello</copy-me></div>';
|
||||||
|
@ -187,7 +187,7 @@ export function main() {
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IS_DARTIUM) {
|
if (IS_DART) {
|
||||||
it('should not create the element if the condition is not a boolean (DART)',
|
it('should not create the element if the condition is not a boolean (DART)',
|
||||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
||||||
var html = '<div><copy-me template="ng-if numberCondition">hello</copy-me></div>';
|
var html = '<div><copy-me template="ng-if numberCondition">hello</copy-me></div>';
|
||||||
|
|
|
@ -9,8 +9,7 @@ import {
|
||||||
el,
|
el,
|
||||||
SpyObject,
|
SpyObject,
|
||||||
AsyncTestCompleter,
|
AsyncTestCompleter,
|
||||||
inject,
|
inject
|
||||||
IS_DARTIUM
|
|
||||||
} from 'angular2/test_lib';
|
} from 'angular2/test_lib';
|
||||||
|
|
||||||
import {ObservableWrapper, EventEmitter, PromiseWrapper} from 'angular2/src/facade/async';
|
import {ObservableWrapper, EventEmitter, PromiseWrapper} from 'angular2/src/facade/async';
|
||||||
|
|
|
@ -10,8 +10,7 @@ import {
|
||||||
AsyncTestCompleter,
|
AsyncTestCompleter,
|
||||||
inject,
|
inject,
|
||||||
proxy,
|
proxy,
|
||||||
SpyObject,
|
SpyObject
|
||||||
IS_DARTIUM
|
|
||||||
} from 'angular2/test_lib';
|
} from 'angular2/test_lib';
|
||||||
import {Json, RegExp, NumberWrapper, StringWrapper} from 'angular2/src/facade/lang';
|
import {Json, RegExp, NumberWrapper, StringWrapper} from 'angular2/src/facade/lang';
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
library angular2.test.platform;
|
||||||
|
|
||||||
|
const IS_DART = true;
|
|
@ -0,0 +1 @@
|
||||||
|
export const IS_DART = false;
|
|
@ -1,8 +1,9 @@
|
||||||
import {describe, it, iit, ddescribe, expect, beforeEach, IS_DARTIUM} from 'angular2/test_lib';
|
import {describe, it, iit, ddescribe, expect, beforeEach} from 'angular2/test_lib';
|
||||||
import {Reflector, ReflectionInfo} from 'angular2/src/reflection/reflection';
|
import {Reflector, ReflectionInfo} from 'angular2/src/reflection/reflection';
|
||||||
import {ReflectionCapabilities} from 'angular2/src/reflection/reflection_capabilities';
|
import {ReflectionCapabilities} from 'angular2/src/reflection/reflection_capabilities';
|
||||||
import {ClassDecorator, ParamDecorator, classDecorator, paramDecorator} from './reflector_common';
|
import {ClassDecorator, ParamDecorator, classDecorator, paramDecorator} from './reflector_common';
|
||||||
import {List} from 'angular2/src/facade/collection';
|
import {List} from 'angular2/src/facade/collection';
|
||||||
|
import {IS_DART} from '../platform';
|
||||||
|
|
||||||
class AType {
|
class AType {
|
||||||
value;
|
value;
|
||||||
|
@ -132,7 +133,7 @@ export function main() {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
if (IS_DARTIUM) {
|
if (IS_DART) {
|
||||||
describe("interfaces", () => {
|
describe("interfaces", () => {
|
||||||
it("should return an array of interfaces for a type", () => {
|
it("should return an array of interfaces for a type", () => {
|
||||||
var p = reflector.interfaces(ClassImplementingInterface);
|
var p = reflector.interfaces(ClassImplementingInterface);
|
||||||
|
|
|
@ -7,7 +7,6 @@ import {
|
||||||
expect,
|
expect,
|
||||||
iit,
|
iit,
|
||||||
inject,
|
inject,
|
||||||
IS_DARTIUM,
|
|
||||||
it,
|
it,
|
||||||
} from 'angular2/test_lib';
|
} from 'angular2/test_lib';
|
||||||
|
|
||||||
|
|
|
@ -7,9 +7,9 @@ import {
|
||||||
iit,
|
iit,
|
||||||
inject,
|
inject,
|
||||||
it,
|
it,
|
||||||
xit,
|
xit
|
||||||
IS_DARTIUM
|
|
||||||
} from 'angular2/test_lib';
|
} from 'angular2/test_lib';
|
||||||
|
import {IS_DART} from '../../../platform';
|
||||||
|
|
||||||
import {DomElementSchemaRegistry} from 'angular2/src/render/dom/schema/dom_element_schema_registry';
|
import {DomElementSchemaRegistry} from 'angular2/src/render/dom/schema/dom_element_schema_registry';
|
||||||
import {DOM} from 'angular2/src/dom/dom_adapter';
|
import {DOM} from 'angular2/src/dom/dom_adapter';
|
||||||
|
@ -17,7 +17,7 @@ import {DOM} from 'angular2/src/dom/dom_adapter';
|
||||||
export function main() {
|
export function main() {
|
||||||
// DOMElementSchema can only be used on the JS side where we can safely
|
// DOMElementSchema can only be used on the JS side where we can safely
|
||||||
// use reflection for DOM elements
|
// use reflection for DOM elements
|
||||||
if (IS_DARTIUM) return;
|
if (IS_DART) return;
|
||||||
|
|
||||||
var registry;
|
var registry;
|
||||||
|
|
||||||
|
|
|
@ -7,8 +7,7 @@ import {
|
||||||
xdescribe,
|
xdescribe,
|
||||||
expect,
|
expect,
|
||||||
beforeEach,
|
beforeEach,
|
||||||
el,
|
el
|
||||||
IS_DARTIUM
|
|
||||||
} from 'angular2/test_lib';
|
} from 'angular2/test_lib';
|
||||||
|
|
||||||
import {DomElementSchemaRegistry} from 'angular2/src/render/dom/schema/dom_element_schema_registry';
|
import {DomElementSchemaRegistry} from 'angular2/src/render/dom/schema/dom_element_schema_registry';
|
||||||
|
@ -17,6 +16,7 @@ import {ProtoViewBuilder} from 'angular2/src/render/dom/view/proto_view_builder'
|
||||||
import {ASTWithSource, AST} from 'angular2/src/change_detection/change_detection';
|
import {ASTWithSource, AST} from 'angular2/src/change_detection/change_detection';
|
||||||
import {PropertyBindingType, ViewType, ViewEncapsulation} from 'angular2/src/render/api';
|
import {PropertyBindingType, ViewType, ViewEncapsulation} from 'angular2/src/render/api';
|
||||||
import {DOM} from 'angular2/src/dom/dom_adapter';
|
import {DOM} from 'angular2/src/dom/dom_adapter';
|
||||||
|
import {IS_DART} from '../../../platform';
|
||||||
|
|
||||||
export function main() {
|
export function main() {
|
||||||
function emptyExpr() { return new ASTWithSource(new AST(), 'empty', 'empty'); }
|
function emptyExpr() { return new ASTWithSource(new AST(), 'empty', 'empty'); }
|
||||||
|
@ -30,7 +30,7 @@ export function main() {
|
||||||
new ProtoViewBuilder(DOM.createTemplate(''), ViewType.EMBEDDED, ViewEncapsulation.NONE);
|
new ProtoViewBuilder(DOM.createTemplate(''), ViewType.EMBEDDED, ViewEncapsulation.NONE);
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!IS_DARTIUM) {
|
if (!IS_DART) {
|
||||||
describe('verification of properties', () => {
|
describe('verification of properties', () => {
|
||||||
|
|
||||||
it('should throw for unknown properties', () => {
|
it('should throw for unknown properties', () => {
|
||||||
|
|
|
@ -7,7 +7,6 @@ import {
|
||||||
expect,
|
expect,
|
||||||
iit,
|
iit,
|
||||||
inject,
|
inject,
|
||||||
IS_DARTIUM,
|
|
||||||
it,
|
it,
|
||||||
} from 'angular2/test_lib';
|
} from 'angular2/test_lib';
|
||||||
import {MockXHR} from 'angular2/src/render/xhr_mock';
|
import {MockXHR} from 'angular2/src/render/xhr_mock';
|
||||||
|
|
|
@ -7,8 +7,7 @@ import {
|
||||||
expect,
|
expect,
|
||||||
inject,
|
inject,
|
||||||
beforeEach,
|
beforeEach,
|
||||||
SpyObject,
|
SpyObject
|
||||||
IS_DARTIUM
|
|
||||||
} from 'angular2/test_lib';
|
} from 'angular2/test_lib';
|
||||||
|
|
||||||
import {Promise, PromiseWrapper} from 'angular2/src/facade/async';
|
import {Promise, PromiseWrapper} from 'angular2/src/facade/async';
|
||||||
|
@ -17,6 +16,7 @@ import {Type} from 'angular2/src/facade/lang';
|
||||||
import {RouteRegistry} from 'angular2/src/router/route_registry';
|
import {RouteRegistry} from 'angular2/src/router/route_registry';
|
||||||
import {RouteConfig, Route, AuxRoute, AsyncRoute} from 'angular2/src/router/route_config_decorator';
|
import {RouteConfig, Route, AuxRoute, AsyncRoute} from 'angular2/src/router/route_config_decorator';
|
||||||
import {stringifyInstruction} from 'angular2/src/router/instruction';
|
import {stringifyInstruction} from 'angular2/src/router/instruction';
|
||||||
|
import {IS_DART} from '../platform';
|
||||||
|
|
||||||
export function main() {
|
export function main() {
|
||||||
describe('RouteRegistry', () => {
|
describe('RouteRegistry', () => {
|
||||||
|
@ -195,7 +195,7 @@ export function main() {
|
||||||
.toThrowError('Component for route "/" is not defined, or is not a class.');
|
.toThrowError('Component for route "/" is not defined, or is not a class.');
|
||||||
|
|
||||||
// This would never happen in Dart
|
// This would never happen in Dart
|
||||||
if (!IS_DARTIUM) {
|
if (!IS_DART) {
|
||||||
expect(() => registry.config(RootHostCmp, new Route({path: '/', component:<Type>(<any>4)})))
|
expect(() => registry.config(RootHostCmp, new Route({path: '/', component:<Type>(<any>4)})))
|
||||||
.toThrowError('Component for route "/" is not defined, or is not a class.');
|
.toThrowError('Component for route "/" is not defined, or is not a class.');
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,6 @@ import {
|
||||||
expect,
|
expect,
|
||||||
iit,
|
iit,
|
||||||
inject,
|
inject,
|
||||||
IS_DARTIUM,
|
|
||||||
beforeEachBindings,
|
beforeEachBindings,
|
||||||
it,
|
it,
|
||||||
xit,
|
xit,
|
||||||
|
|
|
@ -8,7 +8,6 @@ import {
|
||||||
flushMicrotasks,
|
flushMicrotasks,
|
||||||
iit,
|
iit,
|
||||||
inject,
|
inject,
|
||||||
IS_DARTIUM,
|
|
||||||
it,
|
it,
|
||||||
Log,
|
Log,
|
||||||
tick,
|
tick,
|
||||||
|
|
|
@ -8,7 +8,6 @@ import {
|
||||||
expect,
|
expect,
|
||||||
iit,
|
iit,
|
||||||
inject,
|
inject,
|
||||||
IS_DARTIUM,
|
|
||||||
beforeEachBindings,
|
beforeEachBindings,
|
||||||
it,
|
it,
|
||||||
xit,
|
xit,
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import {ddescribe, describe, it, iit, expect, IS_DARTIUM} from 'angular2/test_lib';
|
import {ddescribe, describe, it, iit, expect} from 'angular2/test_lib';
|
||||||
import {IMPLEMENTS} from './fixtures/annotations';
|
import {IMPLEMENTS} from './fixtures/annotations';
|
||||||
|
|
||||||
class Interface1 {
|
class Interface1 {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import {describe, xdescribe, it, expect, IS_DARTIUM} from 'angular2/test_lib';
|
import {describe, xdescribe, it, expect} from 'angular2/test_lib';
|
||||||
|
|
||||||
class A {}
|
class A {}
|
||||||
class B {}
|
class B {}
|
||||||
|
|
Loading…
Reference in New Issue