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

fix(progress-circular): removed dependency on ng-hide class #7460

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 12 additions & 13 deletions src/components/progressCircular/js/progressCircularDirective.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ function MdProgressCircularDirective($$rAF, $window, $mdProgressCircular, $mdUti
}
};

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

if (mode !== MODE_DETERMINATE && mode !== MODE_INDETERMINATE) {
cleanupIndeterminateAnimation();
element.addClass('ng-hide');
} else {
element.removeClass('ng-hide');
mode = MODE_INDETERMINATE;
attrs.$set('mdMode', mode);
}

if (mode === MODE_INDETERMINATE) {
startIndeterminateAnimation();
} else {
var newValue = clamp(newValues[0]);
if (mode === MODE_INDETERMINATE) {
startIndeterminateAnimation();
} else {
var newValue = clamp(newValues[0]);

cleanupIndeterminateAnimation();
element.attr('aria-valuenow', newValue);
renderCircle(clamp(oldValues[0]), newValue);
}
cleanupIndeterminateAnimation();
element.attr('aria-valuenow', newValue);
renderCircle(clamp(oldValues[0]), newValue);
}

});

// This is in a separate watch in order to avoid layout, unless
Expand Down
11 changes: 11 additions & 0 deletions src/components/progressCircular/progress-circular.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,17 @@ describe('mdProgressCircular', function() {
expect(progress.attr('md-mode')).toEqual('indeterminate');
});

it('should auto-set the md-mode to "indeterminate" if specified not as "indeterminate" or "determinate"', function() {
var progress = buildIndicator('<md-progress-circular md-mode="test"></md-progress-circular>');

$rootScope.$apply(function() {
$rootScope.progress = 50;
$rootScope.mode = "";
});

expect(progress.attr('md-mode')).toEqual('indeterminate');
});

it('should trim the md-mode value', function() {
var progress = buildIndicator('<md-progress-circular md-mode=" indeterminate"></md-progress-circular>');

Expand Down