fix(view): changed view manager to hydrate change detector after creating directives
This commit is contained in:
parent
f863ea0db5
commit
c1579222bd
|
@ -185,7 +185,6 @@ export class AppViewManagerUtils {
|
|||
}
|
||||
view.context = context;
|
||||
view.locals.parent = parentLocals;
|
||||
view.changeDetector.hydrate(view.context, view.locals, view);
|
||||
|
||||
var binders = view.proto.elementBinders;
|
||||
for (var i = 0; i < binders.length; ++i) {
|
||||
|
@ -212,7 +211,7 @@ export class AppViewManagerUtils {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
view.changeDetector.hydrate(view.context, view.locals, view);
|
||||
}
|
||||
|
||||
_setUpEventEmitters(view:viewModule.AppView, elementInjector:eli.ElementInjector, boundElementIndex:number) {
|
||||
|
|
|
@ -14,7 +14,7 @@ export class Log {
|
|||
}
|
||||
|
||||
fn(value) {
|
||||
return () => {
|
||||
return (a1 = null, a2 = null, a3 = null, a4 = null, a5 = null) => {
|
||||
ListWrapper.push(this._result, value);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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", () => {
|
||||
|
|
Loading…
Reference in New Issue