Skip to content

Commit 8389968

Browse files
committed
fix(collectionRepeat): Properly calcuate list height and show ion-infinite-scroll. Fixes #2376
1 parent 6a2be56 commit 8389968

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

Diff for: js/angular/directive/collectionRepeat.js

+1
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,7 @@ function($collectionRepeatManager, $collectionDataSource, $parse) {
228228
before = false;
229229
} else {
230230
if (node.hasAttribute('collection-repeat-ignore')) return;
231+
if (node.nodeName === 'ION-INFINITE-SCROLL')return;
231232
var width = node.offsetWidth;
232233
var height = node.offsetHeight;
233234
if (width && height) {

Diff for: js/angular/service/collectionRepeatManager.js

+1
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ function($rootScope, $timeout) {
154154
this.beforeSize = result.beforeSize;
155155
this.setCurrentIndex(0);
156156
this.render(true);
157+
this.dataSource.transcludeParent[0].style.height = result.totalSize + "px";
157158
this.dataSource.setup();
158159
},
159160
/*

Diff for: test/unit/angular/service/collectionRepeatManager.unit.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ describe('collectionRepeatManager service', function() {
251251
it('should work without data', function() {
252252
var manager = setup();
253253
spyOn(manager, 'render');
254-
spyOn(manager, 'calculateDimensions').andReturn({
254+
spyOn(manager, 'calculateDimensions').andReturn({
255255
dimensions: [],
256256
beforeSize: 0,
257257
totalSize: 0
@@ -265,14 +265,15 @@ describe('collectionRepeatManager service', function() {
265265
});
266266
it('should work with data', function() {
267267
var manager = setup();
268-
spyOn(manager, 'calculateDimensions').andReturn({
268+
spyOn(manager, 'calculateDimensions').andReturn({
269269
dimensions: [{
270270
primaryPos: 100, primarySize: 30
271271
}],
272272
beforeSize: 0,
273273
totalSize: 130
274274
});
275275
manager.resize();
276+
expect(manager.dataSource.transcludeParent[0].style.height).toBe('130px');
276277
expect(manager.viewportSize).toBe(130);
277278
});
278279
});

0 commit comments

Comments
 (0)