@@ -332,22 +332,43 @@ describe('MdInputContainer', function () {
332332 } ) ;
333333
334334 it ( 'supports the disabled attribute as binding' , async ( ( ) => {
335- let fixture = TestBed . createComponent ( MdInputContainerWithDisabled ) ;
335+ const fixture = TestBed . createComponent ( MdInputContainerWithDisabled ) ;
336336 fixture . detectChanges ( ) ;
337337
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 ;
340340
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.` ) ;
342343 expect ( inputEl . disabled ) . toBe ( false ) ;
343344
344345 fixture . componentInstance . disabled = true ;
345346 fixture . detectChanges ( ) ;
346347
348+ expect ( underlineEl . classList . contains ( 'md-disabled' ) )
349+ . toBe ( true , `Expected underline to look disabled after property is set.` ) ;
347350 expect ( inputEl . disabled ) . toBe ( true ) ;
348- expect ( underlineEl . classList . contains ( 'md-disabled' ) ) . toBe ( true , 'should be disabled' ) ;
349351 } ) ) ;
350352
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+
351372 it ( 'supports the required attribute as binding' , async ( ( ) => {
352373 let fixture = TestBed . createComponent ( MdInputContainerWithRequired ) ;
353374 fixture . detectChanges ( ) ;
0 commit comments