Skip to content
This repository was archived by the owner on Sep 5, 2024. It is now read-only.

Commit b19d5cb

Browse files
kseamonjelbourn
authored andcommitted
fix(virtualRepeat, autoComplete): Recompute number of items after auto-(un)shrink.
1 parent 19c2df8 commit b19d5cb

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

src/components/virtualRepeat/virtual-repeater.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,8 @@ VirtualRepeatContainerController.prototype.autoShrink_ = function(size) {
253253
this.setSize_(this.originalSize);
254254
this.originalSize = null;
255255
}
256+
257+
this.repeater.containerUpdated();
256258
}
257259
};
258260

src/components/virtualRepeat/virtual-repeater.spec.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,21 +303,25 @@ describe('<md-virtual-repeat>', function() {
303303
$$rAF.flush();
304304

305305
expect(container[0].offsetHeight).toBe(100);
306+
expect(offsetter.children().length).toBe(13);
306307

307308
// With 5 items...
308309
scope.items = createItems(5);
309310
scope.$apply();
310311
expect(container[0].offsetHeight).toBe(5 * ITEM_SIZE);
312+
expect(offsetter.children().length).toBe(5);
311313

312314
// With 0 items...
313315
scope.items = [];
314316
scope.$apply();
315317
expect(container[0].offsetHeight).toBe(0);
318+
expect(offsetter.children().length).toBe(0);
316319

317320
// With lots of items again...
318321
scope.items = createItems(NUM_ITEMS);
319322
scope.$apply();
320323
expect(container[0].offsetHeight).toBe(100);
324+
expect(offsetter.children().length).toBe(13);
321325
});
322326

323327
it('should shrink the container when the number of items goes down (horizontal)', function() {
@@ -331,21 +335,25 @@ describe('<md-virtual-repeat>', function() {
331335
$$rAF.flush();
332336

333337
expect(container[0].offsetWidth).toBe(150);
338+
expect(offsetter.children().length).toBe(18);
334339

335340
// With 5 items...
336341
scope.items = createItems(5);
337342
scope.$apply();
338343
expect(container[0].offsetWidth).toBe(5 * ITEM_SIZE);
344+
expect(offsetter.children().length).toBe(5);
339345

340346
// With 0 items...
341347
scope.items = [];
342348
scope.$apply();
343349
expect(container[0].offsetWidth).toBe(0);
350+
expect(offsetter.children().length).toBe(0);
344351

345352
// With lots of items again...
346353
scope.items = createItems(NUM_ITEMS);
347354
scope.$apply();
348355
expect(container[0].offsetWidth).toBe(150);
356+
expect(offsetter.children().length).toBe(18);
349357
});
350358

351359
it('should not shrink below the specified md-auto-shrink-min (vertical)', function() {

0 commit comments

Comments
 (0)