-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Commit
add unit tests Closes #1074.
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -59,11 +59,9 @@ function MdButtonDirective($mdInkRipple, $mdTheming, $mdAria) { | |
} | ||
|
||
function getTemplate(element, attr) { | ||
if (isAnchor(attr)) { | ||
return '<a class="md-button" ng-transclude></a>'; | ||
} else { | ||
return '<button class="md-button" ng-transclude></button>'; | ||
} | ||
return isAnchor(attr) ? | ||
'<a class="md-button" ng-transclude></a>' : | ||
'<button class="md-button" ng-transclude></button>'; | ||
} | ||
|
||
function postLink(scope, element, attr) { | ||
|
@@ -78,8 +76,8 @@ function MdButtonDirective($mdInkRipple, $mdTheming, $mdAria) { | |
|
||
// For anchor elements, we have to set tabindex manually when the | ||
// element is disabled | ||
if (isAnchor(attr)) { | ||
scope.$watch(function() {return attr.ngDisabled;}, function(isDisabled) { | ||
if (isAnchor(attr) && angular.isDefined(attr.ngDisabled) ) { | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
ThomasBurleson
Author
Contributor
|
||
scope.$watch(attr.ngDisabled, function(isDisabled) { | ||
element.attr('tabindex', isDisabled ? -1 : 0); | ||
}); | ||
} | ||
|
Not sure if this is an issue, but previously the watcher would run at least once and set
tabindex
to0
(ifngDisabled
wasn't present). With the modification, it will not set thetabindex
at all ifngDisabled
is not present.(Not sure if this is an issue though, or if it is taken care of somewhere else. Maybe @marcysutton has some insight ?)