test(ivy): add tests for component factory projectable node corner cases (#27791)
In some cases ivy expects projectable nodes to be passed in a different order to ViewEngine. Specifically, ivy expects the catch-all ("*") to be at index 0, whereas ViewEngine expects it to be at its position at which it was parsed in the template. This commit adds one test that breaks under ivy and others that just describe more accurately what happens in corner cases. PR Close #27791
This commit is contained in:

committed by
Misko Hevery

parent
c34c223122
commit
6feef368f6
@ -422,7 +422,12 @@ describe('compiler (unbundled Angular)', () => {
|
||||
|
||||
@Component({
|
||||
selector: 'my-comp',
|
||||
template: '<ng-content></ng-content><ng-content select="child"></ng-content>'
|
||||
template:
|
||||
'<ng-content select="child1"></ng-content>' +
|
||||
'<ng-content></ng-content>' +
|
||||
'<ng-template><ng-content select="child2"></ng-content></ng-template>' +
|
||||
'<ng-content select="child3"></ng-content>' +
|
||||
'<ng-content select="child1"></ng-content>'
|
||||
})
|
||||
export class MyComp {
|
||||
@Input('aInputName')
|
||||
@ -449,8 +454,8 @@ describe('compiler (unbundled Angular)', () => {
|
||||
expect(createComponentFactoryCall).toContain(`{aInputProp:'aInputName'}`);
|
||||
// outputs
|
||||
expect(createComponentFactoryCall).toContain(`{aOutputProp:'aOutputName'}`);
|
||||
// ngContentSelectors
|
||||
expect(createComponentFactoryCall).toContain(`['*','child']`);
|
||||
// ngContentSelectors - note that the catch-all doesn't have to appear at the start
|
||||
expect(createComponentFactoryCall).toContain(`['child1','*','child2','child3','child1']`);
|
||||
});
|
||||
});
|
||||
|
||||
|
Reference in New Issue
Block a user