fix(animations): use a lightweight renderer for non-animation components (#17003)

This commit is contained in:
Matias Niemelä
2017-05-25 17:54:35 -07:00
committed by Chuck Jazdzewski
parent 2538094e13
commit 3ab86bd661
9 changed files with 277 additions and 87 deletions
@@ -62,6 +62,7 @@ export function main() {
[elementDef(NodeFlags.None, null !, null !, 0, 'span', [['name', 'child1']])]))
]));
const viewContainerData = asElementData(parentView, 1);
const rf = parentView.root.rendererFactory;
const childView0 = createEmbeddedView(parentView, parentView.def.nodes[1]);
const childView1 = createEmbeddedView(parentView, parentView.def.nodes[2]);
@@ -75,8 +76,10 @@ export function main() {
expect(getDOM().getAttribute(rootChildren[1], 'name')).toBe('child0');
expect(getDOM().getAttribute(rootChildren[2], 'name')).toBe('child1');
rf.begin !();
detachEmbeddedView(viewContainerData, 1);
detachEmbeddedView(viewContainerData, 0);
rf.end !();
expect(getDOM().childNodes(rootNodes[0]).length).toBe(2);
});
@@ -187,4 +190,4 @@ export function main() {
expect(log).toEqual(['ngOnDestroy']);
});
});
}
}
@@ -121,6 +121,7 @@ export function main() {
])));
const componentView = asElementData(view, 0).componentView;
const rf = componentView.root.rendererFactory;
const view0 = createEmbeddedView(componentView, componentView.def.nodes[1]);
attachEmbeddedView(view, asElementData(componentView, 1), 0, view0);
@@ -128,7 +129,9 @@ export function main() {
expect(getDOM().childNodes(getDOM().firstChild(rootNodes[0]))[1])
.toBe(asTextData(view, 2).renderText);
rf.begin !();
detachEmbeddedView(asElementData(componentView, 1), 0);
rf.end !();
expect(getDOM().childNodes(getDOM().firstChild(rootNodes[0])).length).toBe(1);
});