File tree Expand file tree Collapse file tree 2 files changed +10
-2
lines changed
material/form-field/testing
material-experimental/mdc-form-field 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
211
211
}
212
212
set appearance ( value : MatFormFieldAppearance ) {
213
213
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 ;
215
223
if ( this . _appearance === 'outline' && this . _appearance !== oldValue ) {
216
224
this . _refreshOutlineNotchWidth ( ) ;
217
225
Original file line number Diff line number Diff line change @@ -266,7 +266,7 @@ export function runHarnessTests(
266
266
<span matTextSuffix *ngIf="isMdc">suffix_text</span>
267
267
</mat-form-field>
268
268
269
- <mat-form-field appearance=" standard" color="warn" id="with-errors">
269
+ <mat-form-field [ appearance]="isMdc ? 'fill' : ' standard' " color="warn" id="with-errors">
270
270
<span class="custom-control">Custom control harness</span>
271
271
<input matInput [formControl]="requiredControl">
272
272
You can’t perform that action at this time.
0 commit comments