Skip to content

Commit

Permalink
feat(refresher): allow spinner to be none. closes #2926
Browse files Browse the repository at this point in the history
  • Loading branch information
perrygovier committed Feb 9, 2015
1 parent e8a70f3 commit 4afc767
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
4 changes: 3 additions & 1 deletion js/angular/controller/refresherController.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ IonicModule
$attrs.$set('pullingIcon', 'ion-android-arrow-down');
}

$scope.showSpinner = !isDefined($attrs.refreshingIcon);
$scope.showSpinner = !isDefined($attrs.refreshingIcon) && $attrs.spinner != 'none';

$scope.showIcon = isDefined($attrs.refreshingIcon);

$ionicBind($scope, $attrs, {
pullingIcon: '@',
Expand Down
5 changes: 3 additions & 2 deletions js/angular/directive/refresher.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@
* Default: 'ion-android-arrow-down'.
* @param {string=} spinner The {@link ionic.directive:ionSpinner} icon to display
* after user lets go of the refresher. The SVG {@link ionic.directive:ionSpinner}
* is now the default, replacing rotating font icons.
* is now the default, replacing rotating font icons. Set to `none` to disable both the
* spinner and the icon.
* @param {string=} refreshing-icon The font icon to display after user lets go of the
* refresher. This is depreicated in favor of the SVG {@link ionic.directive:ionSpinner}.
* @param {boolean=} disable-pulling-rotation Disables the rotation animation of the pulling
Expand All @@ -76,7 +77,7 @@ IonicModule
'<div class="text-pulling" ng-bind-html="pullingText"></div>' +
'<div class="icon-refreshing">' +
'<ion-spinner ng-if="showSpinner" icon="{{spinner}}"></ion-spinner>' +
'<i ng-if="!showSpinner" class="icon {{refreshingIcon}}"></i>' +
'<i ng-if="showIcon" class="icon {{refreshingIcon}}"></i>' +
'</div>' +
'<div class="text-refreshing" ng-bind-html="refreshingText"></div>' +
'</div>' +
Expand Down
7 changes: 6 additions & 1 deletion test/unit/angular/directive/refresher.unit.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,15 @@ describe('ionRefresher directive', function() {
var el = setup();
expect(el[0].querySelector('ion-spinner')).toBeTruthy();
});
it('should have spinner', function() {
it('should allow a custom spinner', function() {
var el = setup('spinner="android"');
expect(el[0].querySelector('.spinner-android')).toBeTruthy();
});
it('should allow spinner to be none', function() {
var el = setup('spinner="none"');
expect(el[0].querySelector('ion-spinner')).not.toBeTruthy();
expect(el[0].querySelector('.icon.icon-refreshing')).not.toBeTruthy();
});
it('should allow custom refreshingIcon', function() {
var el = setup('refreshing-icon="monkey-icon"');
expect(el[0].querySelector('.icon.icon-refreshing.ion-arrow-down-c')).toBeFalsy();
Expand Down

0 comments on commit 4afc767

Please sign in to comment.