@@ -181,7 +181,7 @@ describe('MatChipList', () => {
181
181
midItem . focus ( ) ;
182
182
183
183
// Destroy the middle item
184
- testComponent . remove = 2 ;
184
+ testComponent . chips . splice ( 2 , 1 ) ;
185
185
fixture . detectChanges ( ) ;
186
186
187
187
// It focuses the 4th item (now at index 2)
@@ -197,7 +197,7 @@ describe('MatChipList', () => {
197
197
lastItem . focus ( ) ;
198
198
199
199
// Destroy the last item
200
- testComponent . remove = lastIndex ;
200
+ testComponent . chips . pop ( ) ;
201
201
fixture . detectChanges ( ) ;
202
202
203
203
// It focuses the next-to-last item
@@ -214,7 +214,7 @@ describe('MatChipList', () => {
214
214
zone . simulateZoneExit ( ) ;
215
215
216
216
// Destroy the middle item
217
- testComponent . remove = 2 ;
217
+ testComponent . chips . splice ( 2 , 1 ) ;
218
218
fixture . detectChanges ( ) ;
219
219
220
220
// Should not have focus
@@ -1305,22 +1305,18 @@ describe('MatChipList', () => {
1305
1305
@Component ( {
1306
1306
template : `
1307
1307
<mat-chip-list [tabIndex]="tabIndex" [selectable]="selectable">
1308
- <div *ngFor="let i of [0,1,2,3,4]">
1309
- <div *ngIf="remove != i">
1310
- <mat-chip (select)="chipSelect(i)" (deselect)="chipDeselect(i)">
1311
- {{name}} {{i + 1}}
1312
- </mat-chip>
1313
- </div>
1314
- </div>
1308
+ <mat-chip *ngFor="let i of chips" (select)="chipSelect(i)" (deselect)="chipDeselect(i)">
1309
+ {{name}} {{i + 1}}
1310
+ </mat-chip>
1315
1311
</mat-chip-list>`
1316
1312
} )
1317
1313
class StandardChipList {
1318
1314
name : string = 'Test' ;
1319
1315
selectable : boolean = true ;
1320
- remove : number ;
1321
1316
chipSelect : ( index ?: number ) => void = ( ) => { } ;
1322
1317
chipDeselect : ( index ?: number ) => void = ( ) => { } ;
1323
1318
tabIndex : number = 0 ;
1319
+ chips = [ 0 , 1 , 2 , 3 , 4 ] ;
1324
1320
}
1325
1321
1326
1322
@Component ( {
@@ -1576,12 +1572,10 @@ class StandardChipListWithAnimations {
1576
1572
template : `
1577
1573
<mat-form-field>
1578
1574
<mat-chip-list>
1579
- <div *ngFor="let i of chips">
1580
- <mat-chip [value]="i" (removed)="removeChip($event)">
1581
- Chip {{i + 1}}
1582
- <span matChipRemove>Remove</span>
1583
- </mat-chip>
1584
- </div>
1575
+ <mat-chip [value]="i" (removed)="removeChip($event)" *ngFor="let i of chips">
1576
+ Chip {{i + 1}}
1577
+ <span matChipRemove>Remove</span>
1578
+ </mat-chip>
1585
1579
</mat-chip-list>
1586
1580
</mat-form-field>
1587
1581
`
0 commit comments