fix(view): changed view manager to hydrate change detector after creating directives
This commit is contained in:
@@ -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", () => {
|
||||
|
||||
Reference in New Issue
Block a user