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

fix(virtualRepeat, autoComplete): Recompute number of items after aut… #5908

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/components/virtualRepeat/virtual-repeater.js
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,8 @@ VirtualRepeatContainerController.prototype.autoShrink_ = function(size) {
this.setSize_(this.originalSize);
this.originalSize = null;
}

this.repeater.containerUpdated();
}
};

Expand Down
8 changes: 8 additions & 0 deletions src/components/virtualRepeat/virtual-repeater.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -303,21 +303,25 @@ describe('<md-virtual-repeat>', function() {
$$rAF.flush();

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

// With 5 items...
scope.items = createItems(5);
scope.$apply();
expect(container[0].offsetHeight).toBe(5 * ITEM_SIZE);
expect(offsetter.children().length).toBe(5);

// With 0 items...
scope.items = [];
scope.$apply();
expect(container[0].offsetHeight).toBe(0);
expect(offsetter.children().length).toBe(0);

// With lots of items again...
scope.items = createItems(NUM_ITEMS);
scope.$apply();
expect(container[0].offsetHeight).toBe(100);
expect(offsetter.children().length).toBe(13);
});

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

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

// With 5 items...
scope.items = createItems(5);
scope.$apply();
expect(container[0].offsetWidth).toBe(5 * ITEM_SIZE);
expect(offsetter.children().length).toBe(5);

// With 0 items...
scope.items = [];
scope.$apply();
expect(container[0].offsetWidth).toBe(0);
expect(offsetter.children().length).toBe(0);

// With lots of items again...
scope.items = createItems(NUM_ITEMS);
scope.$apply();
expect(container[0].offsetWidth).toBe(150);
expect(offsetter.children().length).toBe(18);
});

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