File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed
src/material-experimental/mdc-form-field Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -211,9 +211,15 @@ export class MatFormField
211
211
}
212
212
set appearance ( value : MatFormFieldAppearance ) {
213
213
const oldValue = this . _appearance ;
214
- this . _appearance = [ 'fill' , 'outline' ] . includes ( value )
215
- ? value
216
- : this . _defaults ?. appearance || DEFAULT_APPEARANCE ;
214
+ const newAppearance = value || this . _defaults ?. appearance || DEFAULT_APPEARANCE ;
215
+ if ( typeof ngDevMode === 'undefined' || ngDevMode ) {
216
+ if ( newAppearance !== 'fill' && newAppearance !== 'outline' ) {
217
+ throw new Error (
218
+ `MatFormField: Invalid appearance "${ newAppearance } ", valid values are "fill" or "outline".` ,
219
+ ) ;
220
+ }
221
+ }
222
+ this . _appearance = newAppearance ;
217
223
if ( this . _appearance === 'outline' && this . _appearance !== oldValue ) {
218
224
this . _refreshOutlineNotchWidth ( ) ;
219
225
You can’t perform that action at this time.
0 commit comments