refactor: Remove isDart from public API
BREAKING CHANGE: - `IS_DARTIUM` no longer exported
This commit is contained in:
@ -1,15 +1,5 @@
|
||||
///<reference path="../../src/change_detection/pipe_transform.ts"/>
|
||||
import {
|
||||
ddescribe,
|
||||
describe,
|
||||
it,
|
||||
iit,
|
||||
xit,
|
||||
expect,
|
||||
beforeEach,
|
||||
afterEach,
|
||||
IS_DARTIUM
|
||||
} from 'angular2/test_lib';
|
||||
import {ddescribe, describe, it, iit, xit, expect, beforeEach, afterEach} from 'angular2/test_lib';
|
||||
|
||||
import {
|
||||
CONST_EXPR,
|
||||
@ -51,6 +41,7 @@ import {JitProtoChangeDetector} from 'angular2/src/change_detection/jit_proto_ch
|
||||
|
||||
import {getDefinition} from './change_detector_config';
|
||||
import {getFactoryById} from './generated/change_detector_classes';
|
||||
import {IS_DART} from '../platform';
|
||||
|
||||
const _DEFAULT_CONTEXT = CONST_EXPR(new Object());
|
||||
|
||||
@ -68,8 +59,8 @@ const _DEFAULT_CONTEXT = CONST_EXPR(new Object());
|
||||
*/
|
||||
export function main() {
|
||||
ListWrapper.forEach(['dynamic', 'JIT', 'Pregen'], (cdType) => {
|
||||
if (cdType == "JIT" && IS_DARTIUM) return;
|
||||
if (cdType == "Pregen" && !IS_DARTIUM) return;
|
||||
if (cdType == "JIT" && IS_DART) return;
|
||||
if (cdType == "Pregen" && !IS_DART) return;
|
||||
|
||||
describe(`${cdType} Change Detector`, () => {
|
||||
|
||||
@ -141,7 +132,7 @@ export function main() {
|
||||
() => { expect(_bindSimpleValue('1 != 1')).toEqual(['propName=false']); });
|
||||
|
||||
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}`]);
|
||||
});
|
||||
|
||||
|
@ -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 {reflector} from 'angular2/src/reflection/reflection';
|
||||
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 {Locals} from 'angular2/src/change_detection/parser/locals';
|
||||
import {BindingPipe, LiteralPrimitive, AST} from 'angular2/src/change_detection/parser/ast';
|
||||
import {IS_DART} from '../../platform';
|
||||
|
||||
class TestData {
|
||||
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();
|
||||
});
|
||||
|
||||
if (!IS_DARTIUM) {
|
||||
if (!IS_DART) {
|
||||
it('should return null when accessing a field on undefined', () => {
|
||||
expect(() => { expectEval('_undefined?.a', td()).toEqual(null); }).not.toThrow();
|
||||
});
|
||||
|
@ -8,8 +8,7 @@ import {
|
||||
inject,
|
||||
it,
|
||||
xdescribe,
|
||||
xit,
|
||||
IS_DARTIUM
|
||||
xit
|
||||
} from 'angular2/test_lib';
|
||||
import {isPresent, stringify} from 'angular2/src/facade/lang';
|
||||
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 {Testability, TestabilityRegistry} from 'angular2/src/core/testability/testability';
|
||||
import {DOCUMENT} from 'angular2/src/render/render';
|
||||
import {IS_DART} from '../platform';
|
||||
|
||||
@Component({selector: 'hello-app'})
|
||||
@View({template: '{{greeting}} world!'})
|
||||
@ -109,7 +109,7 @@ export function main() {
|
||||
|
||||
it('should throw if no element is found', inject([AsyncTestCompleter], (async) => {
|
||||
var logger = new _ArrayLogger();
|
||||
var exceptionHandler = new ExceptionHandler(logger, IS_DARTIUM ? false : true);
|
||||
var exceptionHandler = new ExceptionHandler(logger, IS_DART ? false : true);
|
||||
|
||||
var refPromise =
|
||||
bootstrap(HelloRootCmp, [bind(ExceptionHandler).toValue(exceptionHandler)]);
|
||||
@ -124,7 +124,7 @@ export function main() {
|
||||
it('should invoke the default exception handler when bootstrap fails',
|
||||
inject([AsyncTestCompleter], (async) => {
|
||||
var logger = new _ArrayLogger();
|
||||
var exceptionHandler = new ExceptionHandler(logger, IS_DARTIUM ? false : true);
|
||||
var exceptionHandler = new ExceptionHandler(logger, IS_DART ? false : true);
|
||||
|
||||
var refPromise =
|
||||
bootstrap(HelloRootCmp, [bind(ExceptionHandler).toValue(exceptionHandler)]);
|
||||
|
@ -8,7 +8,6 @@ import {
|
||||
expect,
|
||||
iit,
|
||||
inject,
|
||||
IS_DARTIUM,
|
||||
it,
|
||||
SpyObject,
|
||||
proxy
|
||||
|
@ -8,7 +8,6 @@ import {
|
||||
expect,
|
||||
iit,
|
||||
inject,
|
||||
IS_DARTIUM,
|
||||
it,
|
||||
SpyObject,
|
||||
proxy
|
||||
|
@ -9,7 +9,6 @@ import {
|
||||
expect,
|
||||
iit,
|
||||
inject,
|
||||
IS_DARTIUM,
|
||||
beforeEachBindings,
|
||||
it,
|
||||
xit,
|
||||
@ -78,6 +77,7 @@ import {ElementRef} from 'angular2/src/core/compiler/element_ref';
|
||||
import {TemplateRef} from 'angular2/src/core/compiler/template_ref';
|
||||
|
||||
import {DomRenderer} from 'angular2/src/render/dom/dom_renderer';
|
||||
import {IS_DART} from '../../platform';
|
||||
|
||||
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',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder,
|
||||
async) => {
|
||||
@ -1431,7 +1431,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
describe('Property bindings', () => {
|
||||
if (!IS_DARTIUM) {
|
||||
if (!IS_DART) {
|
||||
it('should throw on bindings to unknown properties',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder,
|
||||
async) => {
|
||||
|
@ -9,7 +9,6 @@ import {
|
||||
expect,
|
||||
iit,
|
||||
inject,
|
||||
IS_DARTIUM,
|
||||
beforeEachBindings,
|
||||
it,
|
||||
xit,
|
||||
|
@ -8,7 +8,6 @@ import {
|
||||
expect,
|
||||
iit,
|
||||
inject,
|
||||
IS_DARTIUM,
|
||||
it,
|
||||
SpyObject,
|
||||
proxy
|
||||
|
@ -9,8 +9,7 @@ import {
|
||||
it,
|
||||
xdescribe,
|
||||
xit,
|
||||
TestComponentBuilder,
|
||||
IS_DARTIUM
|
||||
TestComponentBuilder
|
||||
} from 'angular2/test_lib';
|
||||
|
||||
import {Directive, Component, View, LifecycleEvent} from 'angular2/angular2';
|
||||
|
@ -9,7 +9,6 @@ import {
|
||||
it,
|
||||
xdescribe,
|
||||
xit,
|
||||
IS_DARTIUM,
|
||||
Log
|
||||
} from 'angular2/test_lib';
|
||||
import {BaseException} from 'angular2/src/facade/lang';
|
||||
@ -91,4 +90,4 @@ export function main() {
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -8,7 +8,6 @@ import {
|
||||
expect,
|
||||
iit,
|
||||
inject,
|
||||
IS_DARTIUM,
|
||||
beforeEachBindings,
|
||||
it,
|
||||
xit,
|
||||
|
@ -8,7 +8,6 @@ import {
|
||||
expect,
|
||||
iit,
|
||||
inject,
|
||||
IS_DARTIUM,
|
||||
beforeEachBindings,
|
||||
it,
|
||||
xit,
|
||||
@ -17,17 +16,15 @@ import {
|
||||
Scope,
|
||||
inspectNativeElement
|
||||
} from 'angular2/test_lib';
|
||||
|
||||
import {global} from 'angular2/src/facade/lang';
|
||||
import {APP_VIEW_POOL_CAPACITY} from 'angular2/src/core/compiler/view_pool';
|
||||
|
||||
import {Injectable, bind} from 'angular2/di';
|
||||
|
||||
import {
|
||||
Directive,
|
||||
Component,
|
||||
View,
|
||||
} from 'angular2/annotations';
|
||||
import {IS_DART} from '../platform';
|
||||
|
||||
@Component({selector: 'my-comp'})
|
||||
@View({directives: []})
|
||||
@ -65,7 +62,7 @@ export function main() {
|
||||
|
||||
}));
|
||||
|
||||
if (!IS_DARTIUM) {
|
||||
if (!IS_DART) {
|
||||
it('should provide a global function to inspect elements',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb, async) => {
|
||||
tcb.overrideTemplate(MyComp, '')
|
||||
|
@ -9,7 +9,6 @@ import {
|
||||
expect,
|
||||
iit,
|
||||
inject,
|
||||
IS_DARTIUM,
|
||||
it,
|
||||
xit,
|
||||
} from 'angular2/test_lib';
|
||||
@ -19,6 +18,7 @@ import {DOM} from 'angular2/src/dom/dom_adapter';
|
||||
import {Component, View} from 'angular2/angular2';
|
||||
|
||||
import {NgIf} from 'angular2/src/directives/ng_if';
|
||||
import {IS_DART} from '../platform';
|
||||
|
||||
export function main() {
|
||||
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)',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
||||
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)',
|
||||
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
|
||||
var html = '<div><copy-me template="ng-if numberCondition">hello</copy-me></div>';
|
||||
|
@ -9,8 +9,7 @@ import {
|
||||
el,
|
||||
SpyObject,
|
||||
AsyncTestCompleter,
|
||||
inject,
|
||||
IS_DARTIUM
|
||||
inject
|
||||
} from 'angular2/test_lib';
|
||||
|
||||
import {ObservableWrapper, EventEmitter, PromiseWrapper} from 'angular2/src/facade/async';
|
||||
|
@ -10,8 +10,7 @@ import {
|
||||
AsyncTestCompleter,
|
||||
inject,
|
||||
proxy,
|
||||
SpyObject,
|
||||
IS_DARTIUM
|
||||
SpyObject
|
||||
} from 'angular2/test_lib';
|
||||
import {Json, RegExp, NumberWrapper, StringWrapper} from 'angular2/src/facade/lang';
|
||||
|
||||
|
3
modules/angular2/test/platform.dart
Normal file
3
modules/angular2/test/platform.dart
Normal file
@ -0,0 +1,3 @@
|
||||
library angular2.test.platform;
|
||||
|
||||
const IS_DART = true;
|
1
modules/angular2/test/platform.ts
Normal file
1
modules/angular2/test/platform.ts
Normal file
@ -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 {ReflectionCapabilities} from 'angular2/src/reflection/reflection_capabilities';
|
||||
import {ClassDecorator, ParamDecorator, classDecorator, paramDecorator} from './reflector_common';
|
||||
import {List} from 'angular2/src/facade/collection';
|
||||
import {IS_DART} from '../platform';
|
||||
|
||||
class AType {
|
||||
value;
|
||||
@ -132,7 +133,7 @@ export function main() {
|
||||
});
|
||||
});
|
||||
|
||||
if (IS_DARTIUM) {
|
||||
if (IS_DART) {
|
||||
describe("interfaces", () => {
|
||||
it("should return an array of interfaces for a type", () => {
|
||||
var p = reflector.interfaces(ClassImplementingInterface);
|
||||
|
@ -7,7 +7,6 @@ import {
|
||||
expect,
|
||||
iit,
|
||||
inject,
|
||||
IS_DARTIUM,
|
||||
it,
|
||||
} from 'angular2/test_lib';
|
||||
|
||||
|
@ -7,9 +7,9 @@ import {
|
||||
iit,
|
||||
inject,
|
||||
it,
|
||||
xit,
|
||||
IS_DARTIUM
|
||||
xit
|
||||
} from 'angular2/test_lib';
|
||||
import {IS_DART} from '../../../platform';
|
||||
|
||||
import {DomElementSchemaRegistry} from 'angular2/src/render/dom/schema/dom_element_schema_registry';
|
||||
import {DOM} from 'angular2/src/dom/dom_adapter';
|
||||
@ -17,7 +17,7 @@ import {DOM} from 'angular2/src/dom/dom_adapter';
|
||||
export function main() {
|
||||
// DOMElementSchema can only be used on the JS side where we can safely
|
||||
// use reflection for DOM elements
|
||||
if (IS_DARTIUM) return;
|
||||
if (IS_DART) return;
|
||||
|
||||
var registry;
|
||||
|
||||
|
@ -7,8 +7,7 @@ import {
|
||||
xdescribe,
|
||||
expect,
|
||||
beforeEach,
|
||||
el,
|
||||
IS_DARTIUM
|
||||
el
|
||||
} from 'angular2/test_lib';
|
||||
|
||||
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 {PropertyBindingType, ViewType, ViewEncapsulation} from 'angular2/src/render/api';
|
||||
import {DOM} from 'angular2/src/dom/dom_adapter';
|
||||
import {IS_DART} from '../../../platform';
|
||||
|
||||
export function main() {
|
||||
function emptyExpr() { return new ASTWithSource(new AST(), 'empty', 'empty'); }
|
||||
@ -30,7 +30,7 @@ export function main() {
|
||||
new ProtoViewBuilder(DOM.createTemplate(''), ViewType.EMBEDDED, ViewEncapsulation.NONE);
|
||||
});
|
||||
|
||||
if (!IS_DARTIUM) {
|
||||
if (!IS_DART) {
|
||||
describe('verification of properties', () => {
|
||||
|
||||
it('should throw for unknown properties', () => {
|
||||
|
@ -7,7 +7,6 @@ import {
|
||||
expect,
|
||||
iit,
|
||||
inject,
|
||||
IS_DARTIUM,
|
||||
it,
|
||||
} from 'angular2/test_lib';
|
||||
import {MockXHR} from 'angular2/src/render/xhr_mock';
|
||||
|
@ -7,8 +7,7 @@ import {
|
||||
expect,
|
||||
inject,
|
||||
beforeEach,
|
||||
SpyObject,
|
||||
IS_DARTIUM
|
||||
SpyObject
|
||||
} from 'angular2/test_lib';
|
||||
|
||||
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 {RouteConfig, Route, AuxRoute, AsyncRoute} from 'angular2/src/router/route_config_decorator';
|
||||
import {stringifyInstruction} from 'angular2/src/router/instruction';
|
||||
import {IS_DART} from '../platform';
|
||||
|
||||
export function main() {
|
||||
describe('RouteRegistry', () => {
|
||||
@ -195,7 +195,7 @@ export function main() {
|
||||
.toThrowError('Component for route "/" is not defined, or is not a class.');
|
||||
|
||||
// This would never happen in Dart
|
||||
if (!IS_DARTIUM) {
|
||||
if (!IS_DART) {
|
||||
expect(() => registry.config(RootHostCmp, new Route({path: '/', component:<Type>(<any>4)})))
|
||||
.toThrowError('Component for route "/" is not defined, or is not a class.');
|
||||
}
|
||||
|
@ -8,7 +8,6 @@ import {
|
||||
expect,
|
||||
iit,
|
||||
inject,
|
||||
IS_DARTIUM,
|
||||
beforeEachBindings,
|
||||
it,
|
||||
xit,
|
||||
|
@ -8,7 +8,6 @@ import {
|
||||
flushMicrotasks,
|
||||
iit,
|
||||
inject,
|
||||
IS_DARTIUM,
|
||||
it,
|
||||
Log,
|
||||
tick,
|
||||
|
@ -8,7 +8,6 @@ import {
|
||||
expect,
|
||||
iit,
|
||||
inject,
|
||||
IS_DARTIUM,
|
||||
beforeEachBindings,
|
||||
it,
|
||||
xit,
|
||||
|
Reference in New Issue
Block a user