@@ -1188,7 +1188,7 @@ describe('MatMdcInput with forms', () => {
1188
1188
1189
1189
describe ( 'custom error behavior' , ( ) => {
1190
1190
it ( 'should display an error message when a custom error matcher returns true' , fakeAsync ( ( ) => {
1191
- let fixture = createComponent ( MatInputWithCustomErrorStateMatcher ) ;
1191
+ let fixture = createComponent ( InputInFormGroup ) ;
1192
1192
fixture . detectChanges ( ) ;
1193
1193
1194
1194
let component = fixture . componentInstance ;
@@ -1356,6 +1356,18 @@ describe('MatMdcInput with forms', () => {
1356
1356
1357
1357
expect ( notch . style . width ) . toBeTruthy ( ) ;
1358
1358
} ) ) ;
1359
+
1360
+ it ( 'should mark the form field as disabled when a group is disabled with emitEvent: false' , fakeAsync ( ( ) => {
1361
+ const fixture = createComponent ( InputInFormGroup ) ;
1362
+ fixture . detectChanges ( ) ;
1363
+
1364
+ const mdcTextField = fixture . nativeElement . querySelector ( '.mdc-text-field' ) ;
1365
+ expect ( mdcTextField . classList ) . not . toContain ( 'mdc-text-field--disabled' ) ;
1366
+
1367
+ fixture . componentInstance . formGroup . disable ( { emitEvent : false } ) ;
1368
+ fixture . detectChanges ( ) ;
1369
+ expect ( mdcTextField . classList ) . toContain ( 'mdc-text-field--disabled' ) ;
1370
+ } ) ) ;
1359
1371
} ) ;
1360
1372
1361
1373
describe ( 'MatFormField default options' , ( ) => {
@@ -1793,7 +1805,7 @@ class MatInputWithFormErrorMessages {
1793
1805
</form>
1794
1806
` ,
1795
1807
} )
1796
- class MatInputWithCustomErrorStateMatcher {
1808
+ class InputInFormGroup {
1797
1809
formGroup = new FormGroup ( {
1798
1810
name : new FormControl ( '' , [ Validators . required , Validators . pattern ( / v a l i d v a l u e / ) ] ) ,
1799
1811
} ) ;
0 commit comments