fix(web_workers): support @AngularEntrypoint in web workers
And enable transformers on all playground apps Closes #6013
This commit is contained in:
@ -3,11 +3,13 @@ import {
|
||||
inject,
|
||||
describe,
|
||||
it,
|
||||
iit,
|
||||
expect,
|
||||
beforeEach,
|
||||
beforeEachProviders,
|
||||
SpyObject,
|
||||
proxy
|
||||
proxy,
|
||||
browserDetection
|
||||
} from 'angular2/testing_internal';
|
||||
import {createPairedMessageBuses} from '../shared/web_worker_test_util';
|
||||
import {Serializer, PRIMITIVE} from 'angular2/src/web_workers/shared/serializer';
|
||||
@ -49,19 +51,23 @@ export function main() {
|
||||
{'method': TEST_METHOD, 'args': [PASSED_ARG_1, PASSED_ARG_2]});
|
||||
}));
|
||||
|
||||
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.subscribe(messageBuses.worker.from(CHANNEL), (data: any) => {
|
||||
expect(data.type).toEqual("result");
|
||||
expect(data.id).toEqual(ID);
|
||||
expect(data.value).toEqual(RESULT);
|
||||
});
|
||||
}));
|
||||
// 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) => {
|
||||
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.subscribe(messageBuses.worker.from(CHANNEL), (data: any) => {
|
||||
expect(data.type).toEqual("result");
|
||||
expect(data.id).toEqual(ID);
|
||||
expect(data.value).toEqual(RESULT);
|
||||
});
|
||||
}));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
Reference in New Issue
Block a user