@@ -1450,32 +1450,47 @@ describe('MatInput with appearance', () => {
1450
1450
} ) ;
1451
1451
1452
1452
describe ( 'MatFormField default options' , ( ) => {
1453
- it ( 'should be legacy appearance if no default options provided' , fakeAsync ( ( ) => {
1453
+ it ( 'should be legacy appearance if no default options provided' , ( ) => {
1454
1454
const fixture = createComponent ( MatInputWithAppearance ) ;
1455
1455
fixture . detectChanges ( ) ;
1456
- flush ( ) ;
1457
1456
expect ( fixture . componentInstance . formField . appearance ) . toBe ( 'legacy' ) ;
1458
- } ) ) ;
1457
+ } ) ;
1459
1458
1460
- it ( 'should be legacy appearance if empty default options provided' , fakeAsync ( ( ) => {
1459
+ it ( 'should be legacy appearance if empty default options provided' , ( ) => {
1461
1460
const fixture = createComponent ( MatInputWithAppearance , [ {
1462
1461
provide : MAT_FORM_FIELD_DEFAULT_OPTIONS , useValue : { } }
1463
1462
] ) ;
1464
1463
1465
1464
fixture . detectChanges ( ) ;
1466
- flush ( ) ;
1467
1465
expect ( fixture . componentInstance . formField . appearance ) . toBe ( 'legacy' ) ;
1468
- } ) ) ;
1466
+ } ) ;
1467
+
1468
+ it ( 'should be able to change the default appearance' , ( ) => {
1469
+ const fixture = createComponent ( MatInputWithAppearance , [ {
1470
+ provide : MAT_FORM_FIELD_DEFAULT_OPTIONS , useValue : { appearance : 'fill' } }
1471
+ ] ) ;
1472
+ fixture . detectChanges ( ) ;
1473
+ expect ( fixture . componentInstance . formField . appearance ) . toBe ( 'fill' ) ;
1474
+ } ) ;
1475
+
1476
+ it ( 'should default hideRequiredMarker to false' , ( ) => {
1477
+ const fixture = createComponent ( MatInputWithAppearance , [ {
1478
+ provide : MAT_FORM_FIELD_DEFAULT_OPTIONS , useValue : { } }
1479
+ ] ) ;
1480
+
1481
+ fixture . detectChanges ( ) ;
1482
+ expect ( fixture . componentInstance . formField . hideRequiredMarker ) . toBe ( false ) ;
1483
+ } ) ;
1484
+
1485
+ it ( 'should be able to change the default value of hideRequiredMarker' , ( ) => {
1486
+ const fixture = createComponent ( MatInputWithAppearance , [ {
1487
+ provide : MAT_FORM_FIELD_DEFAULT_OPTIONS , useValue : { hideRequiredMarker : true } }
1488
+ ] ) ;
1489
+
1490
+ fixture . detectChanges ( ) ;
1491
+ expect ( fixture . componentInstance . formField . hideRequiredMarker ) . toBe ( true ) ;
1492
+ } ) ;
1469
1493
1470
- it ( 'should be custom default appearance if custom appearance specified in default options' ,
1471
- fakeAsync ( ( ) => {
1472
- const fixture = createComponent ( MatInputWithAppearance , [ {
1473
- provide : MAT_FORM_FIELD_DEFAULT_OPTIONS , useValue : { appearance : 'fill' } }
1474
- ] ) ;
1475
- fixture . detectChanges ( ) ;
1476
- flush ( ) ;
1477
- expect ( fixture . componentInstance . formField . appearance ) . toBe ( 'fill' ) ;
1478
- } ) ) ;
1479
1494
} ) ;
1480
1495
1481
1496
describe ( 'MatInput with textarea autosize' , ( ) => {
0 commit comments