fix(compiler): use event names for matching directives

Closes #6870
This commit is contained in:
vsavkin
2016-02-03 11:35:42 -08:00
committed by Brian Ford
parent e725542703
commit 231773ea76
3 changed files with 34 additions and 2 deletions
@@ -448,6 +448,21 @@ function declareTests() {
});
}));
it('should support directives where a selector matches event binding',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
tcb.overrideView(
MyComp,
new ViewMetadata(
{template: '<p (customEvent)="doNothing()"></p>', directives: [EventDir]}))
.createAsync(MyComp)
.then((fixture) => {
var tc = fixture.debugElement.children[0];
expect(tc.inject(EventDir)).not.toBe(null);
async.done();
});
}));
it('should read directives metadata from their binding token',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
tcb.overrideView(MyComp, new ViewMetadata({
@@ -2133,6 +2148,13 @@ class IdDir {
id: string;
}
@Directive({selector: '[customEvent]'})
@Injectable()
class EventDir {
@Output() customEvent = new EventEmitter();
doSomething() {}
}
@Directive({selector: '[static]'})
@Injectable()
class NeedsAttribute {