refactor: IS_DART === false
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
import {ObservableWrapper, PromiseCompleter, PromiseWrapper} from '../src/facade/async';
|
||||
import {ListWrapper} from '../src/facade/collection';
|
||||
import {BaseException, ExceptionHandler, unimplemented} from '../src/facade/exceptions';
|
||||
import {ConcreteType, IS_DART, Type, isBlank, isPresent, isPromise} from '../src/facade/lang';
|
||||
import {ConcreteType, Type, isBlank, isPresent, isPromise} from '../src/facade/lang';
|
||||
|
||||
import {APP_INITIALIZER, PLATFORM_INITIALIZER} from './application_tokens';
|
||||
import {ChangeDetectorRef} from './change_detection/change_detector_ref';
|
||||
@@ -507,9 +507,8 @@ export class ApplicationRef_ extends ApplicationRef {
|
||||
|
||||
this._loadComponent(compRef);
|
||||
if (isDevMode()) {
|
||||
let prodDescription = IS_DART ? 'Production mode is disabled in Dart.' :
|
||||
'Call enableProdMode() to enable the production mode.';
|
||||
this._console.log(`Angular 2 is running in the development mode. ${prodDescription}`);
|
||||
this._console.log(
|
||||
`Angular 2 is running in the development mode. Call enableProdMode() to enable the production mode.`);
|
||||
}
|
||||
return compRef;
|
||||
});
|
||||
|
||||
@@ -10,8 +10,6 @@
|
||||
import {Injector} from '@angular/core';
|
||||
import {beforeEach, ddescribe, describe, expect, iit, it} from '@angular/core/testing/testing_internal';
|
||||
|
||||
import {IS_DART} from '../../src/facade/lang';
|
||||
|
||||
export function main() {
|
||||
describe('Injector.NULL', () => {
|
||||
it('should throw if no arg is given', () => {
|
||||
|
||||
@@ -21,7 +21,7 @@ import {DomRootRenderer} from '@angular/platform-browser/src/dom/dom_renderer';
|
||||
import {EventEmitter} from '../../src/facade/async';
|
||||
import {StringMapWrapper} from '../../src/facade/collection';
|
||||
import {BaseException} from '../../src/facade/exceptions';
|
||||
import {ConcreteType, IS_DART, NumberWrapper, Type, isBlank} from '../../src/facade/lang';
|
||||
import {ConcreteType, NumberWrapper, Type, isBlank} from '../../src/facade/lang';
|
||||
|
||||
export function main() {
|
||||
let tcb: TestComponentBuilder;
|
||||
@@ -133,8 +133,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
it('should support == operations on coerceible', fakeAsync(() => {
|
||||
var expectedValue = IS_DART ? 'false' : 'true';
|
||||
expect(_bindAndCheckSimpleValue('1 == true')).toEqual([`someProp=${expectedValue}`]);
|
||||
expect(_bindAndCheckSimpleValue('1 == true')).toEqual([`someProp=true`]);
|
||||
}));
|
||||
|
||||
it('should support === operations on identical', fakeAsync(() => {
|
||||
|
||||
@@ -16,7 +16,7 @@ import {AsyncTestCompleter, beforeEach, beforeEachProviders, ddescribe, describe
|
||||
import {expect} from '@angular/platform-browser/testing/matchers';
|
||||
|
||||
import {BaseException} from '../../src/facade/exceptions';
|
||||
import {ConcreteType, IS_DART, Type, stringify} from '../../src/facade/lang';
|
||||
import {ConcreteType, Type, stringify} from '../../src/facade/lang';
|
||||
|
||||
class Engine {}
|
||||
|
||||
@@ -105,13 +105,9 @@ class DummyConsole implements Console {
|
||||
}
|
||||
|
||||
export function main() {
|
||||
if (IS_DART) {
|
||||
declareTests({useJit: false});
|
||||
} else {
|
||||
describe('jit', () => { declareTests({useJit: true}); });
|
||||
describe('jit', () => { declareTests({useJit: true}); });
|
||||
|
||||
describe('no jit', () => { declareTests({useJit: false}); });
|
||||
}
|
||||
describe('no jit', () => { declareTests({useJit: false}); });
|
||||
}
|
||||
|
||||
function declareTests({useJit}: {useJit: boolean}) {
|
||||
|
||||
@@ -11,7 +11,6 @@ import {OnInit} from '@angular/core';
|
||||
import {Reflector, ReflectionInfo} from '@angular/core/src/reflection/reflection';
|
||||
import {ReflectionCapabilities} from '@angular/core/src/reflection/reflection_capabilities';
|
||||
import {ClassDecorator, ParamDecorator, PropDecorator, classDecorator, paramDecorator, propDecorator, HasGetterAndSetterDecorators} from './reflector_common';
|
||||
import {IS_DART} from '../../src/facade/lang';
|
||||
import {browserDetection} from '@angular/platform-browser/testing/browser_util';
|
||||
|
||||
class AType {
|
||||
@@ -188,13 +187,6 @@ export function main() {
|
||||
reflector.registerType(TestObj, new ReflectionInfo(null, null, null, null, {'a': [1, 2]}));
|
||||
expect(reflector.propMetadata(TestObj)).toEqual({'a': [1, 2]});
|
||||
});
|
||||
|
||||
if (IS_DART) {
|
||||
it('should merge metadata from getters and setters', () => {
|
||||
var p = reflector.propMetadata(HasGetterAndSetterDecorators);
|
||||
expect(p['a']).toEqual([propDecorator('get'), propDecorator('set')]);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
describe('annotations', () => {
|
||||
@@ -214,28 +206,6 @@ export function main() {
|
||||
});
|
||||
});
|
||||
|
||||
if (IS_DART) {
|
||||
describe('interfaces', () => {
|
||||
it('should return an array of interfaces for a type', () => {
|
||||
var p = reflector.interfaces(ClassImplementingInterface);
|
||||
expect(p).toEqual([Interface, Interface2]);
|
||||
});
|
||||
|
||||
it('should return an empty array otherwise', () => {
|
||||
var p = reflector.interfaces(ClassWithDecorators);
|
||||
expect(p).toEqual([]);
|
||||
});
|
||||
|
||||
it('should throw for undeclared lifecycle interfaces',
|
||||
() => { expect(() => reflector.interfaces(ClassDoesNotDeclareOnInit)).toThrowError(); });
|
||||
|
||||
it('should throw for class inheriting a lifecycle impl and not declaring the interface',
|
||||
() => {
|
||||
expect(() => reflector.interfaces(SubClassDoesNotDeclareOnInit)).toThrowError();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
describe('getter', () => {
|
||||
it('returns a function reading a property', () => {
|
||||
var getA = reflector.getter('a');
|
||||
@@ -280,16 +250,6 @@ export function main() {
|
||||
expect(reflector.method('abc')('anything', ['fake'])).toEqual(['fake']);
|
||||
});
|
||||
});
|
||||
|
||||
if (IS_DART) {
|
||||
describe('importUri', () => {
|
||||
it('should return the importUri for a type', () => {
|
||||
expect(reflector.importUri(TestObjWith00Args)
|
||||
.endsWith('test/core/reflection/reflector_spec.dart'))
|
||||
.toBe(true);
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
import {AnimationEntryMetadata, Compiler, ComponentFactory, Injectable, Injector, NgZone, OpaqueToken, ViewMetadata} from '../index';
|
||||
import {PromiseWrapper} from '../src/facade/async';
|
||||
import {ConcreteType, IS_DART, Type, isPresent} from '../src/facade/lang';
|
||||
import {ConcreteType, Type, isPresent} from '../src/facade/lang';
|
||||
|
||||
import {ComponentFixture} from './component_fixture';
|
||||
import {tick} from './fake_async';
|
||||
@@ -103,7 +103,7 @@ export class TestComponentBuilder {
|
||||
* Builds and returns a ComponentFixture.
|
||||
*/
|
||||
createAsync<T>(rootComponentType: ConcreteType<T>): Promise<ComponentFixture<T>> {
|
||||
let noNgZone = IS_DART || this._injector.get(ComponentFixtureNoNgZone, false);
|
||||
let noNgZone = this._injector.get(ComponentFixtureNoNgZone, false);
|
||||
let ngZone: NgZone = noNgZone ? null : this._injector.get(NgZone, null);
|
||||
let compiler: Compiler = this._injector.get(Compiler);
|
||||
|
||||
@@ -130,7 +130,7 @@ export class TestComponentBuilder {
|
||||
}
|
||||
|
||||
createSync<T>(rootComponentType: ConcreteType<T>): ComponentFixture<T> {
|
||||
let noNgZone = IS_DART || this._injector.get(ComponentFixtureNoNgZone, false);
|
||||
let noNgZone = this._injector.get(ComponentFixtureNoNgZone, false);
|
||||
let ngZone: NgZone = noNgZone ? null : this._injector.get(NgZone, null);
|
||||
let compiler: Compiler = this._injector.get(Compiler);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user