Skip to content

Commit

Permalink
fix(ionContent): make scrollable content work as child of non-scrollable
Browse files Browse the repository at this point in the history
Closes #1421
  • Loading branch information
ajoslin committed May 19, 2014
1 parent 37d0627 commit 488bd5c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
3 changes: 1 addition & 2 deletions js/angular/directive/content.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ function($timeout, $controller, $ionicBind) {
$onScroll: '&onScroll',
$onScrollComplete: '&onScrollComplete',
hasBouncing: '@',
scroll: '@',
padding: '@',
hasScrollX: '@',
hasScrollY: '@',
Expand All @@ -96,7 +95,7 @@ function($timeout, $controller, $ionicBind) {
});
}

if ($scope.scroll === "false") {
if ($attr.scroll === "false") {
//do nothing
} else if(attr.overflowScroll === "true") {
$element.addClass('overflow-scroll');
Expand Down
14 changes: 14 additions & 0 deletions test/unit/angular/directive/content.unit.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,20 @@ describe('Ionic Content directive', function() {
expect(scroll.length).toBe(0);
});

it('should work scrollable with nested ionScroll elements', function() {
var element = compile(
'<ion-content scroll="false" class="content1">' +
'<div>' +
'<ion-content class="content2">' +
'</ion-content>' +
'</div>' +
'</ion-content>')(scope);
scope.$apply();

expect(jqLite(element[0].querySelector('.content2')).controller('$ionicScroll')).toBeTruthy();
expect(element.controller('$ionicScroll')).toBeFalsy();
});

it('should add padding classname to scroll element', function() {
var element = compile('<ion-content padding="shouldPad"></ion-content>')(scope);
var scroll = element.find('.scroll');
Expand Down

1 comment on commit 488bd5c

@leefernandes
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

similarly nested ion-scroll do not work with beta-8

Please sign in to comment.