refactor(compiler): use the new compiler everywhere
Closes #3605 BREAKING CHANGE: - we don't mark an element as bound any more if it only contains text bindings E.g. <div>{{hello}}</div> This changes the indices when using `DebugElement.componentViewChildren` / `DebugElement.children`. - `@Directive.compileChildren` was removed, `ng-non-bindable` is now builtin and not a directive any more - angular no more adds the `ng-binding` class to elements with bindings - directives are now ordered as they are listed in the View.directives regarding change detection. Previously they had an undefined order. - the `Renderer` interface has new methods `createProtoView` and `registerComponentTemplate`. See `DomRenderer` for default implementations. - reprojection with `ng-content` is now all or nothing per `ng-content` element - angular2 transformer can't be used in tests that modify directive metadata. Use `angular2/src/transform/inliner_for_test` transformer instead.
This commit is contained in:
@@ -1,24 +1,56 @@
|
||||
import {AsyncTestCompleter, inject, describe, it, expect} from "angular2/test_lib";
|
||||
import {
|
||||
AsyncTestCompleter,
|
||||
inject,
|
||||
describe,
|
||||
ddescribe,
|
||||
beforeEach,
|
||||
it,
|
||||
expect
|
||||
} from "angular2/test_lib";
|
||||
import {RenderProtoViewRef} from "angular2/src/core/render/api";
|
||||
import {RenderProtoViewRefStore} from "angular2/src/web_workers/shared/render_proto_view_ref_store";
|
||||
import {
|
||||
WebWorkerRenderProtoViewRef
|
||||
} from "angular2/src/web_workers/shared/render_proto_view_ref_store";
|
||||
|
||||
export function main() {
|
||||
describe("RenderProtoViewRefStore", () => {
|
||||
it("should store and return the correct reference", () => {
|
||||
var store = new RenderProtoViewRefStore(true);
|
||||
var ref1 = new RenderProtoViewRef();
|
||||
var index1 = store.storeRenderProtoViewRef(ref1);
|
||||
expect(store.retreiveRenderProtoViewRef(index1)).toBe(ref1);
|
||||
var ref2 = new RenderProtoViewRef();
|
||||
var index2 = store.storeRenderProtoViewRef(ref2);
|
||||
expect(store.retreiveRenderProtoViewRef(index2)).toBe(ref2);
|
||||
describe("on WebWorker", () => {
|
||||
var store: RenderProtoViewRefStore;
|
||||
beforeEach(() => { store = new RenderProtoViewRefStore(true); });
|
||||
|
||||
it("should allocate refs", () => {
|
||||
expect((<WebWorkerRenderProtoViewRef>store.allocate()).refNumber).toBe(0);
|
||||
expect((<WebWorkerRenderProtoViewRef>store.allocate()).refNumber).toBe(1);
|
||||
});
|
||||
|
||||
it("should be serializable", () => {
|
||||
var protoView = store.allocate();
|
||||
expect(store.deserialize(store.serialize(protoView))).toEqual(protoView);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
it("should cache index numbers", () => {
|
||||
var store = new RenderProtoViewRefStore(true);
|
||||
var ref = new RenderProtoViewRef();
|
||||
var index = store.storeRenderProtoViewRef(ref);
|
||||
expect(store.storeRenderProtoViewRef(ref)).toEqual(index);
|
||||
describe("on UI", () => {
|
||||
var store: RenderProtoViewRefStore;
|
||||
beforeEach(() => { store = new RenderProtoViewRefStore(false); });
|
||||
|
||||
it("should associate views with the correct references", () => {
|
||||
var renderProtoViewRef = new RenderProtoViewRef();
|
||||
|
||||
store.store(renderProtoViewRef, 100);
|
||||
expect(store.deserialize(100)).toBe(renderProtoViewRef);
|
||||
});
|
||||
|
||||
it("should be serializable", () => {
|
||||
var renderProtoViewRef = new RenderProtoViewRef();
|
||||
store.store(renderProtoViewRef, 0);
|
||||
|
||||
var deserialized = store.deserialize(store.serialize(renderProtoViewRef));
|
||||
expect(deserialized).toBe(renderProtoViewRef);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user