fix(ivy): handling className as an input properly (#33188)

Prior to this commit, all `className` inputs were not set because the runtime code assumed that the `classMap` instruction is only generated for `[class]` bindings. However the `[className]` binding also produces the same `classMap`, thus the code needs to distinguish between `class` and `className`. This commit adds extra logic to select the right input name and also throws an error in case `[class]` and `[className]` bindings are used on the same element simultaneously.

PR Close #33188
This commit is contained in:
Andrew Kushnir
2019-10-04 19:25:18 -07:00
committed by Matias Niemelä
parent 08cb2fa80f
commit 6f203c9575
8 changed files with 91 additions and 6 deletions

View File

@ -201,6 +201,10 @@ export class StylingBuilder {
const entry:
BoundStylingEntry = {name: property, value, sourceSpan, hasOverrideFlag, unit: null};
if (isMapBased) {
if (this._classMapInput) {
throw new Error(
'[class] and [className] bindings cannot be used on the same element simultaneously');
}
this._classMapInput = entry;
} else {
(this._singleClassInputs = this._singleClassInputs || []).push(entry);