File tree Expand file tree Collapse file tree 2 files changed +10
-2
lines changed
material-experimental/mdc-form-field
material/form-field/testing Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -211,7 +211,15 @@ export class MatFormField
211211 }
212212 set appearance ( value : MatFormFieldAppearance ) {
213213 const oldValue = this . _appearance ;
214- this . _appearance = value || 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 ;
215223 if ( this . _appearance === 'outline' && this . _appearance !== oldValue ) {
216224 this . _refreshOutlineNotchWidth ( ) ;
217225
Original file line number Diff line number Diff line change @@ -266,7 +266,7 @@ export function runHarnessTests(
266266 <span matTextSuffix *ngIf="isMdc">suffix_text</span>
267267 </mat-form-field>
268268
269- <mat-form-field appearance=" standard" color="warn" id="with-errors">
269+ <mat-form-field [ appearance]="isMdc ? 'fill' : ' standard' " color="warn" id="with-errors">
270270 <span class="custom-control">Custom control harness</span>
271271 <input matInput [formControl]="requiredControl">
272272
You can’t perform that action at this time.
0 commit comments