fix(view): changed view manager to hydrate change detector after creating directives

This commit is contained in:
vsavkin
2015-04-30 10:16:12 -07:00
parent f863ea0db5
commit c1579222bd
3 changed files with 27 additions and 4 deletions
@@ -12,7 +12,8 @@ import {
beforeEachBindings,
it,
xit,
SpyObject, proxy
SpyObject, proxy,
Log
} from 'angular2/test_lib';
import {Injector, bind} from 'angular2/di';
@@ -114,6 +115,29 @@ export function main() {
});
describe("hydrateComponentView", () => {
it("should hydrate the change detector after hydrating element injectors", () => {
var log = new Log();
var componentView = createView(createProtoView([createEmptyElBinder()]));
var hostView = createView(createProtoView([createComponentElBinder(createProtoView())]));
hostView.componentChildViews = [componentView];
// (() => () nonsense is required until our transpiler supports type casting
var spyEi = (() => componentView.elementInjectors[0])();
spyEi.spy('instantiateDirectives').andCallFake(log.fn('instantiateDirectives'));
var spyCd = (() => componentView.changeDetector)();
spyCd.spy('hydrate').andCallFake(log.fn('hydrateCD'));
utils.hydrateComponentView(hostView, 0)
expect(log.result()).toEqual('instantiateDirectives; hydrateCD');
});
});
describe('shared hydrate functionality', () => {
it("should set up event listeners", () => {