fix(TemplateParser): match element and attributes regardless the namespace

This commit is contained in:
Victor Berchet
2015-12-09 09:32:15 -08:00
parent 778677ba75
commit 7c13372721
5 changed files with 37 additions and 15 deletions

View File

@ -908,6 +908,24 @@ Property binding a not used by any directive on an embedded template ("[ERROR ->
]);
});
it('should support directive in namespace', () => {
var tagSel = CompileDirectiveMetadata.create(
{selector: 'circle', type: new CompileTypeMetadata({name: 'elDir'})});
var attrSel = CompileDirectiveMetadata.create(
{selector: '[href]', type: new CompileTypeMetadata({name: 'attrDir'})});
expect(humanizeTplAstSourceSpans(
parse('<svg><circle /><use xlink:href="Port" /></svg>', [tagSel, attrSel])))
.toEqual([
[ElementAst, '@svg:svg', '<svg>'],
[ElementAst, '@svg:circle', '<circle />'],
[DirectiveAst, tagSel, '<circle />'],
[ElementAst, '@svg:use', '<use xlink:href="Port" />'],
[AttrAst, '@xlink:href', 'Port', 'xlink:href="Port"'],
[DirectiveAst, attrSel, '<use xlink:href="Port" />'],
]);
});
it('should support directive property', () => {
var dirA = CompileDirectiveMetadata.create(
{selector: 'div', type: new CompileTypeMetadata({name: 'DirA'}), inputs: ['aProp']});