tests(ProtoViewBuilder): host properties binding to unknown props

When binding a host property, we shouldn't try to bind to any
directive properties that might exist on a host element

Closes #3383
This commit is contained in:
Pawel Kozlowski
2015-07-30 11:46:52 +02:00
committed by Tobias Bosch
parent f8fa47e939
commit 2768158eaf
2 changed files with 19 additions and 4 deletions
@@ -44,6 +44,15 @@ export function main() {
expect(() => builder.build(new DomElementSchemaRegistry())).not.toThrow();
});
it('should throw for unknown host properties even if another directive uses it', () => {
var binder = builder.bindElement(el('<div/>'));
binder.bindDirective(0).bindProperty('someDirProperty', emptyExpr(), 'someDirProperty');
binder.bindDirective(1).bindHostProperty('someDirProperty', emptyExpr());
expect(() => builder.build(new DomElementSchemaRegistry()))
.toThrowError(
`Can't bind to 'someDirProperty' since it isn't a known property of the '<div>' element`);
});
it('should allow unknown properties on custom elements', () => {
var binder = builder.bindElement(el('<some-custom/>'));
binder.bindProperty('unknownProperty', emptyExpr());