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,14 +1,4 @@
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';
@@ -19,15 +9,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);
@@ -39,9 +29,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);
@@ -63,11 +53,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);
@@ -97,9 +87,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);
@@ -114,13 +104,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(() => {
@@ -134,13 +124,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,8 +1,4 @@
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';
/*
@@ -21,10 +17,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,16 +1,8 @@
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,38 +1,23 @@
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(() => {
@@ -40,30 +25,32 @@ 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,15 +4,8 @@ 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';
@@ -32,8 +25,9 @@ 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));
}
/**
@@ -42,29 +36,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 {
@@ -1,52 +1,39 @@
import {
AsyncTestCompleter,
inject,
describe,
it,
expect,
beforeEach,
beforeEachProviders
} from 'angular2/testing_internal';
import {AsyncTestCompleter, inject, describe, it, expect, beforeEach, beforeEachProviders} from 'angular2/testing_internal';
import {SpyMessageBroker} from './spies';
import {WebWorkerPlatformLocation} from 'angular2/src/web_workers/worker/platform_location';
import {LocationType} from 'angular2/src/web_workers/shared/serialized_types';
import {MessageBus} from 'angular2/src/web_workers/shared/message_bus';
import {
createPairedMessageBuses,
MockMessageBrokerFactory,
expectBrokerCall
} from '../shared/web_worker_test_util';
import {createPairedMessageBuses, MockMessageBrokerFactory, expectBrokerCall} from '../shared/web_worker_test_util';
import {UiArguments} from 'angular2/src/web_workers/shared/client_message_broker';
import {Type} from 'angular2/src/facade/lang';
import {PromiseWrapper} from "angular2/src/facade/async";
import {PromiseWrapper} from 'angular2/src/facade/async';
import {CONST_EXPR} from 'angular2/src/facade/lang';
export function main() {
describe("WebWorkerPlatformLocation", () => {
describe('WebWorkerPlatformLocation', () => {
var uiBus: MessageBus = null;
var workerBus: MessageBus = null;
var broker: any = null;
var TEST_LOCATION =
new LocationType("http://www.example.com", "http", "example.com", "example.com", "80", "/",
"", "", "http://www.example.com");
var TEST_LOCATION = new LocationType(
'http://www.example.com', 'http', 'example.com', 'example.com', '80', '/', '', '',
'http://www.example.com');
function createWebWorkerPlatformLocation(loc: LocationType): WebWorkerPlatformLocation {
broker.spy("runOnService")
.andCallFake((args: UiArguments, returnType: Type) => {
if (args.method === 'getLocation') {
return PromiseWrapper.resolve(loc);
}
});
broker.spy('runOnService').andCallFake((args: UiArguments, returnType: Type) => {
if (args.method === 'getLocation') {
return PromiseWrapper.resolve(loc);
}
});
var factory = new MockMessageBrokerFactory(broker);
return new WebWorkerPlatformLocation(factory, workerBus, null);
}
function testPushOrReplaceState(pushState: boolean) {
let platformLocation = createWebWorkerPlatformLocation(null);
const TITLE = "foo";
const URL = "http://www.example.com/foo";
expectBrokerCall(broker, pushState ? "pushState" : "replaceState", [null, TITLE, URL]);
const TITLE = 'foo';
const URL = 'http://www.example.com/foo';
expectBrokerCall(broker, pushState ? 'pushState' : 'replaceState', [null, TITLE, URL]);
if (pushState) {
platformLocation.pushState(null, TITLE, URL);
} else {
@@ -58,40 +45,40 @@ export function main() {
var buses = createPairedMessageBuses();
uiBus = buses.ui;
workerBus = buses.worker;
workerBus.initChannel("ng-Router");
uiBus.initChannel("ng-Router");
workerBus.initChannel('ng-Router');
uiBus.initChannel('ng-Router');
broker = new SpyMessageBroker();
});
it("should throw if getBaseHrefFromDOM is called", () => {
it('should throw if getBaseHrefFromDOM is called', () => {
let platformLocation = createWebWorkerPlatformLocation(null);
expect(() => platformLocation.getBaseHrefFromDOM()).toThrowError();
});
it("should get location on init", () => {
it('should get location on init', () => {
let platformLocation = createWebWorkerPlatformLocation(null);
expectBrokerCall(broker, "getLocation");
expectBrokerCall(broker, 'getLocation');
platformLocation.init();
});
it("should throw if set pathname is called before init finishes", () => {
it('should throw if set pathname is called before init finishes', () => {
let platformLocation = createWebWorkerPlatformLocation(null);
platformLocation.init();
expect(() => platformLocation.pathname = "TEST").toThrowError();
expect(() => platformLocation.pathname = 'TEST').toThrowError();
});
it("should send pathname to render thread", inject([AsyncTestCompleter], (async) => {
it('should send pathname to render thread', inject([AsyncTestCompleter], (async) => {
let platformLocation = createWebWorkerPlatformLocation(TEST_LOCATION);
platformLocation.init().then((_) => {
let PATHNAME = "/test";
expectBrokerCall(broker, "setPathname", [PATHNAME]);
let PATHNAME = '/test';
expectBrokerCall(broker, 'setPathname', [PATHNAME]);
platformLocation.pathname = PATHNAME;
async.done();
});
}));
it("should send pushState to render thread", () => { testPushOrReplaceState(true); });
it('should send pushState to render thread', () => { testPushOrReplaceState(true); });
it("should send replaceState to render thread", () => { testPushOrReplaceState(false); });
it('should send replaceState to render thread', () => { testPushOrReplaceState(false); });
});
}
@@ -1,53 +1,20 @@
import {
AsyncTestCompleter,
inject,
ddescribe,
describe,
dispatchEvent,
it,
iit,
expect,
beforeEach,
beforeEachProviders,
TestInjector,
TestComponentBuilder
} from "angular2/testing_internal";
import {AsyncTestCompleter, inject, ddescribe, describe, dispatchEvent, it, iit, expect, beforeEach, beforeEachProviders, TestInjector, TestComponentBuilder} from 'angular2/testing_internal';
import {DOM} from 'angular2/src/platform/dom/dom_adapter';
import {
bind,
provide,
Provider,
Injector,
ViewMetadata,
Component,
Injectable,
ElementRef
} from 'angular2/core';
import {bind, provide, Provider, Injector, ViewMetadata, Component, Injectable, ElementRef} from 'angular2/core';
import {NgIf} from 'angular2/common';
import {WebWorkerRootRenderer} from "angular2/src/web_workers/worker/renderer";
import {
ClientMessageBrokerFactory,
ClientMessageBrokerFactory_,
UiArguments,
FnArg
} from "angular2/src/web_workers/shared/client_message_broker";
import {Serializer} from "angular2/src/web_workers/shared/serializer";
import {RootRenderer} from "angular2/src/core/render/api";
import {WebWorkerRootRenderer} from 'angular2/src/web_workers/worker/renderer';
import {ClientMessageBrokerFactory, ClientMessageBrokerFactory_, UiArguments, FnArg} from 'angular2/src/web_workers/shared/client_message_broker';
import {Serializer} from 'angular2/src/web_workers/shared/serializer';
import {RootRenderer} from 'angular2/src/core/render/api';
import {DomRootRenderer, DomRootRenderer_} from 'angular2/src/platform/dom/dom_renderer';
import {DebugDomRootRenderer} from 'angular2/src/core/debug/debug_renderer';
import {RenderStore} from "angular2/src/web_workers/shared/render_store";
import {RenderStore} from 'angular2/src/web_workers/shared/render_store';
import {MessageBasedRenderer} from 'angular2/src/web_workers/ui/renderer';
import {createPairedMessageBuses, PairedMessageBuses} from '../shared/web_worker_test_util';
import {
ServiceMessageBrokerFactory,
ServiceMessageBrokerFactory_
} from 'angular2/src/web_workers/shared/service_message_broker';
import {ServiceMessageBrokerFactory, ServiceMessageBrokerFactory_} from 'angular2/src/web_workers/shared/service_message_broker';
import {ChangeDetectorGenConfig} from 'angular2/src/core/change_detection/change_detection';
import {ElementRef_} from 'angular2/src/core/linker/element_ref';
import {
TEST_BROWSER_PLATFORM_PROVIDERS,
TEST_BROWSER_APPLICATION_PROVIDERS
} from 'angular2/platform/testing/browser';
import {TEST_BROWSER_PLATFORM_PROVIDERS, TEST_BROWSER_APPLICATION_PROVIDERS} from 'angular2/platform/testing/browser';
export function main() {
function createWebWorkerBrokerFactory(
@@ -62,25 +29,25 @@ export function main() {
// set up the ui side
var uiMessageBrokerFactory = new ServiceMessageBrokerFactory_(uiMessageBus, uiSerializer);
var renderer = new MessageBasedRenderer(uiMessageBrokerFactory, uiMessageBus, uiSerializer,
uiRenderStore, domRootRenderer);
var renderer = new MessageBasedRenderer(
uiMessageBrokerFactory, uiMessageBus, uiSerializer, uiRenderStore, domRootRenderer);
renderer.start();
return webWorkerBrokerFactory;
}
function createWorkerRenderer(workerSerializer: Serializer, uiSerializer: Serializer,
domRootRenderer: DomRootRenderer, uiRenderStore: RenderStore,
workerRenderStore: RenderStore): RootRenderer {
function createWorkerRenderer(
workerSerializer: Serializer, uiSerializer: Serializer, domRootRenderer: DomRootRenderer,
uiRenderStore: RenderStore, workerRenderStore: RenderStore): RootRenderer {
var messageBuses = createPairedMessageBuses();
var brokerFactory = createWebWorkerBrokerFactory(messageBuses, workerSerializer, uiSerializer,
domRootRenderer, uiRenderStore);
var workerRootRenderer = new WebWorkerRootRenderer(brokerFactory, messageBuses.worker,
workerSerializer, workerRenderStore);
var brokerFactory = createWebWorkerBrokerFactory(
messageBuses, workerSerializer, uiSerializer, domRootRenderer, uiRenderStore);
var workerRootRenderer = new WebWorkerRootRenderer(
brokerFactory, messageBuses.worker, workerSerializer, workerRenderStore);
return new DebugDomRootRenderer(workerRootRenderer);
}
describe("Web Worker Renderer", () => {
describe('Web Worker Renderer', () => {
var uiInjector: Injector;
var uiRenderStore: RenderStore;
var workerRenderStore: RenderStore;
@@ -91,8 +58,7 @@ export function main() {
testUiInjector.platformProviders = TEST_BROWSER_PLATFORM_PROVIDERS;
testUiInjector.applicationProviders = TEST_BROWSER_APPLICATION_PROVIDERS;
testUiInjector.addProviders([
Serializer,
provide(RenderStore, {useValue: uiRenderStore}),
Serializer, provide(RenderStore, {useValue: uiRenderStore}),
provide(DomRootRenderer, {useClass: DomRootRenderer_}),
provide(RootRenderer, {useExisting: DomRootRenderer})
]);
@@ -102,17 +68,15 @@ export function main() {
workerRenderStore = new RenderStore();
return [
Serializer,
provide(ChangeDetectorGenConfig,
{useValue: new ChangeDetectorGenConfig(true, true, false)}),
provide(RenderStore, {useValue: workerRenderStore}),
provide(RootRenderer,
{
useFactory: (workerSerializer) => {
return createWorkerRenderer(workerSerializer, uiSerializer, domRootRenderer,
uiRenderStore, workerRenderStore);
},
deps: [Serializer]
})
provide(
ChangeDetectorGenConfig, {useValue: new ChangeDetectorGenConfig(true, true, false)}),
provide(RenderStore, {useValue: workerRenderStore}), provide(RootRenderer, {
useFactory: (workerSerializer) => {
return createWorkerRenderer(
workerSerializer, uiSerializer, domRootRenderer, uiRenderStore, workerRenderStore);
},
deps: [Serializer]
})
];
});
@@ -143,8 +107,9 @@ export function main() {
it('should update any element property/attributes/class/style independent of the compilation on the root element and other elements',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
tcb.overrideView(MyComp, new ViewMetadata(
{template: '<input [title]="y" style="position:absolute">'}))
tcb.overrideView(
MyComp,
new ViewMetadata({template: '<input [title]="y" style="position:absolute">'}))
.createAsync(MyComp)
.then((fixture) => {
var checkSetters = (elr) => {
@@ -226,8 +191,8 @@ export function main() {
var elRef = (<ElementRef_>fixture.elementRef)
.internalElement.componentView.appElements[0]
.ref;
getRenderer(elRef)
.invokeElementMethod(elRef.nativeElement, 'setAttribute', ['a', 'b']);
getRenderer(elRef).invokeElementMethod(
elRef.nativeElement, 'setAttribute', ['a', 'b']);
expect(DOM.getAttribute(getRenderElement(elRef), 'a')).toEqual('b');
async.done();
@@ -236,8 +201,8 @@ export function main() {
it('should listen to events',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
tcb.overrideView(MyComp,
new ViewMetadata({template: '<input (change)="ctxNumProp = 1">'}))
tcb.overrideView(
MyComp, new ViewMetadata({template: '<input (change)="ctxNumProp = 1">'}))
.createAsync(MyComp)
.then((fixture) => {
var elRef = (<ElementRef_>fixture.elementRef)
@@ -1,27 +1,20 @@
import {
AsyncTestCompleter,
inject,
describe,
it,
expect,
beforeEach,
beforeEachProviders
} from 'angular2/testing_internal';
import {AsyncTestCompleter, inject, describe, it, expect, beforeEach, beforeEachProviders} from 'angular2/testing_internal';
import {SpyMessageBroker} from './spies';
import {WebWorkerXHRImpl} from "angular2/src/web_workers/worker/xhr_impl";
import {PromiseWrapper} from "angular2/src/facade/async";
import {MockMessageBrokerFactory, expectBrokerCall} from "../shared/web_worker_test_util";
import {WebWorkerXHRImpl} from 'angular2/src/web_workers/worker/xhr_impl';
import {PromiseWrapper} from 'angular2/src/facade/async';
import {MockMessageBrokerFactory, expectBrokerCall} from '../shared/web_worker_test_util';
export function main() {
describe("WebWorkerXHRImpl", () => {
it("should pass requests through the broker and return the response",
describe('WebWorkerXHRImpl', () => {
it('should pass requests through the broker and return the response',
inject([AsyncTestCompleter], (async) => {
const URL = "http://www.example.com/test";
const RESPONSE = "Example response text";
const URL = 'http://www.example.com/test';
const RESPONSE = 'Example response text';
var messageBroker = new SpyMessageBroker();
expectBrokerCall(messageBroker, "get", [URL],
(_) => { return PromiseWrapper.wrap(() => { return RESPONSE; }); });
expectBrokerCall(messageBroker, 'get', [URL], (_) => {
return PromiseWrapper.wrap(() => { return RESPONSE; });
});
var xhrImpl = new WebWorkerXHRImpl(new MockMessageBrokerFactory(<any>messageBroker));
xhrImpl.get(URL).then((response) => {
expect(response).toEqual(RESPONSE);