style(lint): re-format modules/@angular
This commit is contained in:
@ -1,14 +1,15 @@
|
||||
import {AnimationDriver} from '../../src/animation/animation_driver';
|
||||
import {AnimationKeyframe} from '../../src/animation/animation_keyframe';
|
||||
import {AnimationPlayer} from '../../src/animation/animation_player';
|
||||
import {StringMapWrapper} from '../../src/facade/collection';
|
||||
import {AnimationStyles} from '../../src/animation/animation_styles';
|
||||
import {StringMapWrapper} from '../../src/facade/collection';
|
||||
import {MockAnimationPlayer} from '../../testing/animation/mock_animation_player';
|
||||
|
||||
export class MockAnimationDriver extends AnimationDriver {
|
||||
log: any[] /** TODO #9100 */ = [];
|
||||
animate(element: any, startingStyles: AnimationStyles, keyframes: AnimationKeyframe[], duration: number, delay: number,
|
||||
easing: string): AnimationPlayer {
|
||||
animate(
|
||||
element: any, startingStyles: AnimationStyles, keyframes: AnimationKeyframe[],
|
||||
duration: number, delay: number, easing: string): AnimationPlayer {
|
||||
var player = new MockAnimationPlayer();
|
||||
this.log.push({
|
||||
'element': element,
|
||||
@ -30,6 +31,10 @@ function _serializeKeyframes(keyframes: AnimationKeyframe[]): any[] {
|
||||
|
||||
function _serializeStyles(styles: AnimationStyles): {[key: string]: any} {
|
||||
var flatStyles = {};
|
||||
styles.styles.forEach(entry => StringMapWrapper.forEach(entry, (val: any /** TODO #9100 */, prop: any /** TODO #9100 */) => { (flatStyles as any /** TODO #9100 */)[prop] = val; }));
|
||||
styles.styles.forEach(
|
||||
entry => StringMapWrapper.forEach(
|
||||
entry, (val: any /** TODO #9100 */, prop: any /** TODO #9100 */) => {
|
||||
(flatStyles as any /** TODO #9100 */)[prop] = val;
|
||||
}));
|
||||
return flatStyles;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
import {isPresent} from '../../src/facade/lang';
|
||||
import {AnimationPlayer} from '../../src/animation/animation_player';
|
||||
import {isPresent} from '../../src/facade/lang';
|
||||
|
||||
export class MockAnimationPlayer implements AnimationPlayer {
|
||||
private _subscriptions: any[] /** TODO #9100 */ = [];
|
||||
|
@ -15,9 +15,9 @@
|
||||
*/
|
||||
export function async(fn: Function): Function {
|
||||
return () => new Promise<void>((finishCallback, failCallback) => {
|
||||
var AsyncTestZoneSpec = (Zone as any /** TODO #9100 */)['AsyncTestZoneSpec'];
|
||||
var testZoneSpec = new AsyncTestZoneSpec(finishCallback, failCallback, 'test');
|
||||
var testZone = Zone.current.fork(testZoneSpec);
|
||||
return testZone.run(fn);
|
||||
});
|
||||
var AsyncTestZoneSpec = (Zone as any /** TODO #9100 */)['AsyncTestZoneSpec'];
|
||||
var testZoneSpec = new AsyncTestZoneSpec(finishCallback, failCallback, 'test');
|
||||
var testZone = Zone.current.fork(testZoneSpec);
|
||||
return testZone.run(fn);
|
||||
});
|
||||
}
|
||||
|
@ -35,8 +35,9 @@ export function fakeAsync(fn: Function): Function {
|
||||
});
|
||||
|
||||
if (fakeAsyncTestZoneSpec.pendingPeriodicTimers.length > 0) {
|
||||
throw new BaseException(`${fakeAsyncTestZoneSpec.pendingPeriodicTimers.length} ` +
|
||||
`periodic timer(s) still in the queue.`);
|
||||
throw new BaseException(
|
||||
`${fakeAsyncTestZoneSpec.pendingPeriodicTimers.length} ` +
|
||||
`periodic timer(s) still in the queue.`);
|
||||
}
|
||||
|
||||
if (fakeAsyncTestZoneSpec.pendingTimers.length > 0) {
|
||||
|
@ -16,5 +16,5 @@ export class Log {
|
||||
|
||||
clear(): void { this.logItems = []; }
|
||||
|
||||
result(): string { return this.logItems.join("; "); }
|
||||
result(): string { return this.logItems.join('; '); }
|
||||
}
|
||||
|
@ -1,12 +1,5 @@
|
||||
import {
|
||||
ApplicationRef,
|
||||
Injectable,
|
||||
ComponentRef,
|
||||
ComponentFactory,
|
||||
Injector,
|
||||
NgZone,
|
||||
Type
|
||||
} from '../index';
|
||||
import {ApplicationRef, ComponentFactory, ComponentRef, Injectable, Injector, NgZone, Type} from '../index';
|
||||
|
||||
|
||||
/**
|
||||
* A no-op implementation of {@link ApplicationRef}, useful for testing.
|
||||
|
@ -4,6 +4,6 @@ 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: any /** TODO #9100 */) => `\\${match[0]}`));
|
||||
return RegExpWrapper.create(StringWrapper.replaceAllMapped(
|
||||
input, _ESCAPE_RE, (match: any /** TODO #9100 */) => `\\${match[0]}`));
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
import {ReflectiveInjector, Provider, PLATFORM_INITIALIZER, Type} from '../index';
|
||||
import {BaseException} from '../src/facade/exceptions';
|
||||
import {PLATFORM_INITIALIZER, Provider, ReflectiveInjector, Type} from '../index';
|
||||
import {ListWrapper} from '../src/facade/collection';
|
||||
import {BaseException} from '../src/facade/exceptions';
|
||||
import {FunctionWrapper, isPresent} from '../src/facade/lang';
|
||||
|
||||
import {async} from './async';
|
||||
@ -13,7 +13,7 @@ export class TestInjector {
|
||||
|
||||
private _injector: ReflectiveInjector = null;
|
||||
|
||||
private _providers: Array<Type | Provider | any[] | any> = [];
|
||||
private _providers: Array<Type|Provider|any[]|any> = [];
|
||||
|
||||
reset() {
|
||||
this._injector = null;
|
||||
@ -21,11 +21,11 @@ export class TestInjector {
|
||||
this._instantiated = false;
|
||||
}
|
||||
|
||||
platformProviders: Array<Type | Provider | any[] | any> = [];
|
||||
platformProviders: Array<Type|Provider|any[]|any> = [];
|
||||
|
||||
applicationProviders: Array<Type | Provider | any[] | any> = [];
|
||||
applicationProviders: Array<Type|Provider|any[]|any> = [];
|
||||
|
||||
addProviders(providers: Array<Type | Provider | any[] | any>) {
|
||||
addProviders(providers: Array<Type|Provider|any[]|any>) {
|
||||
if (this._instantiated) {
|
||||
throw new BaseException('Cannot add providers after test injector is instantiated');
|
||||
}
|
||||
@ -76,8 +76,9 @@ export function getTestInjector() {
|
||||
* Test Providers for individual platforms are available from
|
||||
* 'angular2/platform/testing/<platform_name>'.
|
||||
*/
|
||||
export function setBaseTestProviders(platformProviders: Array<Type | Provider | any[]>,
|
||||
applicationProviders: Array<Type | Provider | any[]>) {
|
||||
export function setBaseTestProviders(
|
||||
platformProviders: Array<Type|Provider|any[]>,
|
||||
applicationProviders: Array<Type|Provider|any[]>) {
|
||||
var testInjector = getTestInjector();
|
||||
if (testInjector.platformProviders.length > 0 || testInjector.applicationProviders.length > 0) {
|
||||
throw new BaseException('Cannot set base providers because it has already been called');
|
||||
|
@ -2,11 +2,11 @@
|
||||
* Public Test Library for unit testing Angular2 Applications. Uses the
|
||||
* Jasmine framework.
|
||||
*/
|
||||
import {inject, async, injectAsync, TestInjector, getTestInjector} from './test_injector';
|
||||
|
||||
import {isPromise} from '../src/facade/lang';
|
||||
|
||||
export {inject, async, injectAsync} from './test_injector';
|
||||
import {TestInjector, async, getTestInjector, inject, injectAsync} from './test_injector';
|
||||
|
||||
export {async, inject, injectAsync} from './test_injector';
|
||||
|
||||
declare var global: any /** TODO #9100 */;
|
||||
|
||||
@ -93,9 +93,10 @@ export function beforeEachProviders(fn: () => Array<any>): void {
|
||||
try {
|
||||
testInjector.addProviders(providers);
|
||||
} catch (e) {
|
||||
throw new Error('beforeEachProviders was called after the injector had ' +
|
||||
'been used in a beforeEach or it block. This invalidates the ' +
|
||||
'test injector');
|
||||
throw new Error(
|
||||
'beforeEachProviders was called after the injector had ' +
|
||||
'been used in a beforeEach or it block. This invalidates the ' +
|
||||
'test injector');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -1,15 +1,15 @@
|
||||
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 {StringMapWrapper} from '../src/facade/collection';
|
||||
import {Math, global, isFunction, isPromise} from '../src/facade/lang';
|
||||
|
||||
import {AsyncTestCompleter} from './async_test_completer';
|
||||
import {getTestInjector, inject} from './test_injector';
|
||||
|
||||
export {expect} from './testing';
|
||||
export {inject} from './test_injector';
|
||||
export {AsyncTestCompleter} from './async_test_completer';
|
||||
|
||||
export {MockAnimationPlayer} from './animation/mock_animation_player';
|
||||
export {MockAnimationDriver} from './animation/mock_animation_driver';
|
||||
export {MockAnimationPlayer} from './animation/mock_animation_player';
|
||||
export {AsyncTestCompleter} from './async_test_completer';
|
||||
export {inject} from './test_injector';
|
||||
export {expect} from './testing';
|
||||
|
||||
export var proxy: ClassDecorator = (t: any /** TODO #9100 */) => t;
|
||||
|
||||
@ -115,7 +115,7 @@ function _it(jsmFn: Function, name: string, testFn: Function, testTimeOut: numbe
|
||||
if (runnerStack.length == 0) {
|
||||
// This left here intentionally, as we should never get here, and it aids debugging.
|
||||
debugger;
|
||||
throw new Error("Empty Stack!");
|
||||
throw new Error('Empty Stack!');
|
||||
}
|
||||
var runner = runnerStack[runnerStack.length - 1];
|
||||
var timeOut = Math.max(globalTimeOut, testTimeOut);
|
||||
@ -150,15 +150,21 @@ function _it(jsmFn: Function, name: string, testFn: Function, testTimeOut: numbe
|
||||
}, timeOut);
|
||||
}
|
||||
|
||||
export function it(name: any /** TODO #9100 */, fn: any /** TODO #9100 */, timeOut: any /** TODO #9100 */ = null): void {
|
||||
export function it(
|
||||
name: any /** TODO #9100 */, fn: any /** TODO #9100 */,
|
||||
timeOut: any /** TODO #9100 */ = null): void {
|
||||
return _it(jsmIt, name, fn, timeOut);
|
||||
}
|
||||
|
||||
export function xit(name: any /** TODO #9100 */, fn: any /** TODO #9100 */, timeOut: any /** TODO #9100 */ = null): void {
|
||||
export function xit(
|
||||
name: any /** TODO #9100 */, fn: any /** TODO #9100 */,
|
||||
timeOut: any /** TODO #9100 */ = null): void {
|
||||
return _it(jsmXIt, name, fn, timeOut);
|
||||
}
|
||||
|
||||
export function iit(name: any /** TODO #9100 */, fn: any /** TODO #9100 */, timeOut: any /** TODO #9100 */ = null): void {
|
||||
export function iit(
|
||||
name: any /** TODO #9100 */, fn: any /** TODO #9100 */,
|
||||
timeOut: any /** TODO #9100 */ = null): void {
|
||||
return _it(jsmIIt, name, fn, timeOut);
|
||||
}
|
||||
|
||||
@ -202,9 +208,13 @@ export class SpyObject {
|
||||
return (this as any /** TODO #9100 */)[name];
|
||||
}
|
||||
|
||||
prop(name: any /** TODO #9100 */, value: any /** TODO #9100 */) { (this as any /** TODO #9100 */)[name] = value; }
|
||||
prop(name: any /** TODO #9100 */, value: any /** TODO #9100 */) {
|
||||
(this as any /** TODO #9100 */)[name] = value;
|
||||
}
|
||||
|
||||
static stub(object: any /** TODO #9100 */ = null, config: any /** TODO #9100 */ = null, overrides: any /** TODO #9100 */ = null) {
|
||||
static stub(
|
||||
object: any /** TODO #9100 */ = null, config: any /** TODO #9100 */ = null,
|
||||
overrides: any /** TODO #9100 */ = null) {
|
||||
if (!(object instanceof SpyObject)) {
|
||||
overrides = config;
|
||||
config = object;
|
||||
@ -212,7 +222,9 @@ export class SpyObject {
|
||||
}
|
||||
|
||||
var m = StringMapWrapper.merge(config, overrides);
|
||||
StringMapWrapper.forEach(m, (value: any /** TODO #9100 */, key: any /** TODO #9100 */) => { object.spy(key).andReturn(value); });
|
||||
StringMapWrapper.forEach(m, (value: any /** TODO #9100 */, key: any /** TODO #9100 */) => {
|
||||
object.spy(key).andReturn(value);
|
||||
});
|
||||
return object;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user