refactor: remove lang.ts (#14837)

This commit is contained in:
Miško Hevery
2017-03-02 09:37:01 -08:00
committed by Chuck Jazdzewski
parent 84a65cf788
commit 8343fb7740
139 changed files with 406 additions and 676 deletions

View File

@ -11,8 +11,7 @@ import {ReflectiveInjector_} from '@angular/core/src/di/reflective_injector';
import {ResolvedReflectiveProvider_} from '@angular/core/src/di/reflective_provider';
import {getOriginalError} from '@angular/core/src/errors';
import {expect} from '@angular/platform-browser/testing/matchers';
import {isPresent, stringify} from '../../src/facade/lang';
import {stringify} from '../../src/util';
class Engine {}
@ -82,7 +81,7 @@ export function main() {
function createInjector(
providers: Provider[], parent: ReflectiveInjector = null): ReflectiveInjector_ {
const resolvedProviders = ReflectiveInjector.resolve(providers.concat(dynamicProviders));
if (isPresent(parent)) {
if (parent != null) {
return <ReflectiveInjector_>parent.createChildFromResolved(resolvedProviders);
} else {
return <ReflectiveInjector_>ReflectiveInjector.fromResolvedProviders(resolvedProviders);

View File

@ -1,63 +0,0 @@
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import {AsyncTestCompleter, describe, expect, inject, it} from '@angular/core/testing/testing_internal';
import {Observable} from 'rxjs/Observable';
export function main() {
describe('Observable', () => {
describe('#core', () => {
it('should call next with values',
inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
const o = new Observable((sink: any /** TODO #9100 */) => { sink.next(1); });
o.subscribe(v => {
expect(v).toEqual(1);
async.done();
});
}));
it('should call next and then complete',
inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
const o = new Observable((sink: any /** TODO #9100 */) => {
sink.next(1);
sink.complete();
});
let nexted = false;
o.subscribe(
v => { nexted = true; }, null,
() => {
expect(nexted).toBe(true);
async.done();
});
}));
it('should call error with errors',
inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
const o = new Observable((sink: any /** TODO #9100 */) => { sink.error('oh noes!'); });
o.subscribe(
v => {
},
(err) => {
expect(err).toEqual('oh noes!');
async.done();
});
}));
});
});
}

View File

@ -22,8 +22,7 @@ import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter';
import {DOCUMENT} from '@angular/platform-browser/src/dom/dom_tokens';
import {dispatchEvent, el} from '@angular/platform-browser/testing/browser_util';
import {expect} from '@angular/platform-browser/testing/matchers';
import {stringify} from '../../src/facade/lang';
import {stringify} from '../../src/util';
const ANCHOR_ELEMENT = new InjectionToken('AnchorElement');

View File

@ -11,9 +11,9 @@ import {Console} from '@angular/core/src/console';
import {ComponentFixture, TestBed, inject} from '@angular/core/testing';
import {expect} from '@angular/platform-browser/testing/matchers';
import {stringify} from '../../src/facade/lang';
import {NgModuleInjector} from '../../src/linker/ng_module_factory';
import {clearModulesForTest} from '../../src/linker/ng_module_factory_loader';
import {stringify} from '../../src/util';
class Engine {}

View File

@ -10,7 +10,7 @@ import {AfterContentChecked, AfterContentInit, AfterViewChecked, AfterViewInit,
import {ComponentFixture, TestBed, async} from '@angular/core/testing';
import {expect} from '@angular/platform-browser/testing/matchers';
import {stringify} from '../../src/facade/lang';
import {stringify} from '../../src/util';
export function main() {
describe('Query API', () => {

View File

@ -10,7 +10,6 @@ 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} from '../../src/facade/lang';
import {scheduleMicroTask} from '../../src/util';
const needsLongerTimers = browserDetection.isSlow || browserDetection.isEdge;
@ -159,7 +158,7 @@ export function main() {
promise.then((_) => {
expect(_traces.length).toBe(1);
if (isPresent(_traces[0])) {
if (_traces[0] != null) {
// some browsers don't have stack traces.
expect(_traces[0].indexOf('---')).toEqual(-1);
}