File tree Expand file tree Collapse file tree 2 files changed +22
-3
lines changed
src/material-experimental Expand file tree Collapse file tree 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';
9191/** Default appearance used by the form-field. */
9292const DEFAULT_FLOAT_LABEL : FloatLabelType = 'auto' ;
9393
94- /** Default way that the suffix element height is set. */
94+ /** Default way that the subscript element height is set. */
9595const DEFAULT_SUBSCRIPT_SIZING : SubscriptSizing = 'fixed' ;
9696
9797/**
@@ -225,7 +225,7 @@ export class MatFormField
225225 set subscriptSizing ( value : SubscriptSizing ) {
226226 this . _subscriptSizing = value || this . _defaults ?. subscriptSizing || DEFAULT_SUBSCRIPT_SIZING ;
227227 }
228- private _subscriptSizing : SubscriptSizing = DEFAULT_SUBSCRIPT_SIZING ;
228+ private _subscriptSizing : SubscriptSizing | null = null ;
229229
230230 /** Text for the form field hint. */
231231 @Input ( )
Original file line number Diff line number Diff line change @@ -1430,7 +1430,7 @@ describe('MatFormField default options', () => {
14301430 ) ;
14311431 } ) ;
14321432
1433- it ( 'changes the default value of subscriptSizing' , ( ) => {
1433+ it ( 'changes the default value of subscriptSizing (undefined input) ' , ( ) => {
14341434 const fixture = createComponent ( MatInputWithSubscriptSizing , [
14351435 {
14361436 provide : MAT_FORM_FIELD_DEFAULT_OPTIONS ,
@@ -1448,6 +1448,25 @@ describe('MatFormField default options', () => {
14481448 . classList . contains ( 'mat-mdc-form-field-subscript-dynamic-size' ) ,
14491449 ) . toBe ( true ) ;
14501450 } ) ;
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+ } ) ;
14511470} ) ;
14521471
14531472function configureTestingModule (
You can’t perform that action at this time.
0 commit comments