mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
Pull in #440
This commit is contained in:
2
dist/js/ionic-angular.js
vendored
2
dist/js/ionic-angular.js
vendored
@@ -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({
|
||||
|
||||
2
js/ext/angular/src/directive/ionicContent.js
vendored
2
js/ext/angular/src/directive/ionicContent.js
vendored
@@ -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({
|
||||
|
||||
@@ -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('<content has-header="true"></content>')(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('<content has-header="true" has-bouncing="false"></content>')(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('<content has-header="true"></content>')(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('<content has-header="true" has-bouncing="true"></content>')(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('<content start-x="100" start-y="300" has-header="true"></content>')(scope);
|
||||
timeout.flush();
|
||||
|
||||
Reference in New Issue
Block a user