From 8f0265c11b5f7ca02ed333e26feb219d23f4ce46 Mon Sep 17 00:00:00 2001 From: Jeremy Elbourn Date: Tue, 8 Nov 2016 18:40:27 -0800 Subject: [PATCH] chore(button): use disabled property, not attr (#1782) --- src/lib/button/button.spec.ts | 10 ++++++++++ src/lib/button/button.ts | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/lib/button/button.spec.ts b/src/lib/button/button.spec.ts index 0144fcf7843..901643347a9 100644 --- a/src/lib/button/button.spec.ts +++ b/src/lib/button/button.spec.ts @@ -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 diff --git a/src/lib/button/button.ts b/src/lib/button/button.ts index ef280cbc4af..3ea49d04bf7 100644 --- a/src/lib/button/button.ts +++ b/src/lib/button/button.ts @@ -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()',