chore(button): use disabled property, not attr (#1782)

This commit is contained in:
Jeremy Elbourn
2016-11-08 18:40:27 -08:00
committed by GitHub
parent 6b9e11cfd7
commit 8f0265c11b
2 changed files with 11 additions and 1 deletions
+10
View File
@@ -80,6 +80,16 @@ describe('MdButton', () => {
expect(testComponent.clickCount).toBe(0);
});
it('should disable the native button element', () => {
let fixture = TestBed.createComponent(TestApp);
let buttonNativeElement = fixture.nativeElement.querySelector('button');
expect(buttonNativeElement.disabled).toBeFalsy('Expected button not to be disabled');
fixture.componentInstance.isDisabled = true;
fixture.detectChanges();
expect(buttonNativeElement.disabled).toBeTruthy('Expected button to be disabled');
});
});
// Anchor button tests
+1 -1
View File
@@ -21,7 +21,7 @@ import {MdRippleModule, coerceBooleanProperty} from '../core';
selector: 'button[md-button], button[md-raised-button], button[md-icon-button], ' +
'button[md-fab], button[md-mini-fab]',
host: {
'[attr.disabled]': 'disabled',
'[disabled]': 'disabled',
'[class.md-button-focus]': '_isKeyboardFocused',
'(mousedown)': '_setMousedown()',
'(focus)': '_setKeyboardFocus()',