File tree 2 files changed +22
-3
lines changed
src/material-experimental
2 files changed +22
-3
lines changed Original file line number Diff line number Diff line change @@ -91,7 +91,7 @@ const DEFAULT_APPEARANCE: MatFormFieldAppearance = 'fill';
91
91
/** Default appearance used by the form-field. */
92
92
const DEFAULT_FLOAT_LABEL : FloatLabelType = 'auto' ;
93
93
94
- /** Default way that the suffix element height is set. */
94
+ /** Default way that the subscript element height is set. */
95
95
const DEFAULT_SUBSCRIPT_SIZING : SubscriptSizing = 'fixed' ;
96
96
97
97
/**
@@ -225,7 +225,7 @@ export class MatFormField
225
225
set subscriptSizing ( value : SubscriptSizing ) {
226
226
this . _subscriptSizing = value || this . _defaults ?. subscriptSizing || DEFAULT_SUBSCRIPT_SIZING ;
227
227
}
228
- private _subscriptSizing : SubscriptSizing = DEFAULT_SUBSCRIPT_SIZING ;
228
+ private _subscriptSizing : SubscriptSizing | null = null ;
229
229
230
230
/** Text for the form field hint. */
231
231
@Input ( )
Original file line number Diff line number Diff line change @@ -1430,7 +1430,7 @@ describe('MatFormField default options', () => {
1430
1430
) ;
1431
1431
} ) ;
1432
1432
1433
- it ( 'changes the default value of subscriptSizing' , ( ) => {
1433
+ it ( 'changes the default value of subscriptSizing (undefined input) ' , ( ) => {
1434
1434
const fixture = createComponent ( MatInputWithSubscriptSizing , [
1435
1435
{
1436
1436
provide : MAT_FORM_FIELD_DEFAULT_OPTIONS ,
@@ -1448,6 +1448,25 @@ describe('MatFormField default options', () => {
1448
1448
. classList . contains ( 'mat-mdc-form-field-subscript-dynamic-size' ) ,
1449
1449
) . toBe ( true ) ;
1450
1450
} ) ;
1451
+
1452
+ it ( 'changes the default value of subscriptSizing (no input)' , ( ) => {
1453
+ const fixture = createComponent ( MatInputWithAppearance , [
1454
+ {
1455
+ provide : MAT_FORM_FIELD_DEFAULT_OPTIONS ,
1456
+ useValue : {
1457
+ subscriptSizing : 'dynamic' ,
1458
+ } ,
1459
+ } ,
1460
+ ] ) ;
1461
+
1462
+ fixture . detectChanges ( ) ;
1463
+ expect ( fixture . componentInstance . formField . subscriptSizing ) . toBe ( 'dynamic' ) ;
1464
+ expect (
1465
+ fixture . nativeElement
1466
+ . querySelector ( '.mat-mdc-form-field-subscript-wrapper' )
1467
+ . classList . contains ( 'mat-mdc-form-field-subscript-dynamic-size' ) ,
1468
+ ) . toBe ( true ) ;
1469
+ } ) ;
1451
1470
} ) ;
1452
1471
1453
1472
function configureTestingModule (
You can’t perform that action at this time.
0 commit comments