Skip to content

Commit a4c235a

Browse files
andrewseguinjelbourn
authored andcommitted
test: remove div ngFor in chip list tests (#15101)
1 parent a3ab5e3 commit a4c235a

File tree

1 file changed

+15
-20
lines changed

1 file changed

+15
-20
lines changed

src/lib/chips/chip-list.spec.ts

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -197,8 +197,8 @@ describe('MatChipList', () => {
197197
// Focus the middle item
198198
midItem.focus();
199199

200-
// Destroy the middle item
201-
testComponent.remove = 2;
200+
// Remove the middle item
201+
testComponent.items.splice(2, 1);
202202
fixture.detectChanges();
203203

204204
// It focuses the 4th item (now at index 2)
@@ -213,8 +213,8 @@ describe('MatChipList', () => {
213213
// Focus the last item
214214
lastItem.focus();
215215

216-
// Destroy the last item
217-
testComponent.remove = lastIndex;
216+
// Remove the last item
217+
testComponent.items.splice(lastIndex, 1);
218218
fixture.detectChanges();
219219

220220
// It focuses the next-to-last item
@@ -230,8 +230,8 @@ describe('MatChipList', () => {
230230
midItem._blur();
231231
zone.simulateZoneExit();
232232

233-
// Destroy the middle item
234-
testComponent.remove = 2;
233+
// Remove the middle item
234+
testComponent.items.splice(2, 1);
235235
fixture.detectChanges();
236236

237237
// Should not have focus
@@ -1322,20 +1322,17 @@ describe('MatChipList', () => {
13221322
@Component({
13231323
template: `
13241324
<mat-chip-list [tabIndex]="tabIndex" [selectable]="selectable">
1325-
<div *ngFor="let i of items">
1326-
<div *ngIf="remove != i">
1327-
<mat-chip (select)="chipSelect(i)" (deselect)="chipDeselect(i)">
1328-
{{name}} {{i + 1}}
1329-
</mat-chip>
1330-
</div>
1331-
</div>
1325+
<mat-chip *ngFor="let i of items"
1326+
(select)="chipSelect(i)"
1327+
(deselect)="chipDeselect(i)">
1328+
{{name}} {{i + 1}}
1329+
</mat-chip>
13321330
</mat-chip-list>`
13331331
})
13341332
class StandardChipList {
13351333
items = [0, 1, 2, 3, 4];
13361334
name: string = 'Test';
13371335
selectable: boolean = true;
1338-
remove: number;
13391336
chipSelect: (index?: number) => void = () => {};
13401337
chipDeselect: (index?: number) => void = () => {};
13411338
tabIndex: number = 0;
@@ -1594,12 +1591,10 @@ class StandardChipListWithAnimations {
15941591
template: `
15951592
<mat-form-field>
15961593
<mat-chip-list>
1597-
<div *ngFor="let i of chips">
1598-
<mat-chip [value]="i" (removed)="removeChip($event)">
1599-
Chip {{i + 1}}
1600-
<span matChipRemove>Remove</span>
1601-
</mat-chip>
1602-
</div>
1594+
<mat-chip *ngFor="let i of chips" [value]="i" (removed)="removeChip($event)">
1595+
Chip {{i + 1}}
1596+
<span matChipRemove>Remove</span>
1597+
</mat-chip>
16031598
</mat-chip-list>
16041599
</mat-form-field>
16051600
`

0 commit comments

Comments
 (0)