mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
fix(collectionRepeat): Properly calcuate list height and show ion-infinite-scroll. Fixes #2376
This commit is contained in:
1
js/angular/directive/collectionRepeat.js
vendored
1
js/angular/directive/collectionRepeat.js
vendored
@@ -228,6 +228,7 @@ function($collectionRepeatManager, $collectionDataSource, $parse) {
|
||||
before = false;
|
||||
} else {
|
||||
if (node.hasAttribute('collection-repeat-ignore')) return;
|
||||
if (node.nodeName === 'ION-INFINITE-SCROLL')return;
|
||||
var width = node.offsetWidth;
|
||||
var height = node.offsetHeight;
|
||||
if (width && height) {
|
||||
|
||||
@@ -154,6 +154,7 @@ function($rootScope, $timeout) {
|
||||
this.beforeSize = result.beforeSize;
|
||||
this.setCurrentIndex(0);
|
||||
this.render(true);
|
||||
this.dataSource.transcludeParent[0].style.height = result.totalSize + "px";
|
||||
this.dataSource.setup();
|
||||
},
|
||||
/*
|
||||
|
||||
@@ -251,7 +251,7 @@ describe('collectionRepeatManager service', function() {
|
||||
it('should work without data', function() {
|
||||
var manager = setup();
|
||||
spyOn(manager, 'render');
|
||||
spyOn(manager, 'calculateDimensions').andReturn({
|
||||
spyOn(manager, 'calculateDimensions').andReturn({
|
||||
dimensions: [],
|
||||
beforeSize: 0,
|
||||
totalSize: 0
|
||||
@@ -265,7 +265,7 @@ describe('collectionRepeatManager service', function() {
|
||||
});
|
||||
it('should work with data', function() {
|
||||
var manager = setup();
|
||||
spyOn(manager, 'calculateDimensions').andReturn({
|
||||
spyOn(manager, 'calculateDimensions').andReturn({
|
||||
dimensions: [{
|
||||
primaryPos: 100, primarySize: 30
|
||||
}],
|
||||
@@ -273,6 +273,7 @@ describe('collectionRepeatManager service', function() {
|
||||
totalSize: 130
|
||||
});
|
||||
manager.resize();
|
||||
expect(manager.dataSource.transcludeParent[0].style.height).toBe('130px');
|
||||
expect(manager.viewportSize).toBe(130);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user