chore(format): update to latest formatter

Closes #7958
This commit is contained in:
Alex Eagle
2016-04-07 17:17:50 -07:00
committed by Alex Eagle
parent 83b8f59297
commit 03627aa84d
527 changed files with 13975 additions and 19252 deletions
@@ -1,18 +1,4 @@
import {
AsyncTestCompleter,
beforeEach,
ddescribe,
describe,
expect,
fakeAsync,
flushMicrotasks,
iit,
inject,
it,
Log,
tick,
xit
} from 'angular2/testing_internal';
import {AsyncTestCompleter, beforeEach, ddescribe, describe, expect, fakeAsync, flushMicrotasks, iit, inject, it, Log, tick, xit} from 'angular2/testing_internal';
import {TimerWrapper, PromiseWrapper} from 'angular2/src/facade/async';
import {BaseException} from 'angular2/src/facade/exceptions';
import {Parser} from 'angular2/src/core/change_detection/change_detection';
@@ -37,8 +23,9 @@ export function main() {
inject([Parser], fakeAsync((parser) => { expect(parser).toBeAnInstanceOf(Parser); })));
it('should throw on nested calls', () => {
expect(() => { fakeAsync(() => { fakeAsync(() => null)(); })(); })
.toThrowError('fakeAsync() calls can not be nested');
expect(() => {
fakeAsync(() => { fakeAsync(() => null)(); })();
}).toThrowError('fakeAsync() calls can not be nested');
});
it('should flush microtasks before returning', () => {
@@ -100,8 +87,9 @@ export function main() {
});
it('should complain if a test throws an exception', () => {
expect(() => { fakeAsync(() => { throw new BaseException('sync'); })(); })
.toThrowError('sync');
expect(() => {
fakeAsync(() => { throw new BaseException('sync'); })();
}).toThrowError('sync');
});
});
@@ -153,13 +141,15 @@ export function main() {
}));
it('should throw an error on dangling timers', () => {
expect(() => { fakeAsync(() => { TimerWrapper.setTimeout(() => {}, 10); })(); })
.toThrowError('1 timer(s) still in the queue.');
expect(() => {
fakeAsync(() => { TimerWrapper.setTimeout(() => {}, 10); })();
}).toThrowError('1 timer(s) still in the queue.');
});
it('should throw an error on dangling periodic timers', () => {
expect(() => { fakeAsync(() => { TimerWrapper.setInterval(() => {}, 10); })(); })
.toThrowError('1 periodic timer(s) still in the queue.');
expect(() => {
fakeAsync(() => { TimerWrapper.setInterval(() => {}, 10); })();
}).toThrowError('1 periodic timer(s) still in the queue.');
});
it('should run periodic timers', fakeAsync(() => {
@@ -250,13 +240,15 @@ export function main() {
describe('outside of the fakeAsync zone', () => {
it('calling flushMicrotasks should throw', () => {
expect(() => { flushMicrotasks(); })
.toThrowError('The code should be running in the fakeAsync zone to call this function');
expect(() => {
flushMicrotasks();
}).toThrowError('The code should be running in the fakeAsync zone to call this function');
});
it('calling tick should throw', () => {
expect(() => { tick(); })
.toThrowError('The code should be running in the fakeAsync zone to call this function');
expect(() => {
tick();
}).toThrowError('The code should be running in the fakeAsync zone to call this function');
});
});
@@ -1,18 +1,4 @@
import {
AsyncTestCompleter,
beforeEach,
ddescribe,
xdescribe,
describe,
dispatchEvent,
expect,
iit,
inject,
beforeEachProviders,
it,
xit,
TestComponentBuilder
} from 'angular2/testing_internal';
import {AsyncTestCompleter, beforeEach, ddescribe, xdescribe, describe, dispatchEvent, expect, iit, inject, beforeEachProviders, it, xit, TestComponentBuilder} from 'angular2/testing_internal';
import {Injectable, provide} from 'angular2/core';
import {NgIf} from 'angular2/common';
@@ -144,8 +130,8 @@ export function main() {
it('should override a view',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
tcb.overrideView(ChildComp,
new ViewMetadata({template: '<span>Modified {{childBinding}}</span>'}))
tcb.overrideView(
ChildComp, new ViewMetadata({template: '<span>Modified {{childBinding}}</span>'}))
.createAsync(ChildComp)
.then((componentFixture) => {
componentFixture.detectChanges();
@@ -169,7 +155,7 @@ export function main() {
}));
it("should override child component's dependencies",
it('should override child component\'s dependencies',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
tcb.overrideDirective(ParentComp, ChildComp, ChildWithChildComp)
@@ -187,8 +173,8 @@ export function main() {
it('should override a provider',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
tcb.overrideProviders(TestBindingsComp,
[provide(FancyService, {useClass: MockFancyService})])
tcb.overrideProviders(
TestBindingsComp, [provide(FancyService, {useClass: MockFancyService})])
.createAsync(TestBindingsComp)
.then((componentFixture) => {
componentFixture.detectChanges();
@@ -202,8 +188,8 @@ export function main() {
it('should override a viewBinding',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
tcb.overrideViewProviders(TestViewBindingsComp,
[provide(FancyService, {useClass: MockFancyService})])
tcb.overrideViewProviders(
TestViewBindingsComp, [provide(FancyService, {useClass: MockFancyService})])
.createAsync(TestViewBindingsComp)
.then((componentFixture) => {
componentFixture.detectChanges();
@@ -1,15 +1,4 @@
import {
describe,
it,
iit,
ddescribe,
expect,
tick,
SpyObject,
beforeEach,
proxy,
containsRegexp
} from 'angular2/testing_internal';
import {describe, it, iit, ddescribe, expect, tick, SpyObject, beforeEach, proxy, containsRegexp} from 'angular2/testing_internal';
import {DOM} from 'angular2/src/platform/dom/dom_adapter';
import {MapWrapper} from 'angular2/src/facade/collection';
@@ -40,25 +29,25 @@ export function main() {
});
});
describe("toHaveCssClass", () => {
it("should assert that the CSS class is present", () => {
describe('toHaveCssClass', () => {
it('should assert that the CSS class is present', () => {
var el = DOM.createElement('div');
DOM.addClass(el, 'matias');
expect(el).toHaveCssClass('matias');
});
it("should assert that the CSS class is not present", () => {
it('should assert that the CSS class is not present', () => {
var el = DOM.createElement('div');
DOM.addClass(el, 'matias');
expect(el).not.toHaveCssClass('fatias');
});
});
describe("toMatchPAttern", () => {
it("should assert that a string matches a given pattern", () => {
expect("matias").toMatchPattern(/ias$/g);
expect("tobias").toMatchPattern(/ias$/g);
expect("joonas").not.toMatchPattern(/ias$/g);
describe('toMatchPAttern', () => {
it('should assert that a string matches a given pattern', () => {
expect('matias').toMatchPattern(/ias$/g);
expect('tobias').toMatchPattern(/ias$/g);
expect('joonas').not.toMatchPattern(/ias$/g);
});
});
@@ -69,60 +58,64 @@ export function main() {
});
it('should detect equality for same content', () => {
expect(MapWrapper.createFromStringMap({'a': 1}))
.toEqual(MapWrapper.createFromStringMap({'a': 1}));
expect(MapWrapper.createFromStringMap({'a': 1})).toEqual(MapWrapper.createFromStringMap({
'a': 1
}));
});
it('should detect missing entries', () => {
expect(MapWrapper.createFromStringMap({'a': 1}))
.not.toEqual(MapWrapper.createFromStringMap({}));
expect(MapWrapper.createFromStringMap({
'a': 1
})).not.toEqual(MapWrapper.createFromStringMap({}));
});
it('should detect different values', () => {
expect(MapWrapper.createFromStringMap({'a': 1}))
.not.toEqual(MapWrapper.createFromStringMap({'a': 2}));
expect(MapWrapper.createFromStringMap({
'a': 1
})).not.toEqual(MapWrapper.createFromStringMap({'a': 2}));
});
it('should detect additional entries', () => {
expect(MapWrapper.createFromStringMap({'a': 1}))
.not.toEqual(MapWrapper.createFromStringMap({'a': 1, 'b': 1}));
expect(MapWrapper.createFromStringMap({
'a': 1
})).not.toEqual(MapWrapper.createFromStringMap({'a': 1, 'b': 1}));
});
});
describe("spy objects", () => {
describe('spy objects', () => {
var spyObj;
beforeEach(() => { spyObj = <any>new SpyTestObj(); });
it("should return a new spy func with no calls",
() => { expect(spyObj.spy("someFunc")).not.toHaveBeenCalled(); });
it('should return a new spy func with no calls',
() => { expect(spyObj.spy('someFunc')).not.toHaveBeenCalled(); });
it("should record function calls", () => {
spyObj.spy("someFunc").andCallFake((a, b) => {return a + b});
it('should record function calls', () => {
spyObj.spy('someFunc').andCallFake((a, b) => {return a + b});
expect(spyObj.someFunc(1, 2)).toEqual(3);
expect(spyObj.spy("someFunc")).toHaveBeenCalledWith(1, 2);
expect(spyObj.spy('someFunc')).toHaveBeenCalledWith(1, 2);
});
it("should match multiple function calls", () => {
it('should match multiple function calls', () => {
spyObj.someFunc(1, 2);
spyObj.someFunc(3, 4);
expect(spyObj.spy("someFunc")).toHaveBeenCalledWith(1, 2);
expect(spyObj.spy("someFunc")).toHaveBeenCalledWith(3, 4);
expect(spyObj.spy('someFunc')).toHaveBeenCalledWith(1, 2);
expect(spyObj.spy('someFunc')).toHaveBeenCalledWith(3, 4);
});
it("should match null arguments", () => {
spyObj.someFunc(null, "hello");
expect(spyObj.spy("someFunc")).toHaveBeenCalledWith(null, "hello");
it('should match null arguments', () => {
spyObj.someFunc(null, 'hello');
expect(spyObj.spy('someFunc')).toHaveBeenCalledWith(null, 'hello');
});
it("should match using deep equality", () => {
it('should match using deep equality', () => {
spyObj.someComplexFunc([1]);
expect(spyObj.spy("someComplexFunc")).toHaveBeenCalledWith([1]);
expect(spyObj.spy('someComplexFunc')).toHaveBeenCalledWith([1]);
});
it("should support stubs", () => {
var s = SpyObject.stub({"a": 1}, {"b": 2});
it('should support stubs', () => {
var s = SpyObject.stub({'a': 1}, {'b': 2});
expect(s.a()).toEqual(1);
expect(s.b()).toEqual(2);
@@ -1,20 +1,4 @@
import {
it,
iit,
xit,
describe,
ddescribe,
xdescribe,
expect,
fakeAsync,
tick,
beforeEach,
inject,
injectAsync,
withProviders,
beforeEachProviders,
TestComponentBuilder
} from 'angular2/testing';
import {it, iit, xit, describe, ddescribe, xdescribe, expect, fakeAsync, tick, beforeEach, inject, injectAsync, withProviders, beforeEachProviders, TestComponentBuilder} from 'angular2/testing';
import {Injectable, bind} from 'angular2/core';
import {NgIf} from 'angular2/common';
@@ -189,8 +173,8 @@ export function main() {
})));
describe('using beforeEach', () => {
beforeEach(inject([FancyService],
(service) => { service.value = 'value modified in beforeEach'; }));
beforeEach(inject(
[FancyService], (service) => { service.value = 'value modified in beforeEach'; }));
it('should use modified providers', inject([FancyService], (service) => {
expect(service.value).toEqual('value modified in beforeEach');
@@ -210,8 +194,8 @@ export function main() {
describe('per test providers', () => {
it('should allow per test providers',
withProviders(() => [bind(FancyService).toValue(new FancyService())])
.inject([FancyService],
(service) => { expect(service.value).toEqual('real value'); }));
.inject(
[FancyService], (service) => { expect(service.value).toEqual('real value'); }));
});
});
@@ -252,11 +236,13 @@ export function main() {
var itPromise = patchJasmineIt();
it('forgets to return a proimse', injectAsync([], () => { return true; }));
itPromise.then(() => { done.fail('Expected function to throw, but it did not'); }, (err) => {
expect(err).toEqual(
'Error: injectAsync was expected to return a promise, but the returned value was: true');
done();
});
itPromise.then(
() => { done.fail('Expected function to throw, but it did not'); },
(err) => {
expect(err).toEqual(
'Error: injectAsync was expected to return a promise, but the returned value was: true');
done();
});
restoreJasmineIt();
});
@@ -264,11 +250,13 @@ export function main() {
var itPromise = patchJasmineIt();
it('returns a value', inject([], () => { return true; }));
itPromise.then(() => { done.fail('Expected function to throw, but it did not'); }, (err) => {
expect(err).toEqual(
'Error: inject returned a value. Did you mean to use injectAsync? Returned value was: true');
done();
});
itPromise.then(
() => { done.fail('Expected function to throw, but it did not'); },
(err) => {
expect(err).toEqual(
'Error: inject returned a value. Did you mean to use injectAsync? Returned value was: true');
done();
});
restoreJasmineIt();
});
@@ -277,7 +265,8 @@ export function main() {
beforeEach(injectAsync([], () => { return true; }));
beforeEachPromise.then(
() => { done.fail('Expected function to throw, but it did not'); }, (err) => {
() => { done.fail('Expected function to throw, but it did not'); },
(err) => {
expect(err).toEqual(
'Error: injectAsync was expected to return a promise, but the returned value was: true');
done();
@@ -290,7 +279,8 @@ export function main() {
beforeEach(inject([], () => { return true; }));
beforeEachPromise.then(
() => { done.fail('Expected function to throw, but it did not'); }, (err) => {
() => { done.fail('Expected function to throw, but it did not'); },
(err) => {
expect(err).toEqual(
'Error: inject returned a value. Did you mean to use injectAsync? Returned value was: true');
done();
@@ -302,10 +292,12 @@ export function main() {
var itPromise = patchJasmineIt();
it('throws an error', inject([], () => { throw new Error('foo'); }));
itPromise.then(() => { done.fail('Expected function to throw, but it did not'); }, (err) => {
expect(err.message).toEqual('foo');
done();
});
itPromise.then(
() => { done.fail('Expected function to throw, but it did not'); },
(err) => {
expect(err.message).toEqual('foo');
done();
});
restoreJasmineIt();
});
@@ -316,10 +308,12 @@ export function main() {
it('throws an async error',
injectAsync([], () => { setTimeout(() => { throw new Error('bar'); }, 0); }));
itPromise.then(() => { done.fail('Expected test to fail, but it did not'); }, (err) => {
expect(err.message).toEqual('bar');
done();
});
itPromise.then(
() => { done.fail('Expected test to fail, but it did not'); },
(err) => {
expect(err.message).toEqual('bar');
done();
});
restoreJasmineIt();
});
@@ -334,10 +328,12 @@ export function main() {
return p;
}));
itPromise.then(() => { done.fail('Expected test to fail, but it did not'); }, (err) => {
expect(err).toEqual('baz');
done();
});
itPromise.then(
() => { done.fail('Expected test to fail, but it did not'); },
(err) => {
expect(err).toEqual('baz');
done();
});
restoreJasmineIt();
});
@@ -347,10 +343,12 @@ export function main() {
it('should fail with an error from a promise',
injectAsync([TestComponentBuilder], (tcb) => { return tcb.createAsync(BadTemplateUrl); }));
itPromise.then(() => { done.fail('Expected test to fail, but it did not'); }, (err) => {
expect(err).toEqual('Failed to load non-existant.html');
done();
});
itPromise.then(
() => { done.fail('Expected test to fail, but it did not'); },
(err) => {
expect(err).toEqual('Failed to load non-existant.html');
done();
});
restoreJasmineIt();
}, 10000);
@@ -367,8 +365,9 @@ export function main() {
expect(() => {
beforeEachProviders(() => [bind(FancyService).toValue(new FancyService())]);
})
.toThrowError('beforeEachProviders was called after the injector had been used ' +
'in a beforeEach or it block. This invalidates the test injector');
.toThrowError(
'beforeEachProviders was called after the injector had been used ' +
'in a beforeEach or it block. This invalidates the test injector');
restoreJasmineBeforeEach();
});
});
@@ -414,9 +413,9 @@ export function main() {
it('should override a view',
injectAsync([TestComponentBuilder], (tcb: TestComponentBuilder) => {
return tcb.overrideView(
ChildComp,
new ViewMetadata({template: '<span>Modified {{childBinding}}</span>'}))
return tcb
.overrideView(
ChildComp, new ViewMetadata({template: '<span>Modified {{childBinding}}</span>'}))
.createAsync(ChildComp)
.then((componentFixture) => {
componentFixture.detectChanges();
@@ -438,7 +437,7 @@ export function main() {
}));
it("should override child component's dependencies",
it('should override child component\'s dependencies',
injectAsync([TestComponentBuilder], (tcb: TestComponentBuilder) => {
return tcb.overrideDirective(ParentComp, ChildComp, ChildWithChildComp)
@@ -455,8 +454,8 @@ export function main() {
it('should override a provider',
injectAsync([TestComponentBuilder], (tcb: TestComponentBuilder) => {
return tcb.overrideProviders(TestProvidersComp,
[bind(FancyService).toClass(MockFancyService)])
return tcb
.overrideProviders(TestProvidersComp, [bind(FancyService).toClass(MockFancyService)])
.createAsync(TestProvidersComp)
.then((componentFixture) => {
componentFixture.detectChanges();
@@ -469,8 +468,9 @@ export function main() {
it('should override a viewProvider',
injectAsync([TestComponentBuilder], (tcb: TestComponentBuilder) => {
return tcb.overrideViewProviders(TestViewProvidersComp,
[bind(FancyService).toClass(MockFancyService)])
return tcb
.overrideViewProviders(
TestViewProvidersComp, [bind(FancyService).toClass(MockFancyService)])
.createAsync(TestViewProvidersComp)
.then((componentFixture) => {
componentFixture.detectChanges();
@@ -482,12 +482,11 @@ export function main() {
it('should allow an external templateUrl',
injectAsync([TestComponentBuilder], (tcb: TestComponentBuilder) => {
return tcb.createAsync(ExternalTemplateComp)
.then((componentFixture) => {
componentFixture.detectChanges();
expect(componentFixture.debugElement.nativeElement)
.toHaveText('from external template\n');
});
return tcb.createAsync(ExternalTemplateComp).then((componentFixture) => {
componentFixture.detectChanges();
expect(componentFixture.debugElement.nativeElement)
.toHaveText('from external template\n');
});
}), 10000); // Long timeout here because this test makes an actual XHR, and is slow on Edge.
});
}