repackaging: all the repackaging changes squashed

This commit is contained in:
Igor Minar
2016-04-28 17:50:03 -07:00
committed by Misko Hevery
parent 505da6c0a8
commit a66cdb469f
860 changed files with 7869 additions and 4985 deletions

View File

@ -1,4 +1,4 @@
import {PromiseCompleter} from 'angular2/src/facade/promise';
import {PromiseCompleter} from '../src/facade/promise';
/**
* Injectable completer that allows signaling completion of an asynchronous test. Used internally.

View File

@ -1,4 +1,4 @@
import {BaseException} from 'angular2/src/facade/exceptions';
import {BaseException} from '../index';
import {getTestInjector} from './test_injector';
let _FakeAsyncTestZoneSpecType = Zone['FakeAsyncTestZoneSpec'];

View File

@ -0,0 +1,20 @@
import {Injectable} from '../index';
@Injectable()
export class Log {
logItems: any[];
constructor() { this.logItems = []; }
add(value): void { this.logItems.push(value); }
fn(value) {
return (a1: any = null, a2: any = null, a3: any = null, a4: any = null, a5: any = null) => {
this.logItems.push(value);
}
}
clear(): void { this.logItems = []; }
result(): string { return this.logItems.join("; "); }
}

View File

@ -1,8 +1,12 @@
import {ApplicationRef} from 'angular2/src/core/application_ref';
import {Injectable, Injector} from 'angular2/src/core/di';
import {Type} from 'angular2/src/facade/lang';
import {ComponentRef, ComponentFactory} from 'angular2/src/core/linker/component_factory';
import {NgZone} from 'angular2/src/core/zone/ng_zone';
import {
ApplicationRef,
Injectable,
ComponentRef,
ComponentFactory,
Injector,
NgZone,
Type
} from '../index';
/**
* A no-op implementation of {@link ApplicationRef}, useful for testing.

View File

@ -1,6 +1,5 @@
import {Injectable} from 'angular2/src/core/di';
import {NgZone} from 'angular2/src/core/zone/ng_zone';
import {EventEmitter, ObservableWrapper} from 'angular2/src/facade/async';
import {Injectable, NgZone} from '../index';
import {EventEmitter, ObservableWrapper} from '../src/facade/async';
/**
* A mock implementation of {@link NgZone}.

View File

@ -0,0 +1,10 @@
import {RegExpWrapper, StringWrapper} from '../src/facade/lang';
var _RE_SPECIAL_CHARS =
['-', '[', ']', '/', '{', '}', '\\', '(', ')', '*', '+', '?', '.', '^', '$', '|'];
var _ESCAPE_RE = RegExpWrapper.create(`[\\${_RE_SPECIAL_CHARS.join('\\')}]`);
export function containsRegexp(input: string): RegExp {
return RegExpWrapper.create(
StringWrapper.replaceAllMapped(input, _ESCAPE_RE, (match) => `\\${match[0]}`));
}

View File

@ -1,7 +1,7 @@
import {ReflectiveInjector, Provider, PLATFORM_INITIALIZER} from 'angular2/core';
import {BaseException, ExceptionHandler} from 'angular2/src/facade/exceptions';
import {ListWrapper} from 'angular2/src/facade/collection';
import {FunctionWrapper, isPresent, Type} from 'angular2/src/facade/lang';
import {ReflectiveInjector, Provider, PLATFORM_INITIALIZER, Type} from '../index';
import {BaseException} from '../src/facade/exceptions';
import {ListWrapper} from '../src/facade/collection';
import {FunctionWrapper, isPresent} from '../src/facade/lang';
import {async} from './async';
import {AsyncTestCompleter} from './async_test_completer';

View File

@ -2,16 +2,24 @@
* Public Test Library for unit testing Angular2 Applications. Uses the
* Jasmine framework.
*/
import {global, isPromise} from 'angular2/src/facade/lang';
import {
inject,
async,
injectAsync,
TestInjector,
getTestInjector
} from './test_injector';
import {inject, async, injectAsync, TestInjector, getTestInjector} from './test_injector';
import {isPromise} from '../src/facade/lang';
export {inject, async, injectAsync} from './test_injector';
export {expect, NgMatchers} from './matchers';
declare var global;
var _global = <any>(typeof window === 'undefined' ? global : window);
export var expect: Function = _global.expect;
/**
* Run a function (with an optional asynchronous callback) after each test case.
*

View File

@ -1,16 +1,12 @@
import {StringMapWrapper} from 'angular2/src/facade/collection';
import {global, isPromise, Math} from 'angular2/src/facade/lang';
import {provide} from 'angular2/core';
import {AsyncTestCompleter} from './async_test_completer';
import {StringMapWrapper} from '../src/facade/collection';
import {global, isFunction, Math, isPromise} from '../src/facade/lang';
import {provide} from '../index';
import {getTestInjector, inject} from './test_injector';
import {browserDetection} from './utils';
import {AsyncTestCompleter} from './async_test_completer';
export {AsyncTestCompleter} from './async_test_completer';
export {expect} from './testing';
export {inject} from './test_injector';
export {expect, NgMatchers} from './matchers';
export {AsyncTestCompleter} from './async_test_completer';
export var proxy: ClassDecorator = (t) => t;
@ -28,8 +24,8 @@ var jsmXIt = _global.xit;
var runnerStack = [];
var inIt = false;
jasmine.DEFAULT_TIMEOUT_INTERVAL = 500;
var globalTimeOut = browserDetection.isSlow ? 3000 : jasmine.DEFAULT_TIMEOUT_INTERVAL;
jasmine.DEFAULT_TIMEOUT_INTERVAL = 3000;
var globalTimeOut = jasmine.DEFAULT_TIMEOUT_INTERVAL;
var testInjector = getTestInjector();
@ -113,6 +109,11 @@ export function beforeEachBindings(fn): void {
}
function _it(jsmFn: Function, name: string, testFn: Function, testTimeOut: number): void {
if (runnerStack.length == 0) {
// This left here intentionally, as we should never get here, and it aids debugging.
debugger;
throw new Error("Empty Stack!");
}
var runner = runnerStack[runnerStack.length - 1];
var timeOut = Math.max(globalTimeOut, testTimeOut);