fix(compiler): project using the right directive as component.

Closes #8344
This commit is contained in:
Tobias Bosch
2016-04-29 17:07:28 -07:00
parent 351f24e8eb
commit 0f774df811
7 changed files with 41 additions and 19 deletions

View File

@ -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', () => {