fix(ivy): throw on bindings to unknown properties (#28537)

This commit adds a devMode-only check which will throw if a user
attempts to bind a property that does not match a directive
input or a known HTML property.

Example:
```
<div [unknownProp]="someValue"></div>
```

The above will throw because "unknownProp" is not a known
property of HTMLDivElement.

This check is similar to the check executed in View Engine during
template parsing, but occurs at runtime instead of compile-time.

Note: This change uncovered an existing bug with host binding
inheritance, so some Material tests had to be turned off. They
will be fixed in an upcoming PR.

PR Close #28537
This commit is contained in:
Kara Erickson
2019-02-04 21:42:55 -08:00
committed by Miško Hevery
parent 7660d0d74a
commit 1950e2d9ba
13 changed files with 262 additions and 160 deletions

View File

@ -953,6 +953,58 @@ window.testBlocklist = {
"error": "Error: Expected undefined to be truthy.",
"notes": "Unknown"
},
"MatButton should apply class based on color attribute": {
"error": "Template error: Can't bind to 'disabled' since it isn't a known property of 'a'",
"notes": "FW-1037: Host bindings for host objects in metadata are inherited"
},
"MatButton should not clear previous defined classes": {
"error": "Template error: Can't bind to 'disabled' since it isn't a known property of 'a'",
"notes": "FW-1037: Host bindings for host objects in metadata are inherited"
},
"MatButton button[mat-fab] should have accent palette by default": {
"error": "Template error: Can't bind to 'disabled' since it isn't a known property of 'a'",
"notes": "FW-1037: Host bindings for host objects in metadata are inherited"
},
"MatButton button[mat-mini-fab] should have accent palette by default": {
"error": "Template error: Can't bind to 'disabled' since it isn't a known property of 'a'",
"notes": "FW-1037: Host bindings for host objects in metadata are inherited"
},
"MatButton button[mat-button] should not increment if disabled": {
"error": "Template error: Can't bind to 'disabled' since it isn't a known property of 'a'",
"notes": "FW-1037: Host bindings for host objects in metadata are inherited"
},
"MatButton button[mat-button] should disable the native button element": {
"error": "Template error: Can't bind to 'disabled' since it isn't a known property of 'a'",
"notes": "FW-1037: Host bindings for host objects in metadata are inherited"
},
"MatButton a[mat-button] should not redirect if disabled": {
"error": "Template error: Can't bind to 'disabled' since it isn't a known property of 'a'",
"notes": "FW-1037: Host bindings for host objects in metadata are inherited"
},
"MatButton a[mat-button] should remove tabindex if disabled": {
"error": "Template error: Can't bind to 'disabled' since it isn't a known property of 'a'",
"notes": "FW-1037: Host bindings for host objects in metadata are inherited"
},
"MatButton a[mat-button] should add aria-disabled attribute if disabled": {
"error": "Template error: Can't bind to 'disabled' since it isn't a known property of 'a'",
"notes": "FW-1037: Host bindings for host objects in metadata are inherited"
},
"MatButton a[mat-button] should not add aria-disabled attribute if disabled is false": {
"error": "Template error: Can't bind to 'disabled' since it isn't a known property of 'a'",
"notes": "FW-1037: Host bindings for host objects in metadata are inherited"
},
"MatButton a[mat-button] should be able to set a custom tabindex": {
"error": "Template error: Can't bind to 'disabled' since it isn't a known property of 'a'",
"notes": "FW-1037: Host bindings for host objects in metadata are inherited"
},
"MatButton button ripples should disable the ripple if matRippleDisabled input is set": {
"error": "Template error: Can't bind to 'disabled' since it isn't a known property of 'a'",
"notes": "FW-1037: Host bindings for host objects in metadata are inherited"
},
"MatButton button ripples should disable the ripple when the button is disabled": {
"error": "Template error: Can't bind to 'disabled' since it isn't a known property of 'a'",
"notes": "FW-1037: Host bindings for host objects in metadata are inherited"
},
"MatTabHeader focusing should initialize to the selected index": {
"error": "TypeError: Cannot read property 'nativeElement' of undefined",
"notes": "FW-1019: Design new API to replace static queries"