From 73f23d973c38bd0c5acc8424b1d85582d611f290 Mon Sep 17 00:00:00 2001 From: crisbeto Date: Sun, 10 Mar 2019 08:19:00 +0100 Subject: [PATCH] test(chip-list): rework tests to work under Ivy Equivalent of #15427 for master. Fixes the chip list tests that are failing under Ivy due to a known breaking change. --- src/lib/chips/chip-list.spec.ts | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/src/lib/chips/chip-list.spec.ts b/src/lib/chips/chip-list.spec.ts index 546142b221fb..a154445592fa 100644 --- a/src/lib/chips/chip-list.spec.ts +++ b/src/lib/chips/chip-list.spec.ts @@ -95,7 +95,7 @@ describe('MatChipList', () => { expect(chips.toArray().every(chip => chip.disabled)).toBe(true); - fixture.componentInstance.items.push(5, 6); + fixture.componentInstance.chips.push(5, 6); fixture.detectChanges(); tick(); fixture.detectChanges(); @@ -197,8 +197,8 @@ describe('MatChipList', () => { // Focus the middle item midItem.focus(); - // Remove the middle item - testComponent.items.splice(2, 1); + // Destroy the middle item + testComponent.chips.splice(2, 1); fixture.detectChanges(); // It focuses the 4th item (now at index 2) @@ -213,8 +213,8 @@ describe('MatChipList', () => { // Focus the last item lastItem.focus(); - // Remove the last item - testComponent.items.splice(lastIndex, 1); + // Destroy the last item + testComponent.chips.pop(); fixture.detectChanges(); // It focuses the next-to-last item @@ -230,8 +230,8 @@ describe('MatChipList', () => { midItem._blur(); zone.simulateZoneExit(); - // Remove the middle item - testComponent.items.splice(2, 1); + // Destroy the middle item + testComponent.chips.splice(2, 1); fixture.detectChanges(); // Should not have focus @@ -1322,20 +1322,18 @@ describe('MatChipList', () => { @Component({ template: ` - + {{name}} {{i + 1}} ` }) class StandardChipList { - items = [0, 1, 2, 3, 4]; name: string = 'Test'; selectable: boolean = true; chipSelect: (index?: number) => void = () => {}; chipDeselect: (index?: number) => void = () => {}; tabIndex: number = 0; + chips = [0, 1, 2, 3, 4]; } @Component({ @@ -1591,7 +1589,7 @@ class StandardChipListWithAnimations { template: ` - + Chip {{i + 1}} Remove