Skip to content

Commit 8f0265c

Browse files
authored
chore(button): use disabled property, not attr (#1782)
1 parent 6b9e11c commit 8f0265c

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

src/lib/button/button.spec.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,16 @@ describe('MdButton', () => {
8080
expect(testComponent.clickCount).toBe(0);
8181
});
8282

83+
it('should disable the native button element', () => {
84+
let fixture = TestBed.createComponent(TestApp);
85+
let buttonNativeElement = fixture.nativeElement.querySelector('button');
86+
expect(buttonNativeElement.disabled).toBeFalsy('Expected button not to be disabled');
87+
88+
fixture.componentInstance.isDisabled = true;
89+
fixture.detectChanges();
90+
expect(buttonNativeElement.disabled).toBeTruthy('Expected button to be disabled');
91+
});
92+
8393
});
8494

8595
// Anchor button tests

src/lib/button/button.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import {MdRippleModule, coerceBooleanProperty} from '../core';
2121
selector: 'button[md-button], button[md-raised-button], button[md-icon-button], ' +
2222
'button[md-fab], button[md-mini-fab]',
2323
host: {
24-
'[attr.disabled]': 'disabled',
24+
'[disabled]': 'disabled',
2525
'[class.md-button-focus]': '_isKeyboardFocused',
2626
'(mousedown)': '_setMousedown()',
2727
'(focus)': '_setKeyboardFocus()',

0 commit comments

Comments
 (0)