From d0dea574cb104cc0b7a11ad9d855a9814dd6e83d Mon Sep 17 00:00:00 2001 From: Victor Berchet Date: Tue, 27 Sep 2016 16:07:01 -0700 Subject: [PATCH] test(DirectiveResolver): test that a prop can have both `@Input` and `@HostBinding` --- .../compiler/test/directive_resolver_spec.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/modules/@angular/compiler/test/directive_resolver_spec.ts b/modules/@angular/compiler/test/directive_resolver_spec.ts index d139eaf841..7e75be9e1d 100644 --- a/modules/@angular/compiler/test/directive_resolver_spec.ts +++ b/modules/@angular/compiler/test/directive_resolver_spec.ts @@ -108,6 +108,15 @@ class SomeDirectiveWithViewChild { class ComponentWithTemplate { } +@Directive({ + selector: 'someDirective', + host: {'[decorator]': 'decorator'}, + inputs: ['decorator'], +}) +class SomeDirectiveWithSameHostBindingAndInput { + @Input() @HostBinding() prop: any; +} + class SomeDirectiveWithoutMetadata {} export function main() { @@ -190,6 +199,12 @@ export function main() { 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', () => { const directiveMetadata = resolver.resolve(SomeDirectiveWithHostListeners); expect(directiveMetadata.host)