revert(format): Revert "chore(format): update to latest formatter"

This reverts commit 03627aa84d.
This commit is contained in:
Alex Rickabaugh
2016-04-12 09:40:37 -07:00
parent 03627aa84d
commit 60727c4d2b
527 changed files with 19247 additions and 13970 deletions
@@ -1,4 +1,14 @@
import {AsyncTestCompleter, inject, describe, it, expect, beforeEach, beforeEachProviders, SpyObject, proxy} from 'angular2/testing_internal';
import {
AsyncTestCompleter,
inject,
describe,
it,
expect,
beforeEach,
beforeEachProviders,
SpyObject,
proxy
} from 'angular2/testing_internal';
import {ObservableWrapper, TimerWrapper} from 'angular2/src/facade/async';
import {MessageBus} from 'angular2/src/web_workers/shared/message_bus';
import {createConnectedMessageBus} from './message_bus_util';
@@ -9,15 +19,15 @@ export function main() {
/**
* Tests the PostMessageBus in TypeScript and the IsolateMessageBus in Dart
*/
describe('MessageBus', () => {
describe("MessageBus", () => {
var bus: MessageBus;
beforeEach(() => { bus = createConnectedMessageBus(); });
it('should pass messages in the same channel from sink to source',
it("should pass messages in the same channel from sink to source",
inject([AsyncTestCompleter], (async) => {
const CHANNEL = 'CHANNEL 1';
const MESSAGE = 'Test message';
const CHANNEL = "CHANNEL 1";
const MESSAGE = "Test message";
bus.initChannel(CHANNEL, false);
var fromEmitter = bus.from(CHANNEL);
@@ -29,9 +39,9 @@ export function main() {
ObservableWrapper.callEmit(toEmitter, MESSAGE);
}));
it('should broadcast', inject([AsyncTestCompleter], (async) => {
const CHANNEL = 'CHANNEL 1';
const MESSAGE = 'TESTING';
it("should broadcast", inject([AsyncTestCompleter], (async) => {
const CHANNEL = "CHANNEL 1";
const MESSAGE = "TESTING";
const NUM_LISTENERS = 2;
bus.initChannel(CHANNEL, false);
@@ -53,11 +63,11 @@ export function main() {
ObservableWrapper.callEmit(toEmitter, MESSAGE);
}));
it('should keep channels independent', inject([AsyncTestCompleter], (async) => {
const CHANNEL_ONE = 'CHANNEL 1';
const CHANNEL_TWO = 'CHANNEL 2';
const MESSAGE_ONE = 'This is a message on CHANNEL 1';
const MESSAGE_TWO = 'This is a message on CHANNEL 2';
it("should keep channels independent", inject([AsyncTestCompleter], (async) => {
const CHANNEL_ONE = "CHANNEL 1";
const CHANNEL_TWO = "CHANNEL 2";
const MESSAGE_ONE = "This is a message on CHANNEL 1";
const MESSAGE_TWO = "This is a message on CHANNEL 2";
var callCount = 0;
bus.initChannel(CHANNEL_ONE, false);
bus.initChannel(CHANNEL_TWO, false);
@@ -87,9 +97,9 @@ export function main() {
}));
});
describe('PostMessageBusSink', () => {
describe("PostMessageBusSink", () => {
var bus: MessageBus;
const CHANNEL = 'Test Channel';
const CHANNEL = "Test Channel";
function setup(runInZone: boolean, zone: NgZone) {
bus.attachToZone(zone);
@@ -104,13 +114,13 @@ export function main() {
beforeEach(() => { bus = createConnectedMessageBus(); });
it('should buffer messages and wait for the zone to exit before sending',
it("should buffer messages and wait for the zone to exit before sending",
inject([AsyncTestCompleter, NgZone], (async, zone: MockNgZone) => {
setup(true, zone);
var wasCalled = false;
ObservableWrapper.subscribe(bus.from(CHANNEL), (message) => { wasCalled = true; });
ObservableWrapper.callEmit(bus.to(CHANNEL), 'hi');
ObservableWrapper.callEmit(bus.to(CHANNEL), "hi");
flushMessages(() => {
@@ -124,13 +134,13 @@ export function main() {
});
}), 500);
it('should send messages immediatly when run outside the zone',
it("should send messages immediatly when run outside the zone",
inject([AsyncTestCompleter, NgZone], (async, zone: MockNgZone) => {
setup(false, zone);
var wasCalled = false;
ObservableWrapper.subscribe(bus.from(CHANNEL), (message) => { wasCalled = true; });
ObservableWrapper.callEmit(bus.to(CHANNEL), 'hi');
ObservableWrapper.callEmit(bus.to(CHANNEL), "hi");
flushMessages(() => {
expect(wasCalled).toBeTruthy();
@@ -1,4 +1,8 @@
import {PostMessageBusSource, PostMessageBusSink, PostMessageBus} from 'angular2/src/web_workers/shared/post_message_bus';
import {
PostMessageBusSource,
PostMessageBusSink,
PostMessageBus
} from 'angular2/src/web_workers/shared/post_message_bus';
import {MessageBus} from 'angular2/src/web_workers/shared/message_bus';
/*
@@ -17,10 +21,10 @@ class MockPostMessage {
private _listener: EventListener;
addEventListener(type: string, listener: EventListener, useCapture?: boolean): void {
if (type === 'message') {
if (type === "message") {
this._listener = listener;
}
}
postMessage(data: any, transfer?: [ArrayBuffer]): void { this._listener(<any>{data: data}); }
postMessage(data: any, transfer?:[ArrayBuffer]): void { this._listener(<any>{data: data}); }
}
@@ -1,8 +1,16 @@
import {AsyncTestCompleter, inject, describe, ddescribe, beforeEach, it, expect} from 'angular2/testing_internal';
import {RenderStore} from 'angular2/src/web_workers/shared/render_store';
import {
AsyncTestCompleter,
inject,
describe,
ddescribe,
beforeEach,
it,
expect
} from "angular2/testing_internal";
import {RenderStore} from "angular2/src/web_workers/shared/render_store";
export function main() {
describe('RenderStoreSpec', () => {
describe("RenderStoreSpec", () => {
var store: RenderStore;
beforeEach(() => { store = new RenderStore(); });
@@ -1,23 +1,38 @@
import {AsyncTestCompleter, inject, describe, it, iit, expect, beforeEach, beforeEachProviders, SpyObject, proxy, browserDetection} from 'angular2/testing_internal';
import {
AsyncTestCompleter,
inject,
describe,
it,
iit,
expect,
beforeEach,
beforeEachProviders,
SpyObject,
proxy,
browserDetection
} from 'angular2/testing_internal';
import {createPairedMessageBuses} from '../shared/web_worker_test_util';
import {Serializer, PRIMITIVE} from 'angular2/src/web_workers/shared/serializer';
import {ServiceMessageBroker, ServiceMessageBroker_} from 'angular2/src/web_workers/shared/service_message_broker';
import {
ServiceMessageBroker,
ServiceMessageBroker_
} from 'angular2/src/web_workers/shared/service_message_broker';
import {ObservableWrapper, PromiseWrapper} from 'angular2/src/facade/async';
import {provide} from 'angular2/core';
import {ON_WEB_WORKER} from 'angular2/src/web_workers/shared/api';
import {RenderStore} from 'angular2/src/web_workers/shared/render_store';
export function main() {
const CHANNEL = 'UIMessageBroker Test Channel';
const TEST_METHOD = 'TEST_METHOD';
const CHANNEL = "UIMessageBroker Test Channel";
const TEST_METHOD = "TEST_METHOD";
const PASSED_ARG_1 = 5;
const PASSED_ARG_2 = 'TEST';
const RESULT = 20;
const ID = 'methodId';
const ID = "methodId";
beforeEachProviders(() => [Serializer, provide(ON_WEB_WORKER, {useValue: true}), RenderStore]);
describe('UIMessageBroker', () => {
describe("UIMessageBroker", () => {
var messageBuses;
beforeEach(() => {
@@ -25,32 +40,30 @@ export function main() {
messageBuses.ui.initChannel(CHANNEL);
messageBuses.worker.initChannel(CHANNEL);
});
it('should call registered method with correct arguments',
it("should call registered method with correct arguments",
inject([Serializer], (serializer) => {
var broker = new ServiceMessageBroker_(messageBuses.ui, serializer, CHANNEL);
broker.registerMethod(TEST_METHOD, [PRIMITIVE, PRIMITIVE], (arg1, arg2) => {
expect(arg1).toEqual(PASSED_ARG_1);
expect(arg2).toEqual(PASSED_ARG_2);
});
ObservableWrapper.callEmit(
messageBuses.worker.to(CHANNEL),
{'method': TEST_METHOD, 'args': [PASSED_ARG_1, PASSED_ARG_2]});
ObservableWrapper.callEmit(messageBuses.worker.to(CHANNEL),
{'method': TEST_METHOD, 'args': [PASSED_ARG_1, PASSED_ARG_2]});
}));
// TODO(pkozlowski): this fails only in Edge with
// "No provider for RenderStore! (Serializer -> RenderStore)"
if (!browserDetection.isEdge) {
it('should return promises to the worker', inject([Serializer], (serializer) => {
it("should return promises to the worker", inject([Serializer], (serializer) => {
var broker = new ServiceMessageBroker_(messageBuses.ui, serializer, CHANNEL);
broker.registerMethod(TEST_METHOD, [PRIMITIVE], (arg1) => {
expect(arg1).toEqual(PASSED_ARG_1);
return PromiseWrapper.wrap(() => { return RESULT; });
});
ObservableWrapper.callEmit(
messageBuses.worker.to(CHANNEL),
{'method': TEST_METHOD, 'id': ID, 'args': [PASSED_ARG_1]});
ObservableWrapper.callEmit(messageBuses.worker.to(CHANNEL),
{'method': TEST_METHOD, 'id': ID, 'args': [PASSED_ARG_1]});
ObservableWrapper.subscribe(messageBuses.worker.from(CHANNEL), (data: any) => {
expect(data.type).toEqual('result');
expect(data.type).toEqual("result");
expect(data.id).toEqual(ID);
expect(data.value).toEqual(RESULT);
});
@@ -4,8 +4,15 @@ import {UiArguments} from 'angular2/src/web_workers/shared/client_message_broker
import {Type, isPresent} from 'angular2/src/facade/lang';
import {SpyMessageBroker} from '../worker/spies';
import {expect} from 'angular2/src/testing/matchers';
import {MessageBusSink, MessageBusSource, MessageBus} from 'angular2/src/web_workers/shared/message_bus';
import {ClientMessageBroker, ClientMessageBrokerFactory_} from 'angular2/src/web_workers/shared/client_message_broker';
import {
MessageBusSink,
MessageBusSource,
MessageBus
} from 'angular2/src/web_workers/shared/message_bus';
import {
ClientMessageBroker,
ClientMessageBrokerFactory_
} from 'angular2/src/web_workers/shared/client_message_broker';
import {MockEventEmitter} from './mock_event_emitter';
import {BaseException, WrappedException} from 'angular2/src/facade/exceptions';
import {NgZone} from 'angular2/src/core/zone/ng_zone';
@@ -25,9 +32,8 @@ export function createPairedMessageBuses(): PairedMessageBuses {
var uiMessageBusSink = new MockMessageBusSink(secondChannels);
var workerMessageBusSource = new MockMessageBusSource(secondChannels);
return new PairedMessageBuses(
new MockMessageBus(uiMessageBusSink, uiMessageBusSource),
new MockMessageBus(workerMessageBusSink, workerMessageBusSource));
return new PairedMessageBuses(new MockMessageBus(uiMessageBusSink, uiMessageBusSource),
new MockMessageBus(workerMessageBusSink, workerMessageBusSource));
}
/**
@@ -36,29 +42,29 @@ export function createPairedMessageBuses(): PairedMessageBuses {
* If a handler is provided it will be called to handle the request.
* Only intended to be called on a given broker instance once.
*/
export function expectBrokerCall(
broker: SpyMessageBroker, methodName: string, vals?: Array<any>,
handler?: (..._: any[]) => Promise<any>| void): void {
broker.spy('runOnService').andCallFake((args: UiArguments, returnType: Type) => {
expect(args.method).toEqual(methodName);
if (isPresent(vals)) {
expect(args.args.length).toEqual(vals.length);
ListWrapper.forEachWithIndex(vals, (v, i) => {expect(v).toEqual(args.args[i].value)});
}
var promise = null;
if (isPresent(handler)) {
let givenValues = args.args.map((arg) => {arg.value});
if (givenValues.length > 0) {
promise = handler(givenValues);
} else {
promise = handler();
}
}
if (promise == null) {
promise = PromiseWrapper.wrap(() => {});
}
return promise;
});
export function expectBrokerCall(broker: SpyMessageBroker, methodName: string, vals?: Array<any>,
handler?: (..._: any[]) => Promise<any>| void): void {
broker.spy("runOnService")
.andCallFake((args: UiArguments, returnType: Type) => {
expect(args.method).toEqual(methodName);
if (isPresent(vals)) {
expect(args.args.length).toEqual(vals.length);
ListWrapper.forEachWithIndex(vals, (v, i) => {expect(v).toEqual(args.args[i].value)});
}
var promise = null;
if (isPresent(handler)) {
let givenValues = args.args.map((arg) => {arg.value});
if (givenValues.length > 0) {
promise = handler(givenValues);
} else {
promise = handler();
}
}
if (promise == null) {
promise = PromiseWrapper.wrap(() => {});
}
return promise;
});
}
export class PairedMessageBuses {