diff --git a/dist/js/ionic-angular.js b/dist/js/ionic-angular.js index 7f816914a3..f6d6280f20 100644 --- a/dist/js/ionic-angular.js +++ b/dist/js/ionic-angular.js @@ -1265,7 +1265,7 @@ angular.module('ionic.ui.content', ['ionic.ui.service']) // Otherwise, supercharge this baby! $timeout(function() { var hasBouncing = $scope.$eval($scope.hasBouncing); - var enableBouncing = !$ionicPlatform.is('Android') && hasBouncing !== false; + var enableBouncing = (!$ionicPlatform.is('Android') && hasBouncing !== false) || hasBouncing === true; // No bouncing by default for Android users, lest they take up pitchforks // to our bouncing goodness sv = new ionic.views.Scroll({ diff --git a/js/ext/angular/src/directive/ionicContent.js b/js/ext/angular/src/directive/ionicContent.js index 245899e6b0..4220d20e67 100644 --- a/js/ext/angular/src/directive/ionicContent.js +++ b/js/ext/angular/src/directive/ionicContent.js @@ -80,7 +80,7 @@ angular.module('ionic.ui.content', ['ionic.ui.service']) // Otherwise, supercharge this baby! $timeout(function() { var hasBouncing = $scope.$eval($scope.hasBouncing); - var enableBouncing = !$ionicPlatform.is('Android') && hasBouncing !== false; + var enableBouncing = (!$ionicPlatform.is('Android') && hasBouncing !== false) || hasBouncing === true; // No bouncing by default for Android users, lest they take up pitchforks // to our bouncing goodness sv = new ionic.views.Scroll({ diff --git a/js/ext/angular/test/directive/ionicContent.unit.js b/js/ext/angular/test/directive/ionicContent.unit.js index 1b7b39e4b1..ceac0956cd 100644 --- a/js/ext/angular/test/directive/ionicContent.unit.js +++ b/js/ext/angular/test/directive/ionicContent.unit.js @@ -1,7 +1,15 @@ describe('Ionic Content directive', function() { - var compile, element, scope; + var compile, element, scope, platform = 'Android'; - beforeEach(module('ionic')); + //beforeEach(module('ionic')); + + beforeEach(module('ionic', function ($provide) { + $provide.value('$ionicPlatform', { + is: function(type) { + return type === platform; + } + }); + })); beforeEach(inject(function($compile, $rootScope, $timeout, $window) { compile = $compile; @@ -28,11 +36,26 @@ describe('Ionic Content directive', function() { expect(scrollElement.hasClass('padding')).toEqual(true); }); - /** - * Not currently possible to mock this AFAIK - */ - xit('Disables bouncing by default on Android', function() { - window.navigator.userAgent = 'Mozilla/5.0 (Linux; U; Android 4.0.3; ko-kr; LG-L160L Build/IML74K) AppleWebkit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30'; + it('Enables bouncing by default', function() { + platform = 'iPhone'; + element = compile('')(scope); + timeout.flush(); + var newScope = element.isolateScope(); + var scrollView = scope.scrollView; + expect(scrollView.options.bouncing).toBe(true); + }); + + it('Disables bouncing when has-bouncing = false', function() { + platform = 'iPhone'; + element = compile('')(scope); + timeout.flush(); + var newScope = element.isolateScope(); + var scrollView = scope.scrollView; + expect(scrollView.options.bouncing).toBe(false); + }); + + it('Disables bouncing by default on Android', function() { + platform = 'Android'; element = compile('')(scope); timeout.flush(); var newScope = element.isolateScope(); @@ -40,6 +63,16 @@ describe('Ionic Content directive', function() { expect(scrollView.options.bouncing).toBe(false); }); + it('Disables bouncing by default on Android unless has-bouncing = true', function() { + platform = 'Android'; + element = compile('')(scope); + timeout.flush(); + var newScope = element.isolateScope(); + var scrollView = scope.scrollView; + expect(scrollView.options.bouncing).toBe(true); + }); + + it('Should set start x and y', function() { element = compile('')(scope); timeout.flush();