feat(Events): allow a different event vs field name

closes #2272
closes #2344
This commit is contained in:
Victor Berchet
2015-06-04 15:09:54 +02:00
parent 79f3f3b456
commit 29c72abcc4
3 changed files with 49 additions and 5 deletions

View File

@ -418,6 +418,18 @@ export function main() {
expect(accessor.getter(new HasEventEmitter())).toEqual('emitter');
});
it('should allow a different event vs field name', () => {
var binding = DirectiveBinding.createFromType(HasEventEmitter,
new dirAnn.Directive({events: ['emitter: publicEmitter']}));
var inj = createPei(null, 0, [binding]);
expect(inj.eventEmitterAccessors.length).toEqual(1);
var accessor = inj.eventEmitterAccessors[0][0];
expect(accessor.eventName).toEqual('publicEmitter');
expect(accessor.getter(new HasEventEmitter())).toEqual('emitter');
});
it('should return a list of hostAction accessors', () => {
var binding = DirectiveBinding.createFromType(
HasEventEmitter, new dirAnn.Directive({hostActions: {'hostActionName': 'onAction'}}));
@ -431,7 +443,6 @@ export function main() {
});
});
describe(".create", () => {
it("should collect hostInjector injectables from all directives", () => {
var pei = createPei(null, 0, [