refactor: remove global from facade/lang (#14837)

This commit is contained in:
Miško Hevery
2017-03-01 15:18:10 -08:00
committed by Chuck Jazdzewski
parent b0e0839075
commit 84a65cf788
26 changed files with 88 additions and 123 deletions

View File

@ -6,7 +6,7 @@
* found in the LICENSE file at https://angular.io/license
*/
import {getSymbolIterator} from '../../src/facade/lang';
import {getSymbolIterator} from '@angular/core/src/util';
export class TestIterable {
list: number[];

View File

@ -6,8 +6,8 @@
* found in the LICENSE file at https://angular.io/license
*/
import {global} from '@angular/common/src/facade/lang';
import {Compiler, SystemJsNgModuleLoader} from '@angular/core';
import {global} from '@angular/core/src/util';
import {async} from '@angular/core/testing';
import {afterEach, beforeEach, describe, expect, it} from '@angular/core/testing/testing_internal';
@ -24,14 +24,14 @@ export function main() {
describe('SystemJsNgModuleLoader', () => {
let oldSystem: any = null;
beforeEach(() => {
oldSystem = (global as any).System;
(global as any).System = mockSystem({
oldSystem = global['System'];
global['System'] = mockSystem({
'test.ngfactory':
{'default': 'test module factory', 'NamedNgFactory': 'test NamedNgFactory'},
'prefixed/test/suffixed': {'NamedNgFactory': 'test module factory'}
});
});
afterEach(() => { (global as any).System = oldSystem; });
afterEach(() => { global['System'] = oldSystem; });
it('loads a default factory by appending the factory suffix', async(() => {
const loader = new SystemJsNgModuleLoader(new Compiler());

View File

@ -12,7 +12,7 @@ import {Testability} from '@angular/core/src/testability/testability';
import {NgZone} from '@angular/core/src/zone/ng_zone';
import {AsyncTestCompleter, SpyObject, beforeEach, describe, expect, inject, it} from '@angular/core/testing/testing_internal';
import {scheduleMicroTask} from '../../src/facade/lang';
import {scheduleMicroTask} from '../../src/util';

View File

@ -8,15 +8,14 @@
import {Inject} from '@angular/core';
import {reflector} from '@angular/core/src/reflection/reflection';
import {global} from '@angular/core/src/util';
import {Class, makeDecorator, makePropDecorator} from '@angular/core/src/util/decorators';
import {global} from '../../src/facade/lang';
class DecoratedParent {}
class DecoratedChild extends DecoratedParent {}
export function main() {
const Reflect = global.Reflect;
const Reflect = global['Reflect'];
const TerminalDecorator = makeDecorator('TerminalDecorator', {terminal: true});
const TestDecorator = makeDecorator(
@ -161,4 +160,4 @@ export function main() {
});
});
});
}
}

View File

@ -10,7 +10,8 @@ import {NgZone} from '@angular/core/src/zone/ng_zone';
import {async, fakeAsync, flushMicrotasks} from '@angular/core/testing';
import {AsyncTestCompleter, Log, beforeEach, describe, expect, inject, it, xit} from '@angular/core/testing/testing_internal';
import {browserDetection} from '@angular/platform-browser/testing/browser_util';
import {isPresent, scheduleMicroTask} from '../../src/facade/lang';
import {isPresent} from '../../src/facade/lang';
import {scheduleMicroTask} from '../../src/util';
const needsLongerTimers = browserDetection.isSlow || browserDetection.isEdge;
const resultTimer = 1000;