@@ -332,22 +332,43 @@ describe('MdInputContainer', function () {
332
332
} ) ;
333
333
334
334
it ( 'supports the disabled attribute as binding' , async ( ( ) => {
335
- let fixture = TestBed . createComponent ( MdInputContainerWithDisabled ) ;
335
+ const fixture = TestBed . createComponent ( MdInputContainerWithDisabled ) ;
336
336
fixture . detectChanges ( ) ;
337
337
338
- let underlineEl = fixture . debugElement . query ( By . css ( '.md-input-underline' ) ) . nativeElement ;
339
- let inputEl = fixture . debugElement . query ( By . css ( 'input' ) ) . nativeElement ;
338
+ const underlineEl = fixture . debugElement . query ( By . css ( '.md-input-underline' ) ) . nativeElement ;
339
+ const inputEl = fixture . debugElement . query ( By . css ( 'input' ) ) . nativeElement ;
340
340
341
- expect ( underlineEl . classList . contains ( 'md-disabled' ) ) . toBe ( false , 'should not be disabled' ) ;
341
+ expect ( underlineEl . classList . contains ( 'md-disabled' ) )
342
+ . toBe ( false , `Expected underline not to start out disabled.` ) ;
342
343
expect ( inputEl . disabled ) . toBe ( false ) ;
343
344
344
345
fixture . componentInstance . disabled = true ;
345
346
fixture . detectChanges ( ) ;
346
347
348
+ expect ( underlineEl . classList . contains ( 'md-disabled' ) )
349
+ . toBe ( true , `Expected underline to look disabled after property is set.` ) ;
347
350
expect ( inputEl . disabled ) . toBe ( true ) ;
348
- expect ( underlineEl . classList . contains ( 'md-disabled' ) ) . toBe ( true , 'should be disabled' ) ;
349
351
} ) ) ;
350
352
353
+ it ( 'should display disabled styles when using FormControl.disable()' , ( ) => {
354
+ const fixture = TestBed . createComponent ( MdInputContainerWithFormControl ) ;
355
+ fixture . detectChanges ( ) ;
356
+
357
+ const underlineEl = fixture . debugElement . query ( By . css ( '.md-input-underline' ) ) . nativeElement ;
358
+ const inputEl = fixture . debugElement . query ( By . css ( 'input' ) ) . nativeElement ;
359
+
360
+ expect ( underlineEl . classList )
361
+ . not . toContain ( 'md-disabled' , `Expected underline not to start out disabled.` ) ;
362
+ expect ( inputEl . disabled ) . toBe ( false ) ;
363
+
364
+ fixture . componentInstance . formControl . disable ( ) ;
365
+ fixture . detectChanges ( ) ;
366
+
367
+ expect ( underlineEl . classList )
368
+ . toContain ( 'md-disabled' , `Expected underline to look disabled after disable() is called.` ) ;
369
+ expect ( inputEl . disabled ) . toBe ( true ) ;
370
+ } ) ;
371
+
351
372
it ( 'supports the required attribute as binding' , async ( ( ) => {
352
373
let fixture = TestBed . createComponent ( MdInputContainerWithRequired ) ;
353
374
fixture . detectChanges ( ) ;
0 commit comments