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', () => {
127
127
fixture . detectChanges ( ) ;
128
128
expect ( buttonDebugElement . nativeElement . getAttribute ( 'aria-disabled' ) ) . toBe ( 'true' ) ;
129
129
} ) ;
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
+ } ) ;
130
148
} ) ;
131
149
132
150
// Ripple tests.
Original file line number Diff line number Diff line change @@ -43,15 +43,15 @@ export class MdButton {
43
43
44
44
/** Whether the ripple effect on click should be disabled. */
45
45
private _disableRipple : boolean = false ;
46
- private _disabled : boolean = false ;
46
+ private _disabled : boolean = null ;
47
47
48
48
@Input ( )
49
49
get disableRipple ( ) { return this . _disableRipple ; }
50
50
set disableRipple ( v ) { this . _disableRipple = coerceBooleanProperty ( v ) ; }
51
51
52
52
@Input ( )
53
53
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 ; }
55
55
56
56
constructor ( private _elementRef : ElementRef , private _renderer : Renderer ) { }
57
57
You can’t perform that action at this time.
0 commit comments