fix(ivy): properly insert views in front of views with an empty element container (#33647)
PR Close #33647
This commit is contained in:
parent
1d429b2165
commit
056236cafd
@ -676,7 +676,12 @@ function getFirstNativeNode(lView: LView, tNode: TNode | null): RNode|null {
|
|||||||
return lContainer[NATIVE];
|
return lContainer[NATIVE];
|
||||||
}
|
}
|
||||||
} else if (tNodeType === TNodeType.ElementContainer || tNodeType === TNodeType.IcuContainer) {
|
} 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 {
|
} else {
|
||||||
const componentView = findComponentView(lView);
|
const componentView = findComponentView(lView);
|
||||||
const componentHost = componentView[T_HOST] as TElementNode;
|
const componentHost = componentView[T_HOST] as TElementNode;
|
||||||
|
@ -327,6 +327,11 @@ describe('view insertion', () => {
|
|||||||
.toBe('insert|before');
|
.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',
|
it('should insert before a view with ICU container inside a ng-container as the first root node',
|
||||||
() => {
|
() => {
|
||||||
expect(
|
expect(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user