fix(ivy): debug element should support components with ViewContainerRef (#29534)
PR Close #29534
This commit is contained in:
parent
22b89ea58a
commit
50f7ab2a06
|
@ -403,9 +403,8 @@ function _queryAllR3(
|
||||||
elementsOnly: boolean) {
|
elementsOnly: boolean) {
|
||||||
const context = loadLContext(parentElement.nativeNode) !;
|
const context = loadLContext(parentElement.nativeNode) !;
|
||||||
const parentTNode = context.lView[TVIEW].data[context.nodeIndex] as TNode;
|
const parentTNode = context.lView[TVIEW].data[context.nodeIndex] as TNode;
|
||||||
// This the fixture's debug element, so this is always a component view.
|
const lView = getComponentViewByIndex(parentTNode.index, context.lView);
|
||||||
const lView = context.lView[parentTNode.index];
|
const tNode = lView[TVIEW].firstChild !;
|
||||||
const tNode = lView[TVIEW].firstChild;
|
|
||||||
_queryNodeChildrenR3(tNode, lView, predicate, matches, elementsOnly);
|
_queryNodeChildrenR3(tNode, lView, predicate, matches, elementsOnly);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -190,6 +190,11 @@ class HostClassBindingCmp {
|
||||||
hostClasses = 'class-one class-two';
|
hostClasses = 'class-one class-two';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Component({selector: 'test-cmpt-vcref', template: `<div></div>`})
|
||||||
|
class TestCmptWithViewContainerRef {
|
||||||
|
constructor(private vcref: ViewContainerRef) {}
|
||||||
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
describe('debug element', () => {
|
describe('debug element', () => {
|
||||||
let fixture: ComponentFixture<any>;
|
let fixture: ComponentFixture<any>;
|
||||||
|
@ -211,6 +216,7 @@ class HostClassBindingCmp {
|
||||||
BankAccount,
|
BankAccount,
|
||||||
TestCmpt,
|
TestCmpt,
|
||||||
HostClassBindingCmp,
|
HostClassBindingCmp,
|
||||||
|
TestCmptWithViewContainerRef,
|
||||||
SimpleContentComp,
|
SimpleContentComp,
|
||||||
],
|
],
|
||||||
providers: [Logger],
|
providers: [Logger],
|
||||||
|
@ -631,5 +637,12 @@ class HostClassBindingCmp {
|
||||||
getDOM().remove(content);
|
getDOM().remove(content);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should support components with ViewContainerRef', () => {
|
||||||
|
fixture = TestBed.createComponent(TestCmptWithViewContainerRef);
|
||||||
|
|
||||||
|
const divEl = fixture.debugElement.query(By.css('div'));
|
||||||
|
expect(divEl).not.toBeNull();
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue