File tree Expand file tree Collapse file tree 2 files changed +20
-2
lines changed Expand file tree Collapse file tree 2 files changed +20
-2
lines changed Original file line number Diff line number Diff line change @@ -127,6 +127,24 @@ describe('MdButton', () => {
127127 fixture . detectChanges ( ) ;
128128 expect ( buttonDebugElement . nativeElement . getAttribute ( 'aria-disabled' ) ) . toBe ( 'true' ) ;
129129 } ) ;
130+
131+ it ( 'should not add aria-disabled attribute if disabled is false' , ( ) => {
132+ let fixture = TestBed . createComponent ( TestApp ) ;
133+ let testComponent = fixture . debugElement . componentInstance ;
134+ let buttonDebugElement = fixture . debugElement . query ( By . css ( 'a' ) ) ;
135+ fixture . detectChanges ( ) ;
136+ expect ( buttonDebugElement . nativeElement . getAttribute ( 'aria-disabled' ) )
137+ . toBe ( 'false' , 'Expect aria-disabled="false"' ) ;
138+ expect ( buttonDebugElement . nativeElement . getAttribute ( 'disabled' ) )
139+ . toBeNull ( 'Expect disabled="false"' ) ;
140+
141+ testComponent . isDisabled = false ;
142+ fixture . detectChanges ( ) ;
143+ expect ( buttonDebugElement . nativeElement . getAttribute ( 'aria-disabled' ) )
144+ . toBe ( 'false' , 'Expect no aria-disabled' ) ;
145+ expect ( buttonDebugElement . nativeElement . getAttribute ( 'disabled' ) )
146+ . toBeNull ( 'Expect no disabled' ) ;
147+ } ) ;
130148 } ) ;
131149
132150 // Ripple tests.
Original file line number Diff line number Diff line change @@ -43,15 +43,15 @@ export class MdButton {
4343
4444 /** Whether the ripple effect on click should be disabled. */
4545 private _disableRipple : boolean = false ;
46- private _disabled : boolean = false ;
46+ private _disabled : boolean = null ;
4747
4848 @Input ( )
4949 get disableRipple ( ) { return this . _disableRipple ; }
5050 set disableRipple ( v ) { this . _disableRipple = coerceBooleanProperty ( v ) ; }
5151
5252 @Input ( )
5353 get disabled ( ) { return this . _disabled ; }
54- set disabled ( value : boolean ) { this . _disabled = coerceBooleanProperty ( value ) ; }
54+ set disabled ( value : boolean ) { this . _disabled = coerceBooleanProperty ( value ) ? true : null ; }
5555
5656 constructor ( private _elementRef : ElementRef , private _renderer : Renderer ) { }
5757
You can’t perform that action at this time.
0 commit comments