test(DirectiveResolver): test that a prop can have both `@Input` and `@HostBinding`

This commit is contained in:
Victor Berchet 2016-09-27 16:07:01 -07:00 committed by Chuck Jazdzewski
parent 4fd13d71c8
commit a92b573309
1 changed files with 15 additions and 0 deletions

View File

@ -108,6 +108,15 @@ class SomeDirectiveWithViewChild {
class ComponentWithTemplate { class ComponentWithTemplate {
} }
@Directive({
selector: 'someDirective',
host: {'[decorator]': 'decorator'},
inputs: ['decorator'],
})
class SomeDirectiveWithSameHostBindingAndInput {
@Input() @HostBinding() prop: any;
}
class SomeDirectiveWithoutMetadata {} class SomeDirectiveWithoutMetadata {}
export function main() { export function main() {
@ -190,6 +199,12 @@ export function main() {
expect(directiveMetadata.host).toEqual({'[c]': 'c', '[a]': 'a', '[renamed]': 'b'}); expect(directiveMetadata.host).toEqual({'[c]': 'c', '[a]': 'a', '[renamed]': 'b'});
}); });
it('should append host binding and input on the same property', () => {
const directiveMetadata = resolver.resolve(SomeDirectiveWithSameHostBindingAndInput);
expect(directiveMetadata.host).toEqual({'[decorator]': 'decorator', '[prop]': 'prop'});
expect(directiveMetadata.inputs).toEqual(['decorator', 'prop']);
});
it('should append host listeners', () => { it('should append host listeners', () => {
const directiveMetadata = resolver.resolve(SomeDirectiveWithHostListeners); const directiveMetadata = resolver.resolve(SomeDirectiveWithHostListeners);
expect(directiveMetadata.host) expect(directiveMetadata.host)