chore(material): add unit tests for MdButton.

This commit is contained in:
Jeremy Elbourn
2015-08-24 17:24:01 -07:00
parent d2458866c1
commit bfbce542e6
9 changed files with 191 additions and 5 deletions

View File

@ -1,2 +1 @@
<style>@import "package:angular2_material/src/components/button/button.css";</style>
<span class="md-button-wrapper"><ng-content></ng-content></span>

View File

@ -3,6 +3,7 @@ import {Component, View, LifecycleEvent, ViewEncapsulation, OnChanges} from 'ang
import {TimerWrapper} from 'angular2/src/core/facade/async';
import {isPresent} from 'angular2/src/core/facade/lang';
// TODO(jelbourn): Ink ripples.
// TODO(jelbourn): Make the `isMosueDown` stuff done with one global listener.
@ -17,6 +18,7 @@ import {isPresent} from 'angular2/src/core/facade/lang';
})
@View({
templateUrl: 'package:angular2_material/src/components/button/button.html',
styleUrls: ['package:angular2_material/src/components/button/button.css'],
encapsulation: ViewEncapsulation.None,
})
export class MdButton {
@ -55,7 +57,7 @@ export class MdButton {
'(blur)': 'onBlur()',
'[tabIndex]': 'tabIndex',
'[class.md-button-focus]': 'isKeyboardFocused',
'[attr.aria-disabled]': 'disabled',
'[attr.aria-disabled]': 'isAriaDisabled',
},
})
@View({
@ -64,8 +66,6 @@ export class MdButton {
})
export class MdAnchor extends MdButton implements OnChanges {
tabIndex: number;
/** Whether the component is disabled. */
disabled_: boolean;
get disabled(): boolean {
@ -89,4 +89,9 @@ export class MdAnchor extends MdButton implements OnChanges {
// A disabled anchor should not be in the tab flow.
this.tabIndex = this.disabled ? -1 : 0;
}
/** Gets the aria-disabled value for the component, which must be a string for Dart. */
get isAriaDisabled(): string {
return this.disabled ? 'true' : 'false';
}
}