fix(compiler): project using the right directive as component.
Closes #8344
This commit is contained in:
@ -1027,6 +1027,14 @@ There is no directive with "exportAs" set to "dirA" ("<div [ERROR ->]#a="dirA"><
|
||||
})
|
||||
}
|
||||
|
||||
function createDir(selector: string): CompileDirectiveMetadata {
|
||||
return CompileDirectiveMetadata.create({
|
||||
selector: selector,
|
||||
type:
|
||||
new CompileTypeMetadata({moduleUrl: someModuleUrl, name: `SomeDir${compCounter++}`})
|
||||
})
|
||||
}
|
||||
|
||||
describe('project text nodes', () => {
|
||||
it('should project text nodes with wildcard selector', () => {
|
||||
expect(humanizeContentProjection(parse('<div>hello</div>', [createComp('div', ['*'])])))
|
||||
@ -1140,6 +1148,12 @@ There is no directive with "exportAs" set to "dirA" ("<div [ERROR ->]#a="dirA"><
|
||||
.toEqual([['div', null], ['template', 1], ['a', null]]);
|
||||
});
|
||||
});
|
||||
|
||||
it('should support other directives before the component', () => {
|
||||
expect(humanizeContentProjection(
|
||||
parse('<div>hello</div>', [createDir('div'), createComp('div', ['*'])])))
|
||||
.toEqual([['div', null], ['#text(hello)', 0]]);
|
||||
});
|
||||
});
|
||||
|
||||
describe('splitClasses', () => {
|
||||
|
Reference in New Issue
Block a user