Skip to content
Permalink
Browse files

fix(ivy): properly insert views in front of views with an empty eleme…

…nt container (#33647)

PR Close #33647
  • Loading branch information
pkozlowski-opensource authored and kara committed Nov 7, 2019
1 parent fc24a69 commit 0b998844c83c676fda98c8172a9681ca47b8283a
@@ -676,7 +676,12 @@ function getFirstNativeNode(lView: LView, tNode: TNode | null): RNode|null {
return lContainer[NATIVE];
}
} else if (tNodeType === TNodeType.ElementContainer || tNodeType === TNodeType.IcuContainer) {
return getFirstNativeNode(lView, tNode.child);
const elIcuContainerChild = tNode.child;
if (elIcuContainerChild !== null) {
return getFirstNativeNode(lView, elIcuContainerChild);
} else {
return getNativeByTNode(tNode, lView);
}
} else {
const componentView = findComponentView(lView);
const componentHost = componentView[T_HOST] as TElementNode;
@@ -327,6 +327,11 @@ describe('view insertion', () => {
.toBe('insert|before');
});

it('should insert before a view with the empty ng-container as the first root node', () => {
expect(createAndInsertViews(`<ng-container></ng-container>|before`).textContent)
.toBe('insert|before');
});

it('should insert before a view with ICU container inside a ng-container as the first root node',
() => {
expect(

0 comments on commit 0b99884

Please sign in to comment.
You can’t perform that action at this time.