Skip to content
This repository was archived by the owner on Sep 5, 2024. It is now read-only.

Commit a56591d

Browse files
EladBezalelThomasBurleson
authored andcommitted
fix(progress-circular): removed dependency on ng-hide class
- If the progress mode wasn't indeterminate or determinate it would use `ng-hide` class to hide it, and if it's a valid mode, `ng-hide` was removed, what caused `ng-hide` not to preform as wanted. Now when mode is not indeterminate or determinate set it default to indeterminate fixes #7454 Closes #7460
1 parent cd05828 commit a56591d

File tree

2 files changed

+23
-13
lines changed

2 files changed

+23
-13
lines changed

src/components/progressCircular/js/progressCircularDirective.js

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ function MdProgressCircularDirective($$rAF, $window, $mdProgressCircular, $mdUti
9191
}
9292
};
9393

94-
function MdProgressCircularLink(scope, element) {
94+
function MdProgressCircularLink(scope, element, attrs) {
9595
var svg = angular.element(element[0].querySelector('svg'));
9696
var path = angular.element(element[0].querySelector('path'));
9797
var startIndeterminate = $mdProgressCircular.startIndeterminate;
@@ -104,21 +104,20 @@ function MdProgressCircularDirective($$rAF, $window, $mdProgressCircular, $mdUti
104104
var mode = newValues[1];
105105

106106
if (mode !== MODE_DETERMINATE && mode !== MODE_INDETERMINATE) {
107-
cleanupIndeterminateAnimation();
108-
element.addClass('ng-hide');
109-
} else {
110-
element.removeClass('ng-hide');
107+
mode = MODE_INDETERMINATE;
108+
attrs.$set('mdMode', mode);
109+
}
111110

112-
if (mode === MODE_INDETERMINATE) {
113-
startIndeterminateAnimation();
114-
} else {
115-
var newValue = clamp(newValues[0]);
111+
if (mode === MODE_INDETERMINATE) {
112+
startIndeterminateAnimation();
113+
} else {
114+
var newValue = clamp(newValues[0]);
116115

117-
cleanupIndeterminateAnimation();
118-
element.attr('aria-valuenow', newValue);
119-
renderCircle(clamp(oldValues[0]), newValue);
120-
}
116+
cleanupIndeterminateAnimation();
117+
element.attr('aria-valuenow', newValue);
118+
renderCircle(clamp(oldValues[0]), newValue);
121119
}
120+
122121
});
123122

124123
// This is in a separate watch in order to avoid layout, unless

src/components/progressCircular/progress-circular.spec.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,17 @@ describe('mdProgressCircular', function() {
2525
expect(progress.attr('md-mode')).toEqual('indeterminate');
2626
});
2727

28+
it('should auto-set the md-mode to "indeterminate" if specified not as "indeterminate" or "determinate"', function() {
29+
var progress = buildIndicator('<md-progress-circular md-mode="test"></md-progress-circular>');
30+
31+
$rootScope.$apply(function() {
32+
$rootScope.progress = 50;
33+
$rootScope.mode = "";
34+
});
35+
36+
expect(progress.attr('md-mode')).toEqual('indeterminate');
37+
});
38+
2839
it('should trim the md-mode value', function() {
2940
var progress = buildIndicator('<md-progress-circular md-mode=" indeterminate"></md-progress-circular>');
3041

0 commit comments

Comments
 (0)