@@ -197,8 +197,8 @@ describe('MatChipList', () => {
197
197
// Focus the middle item
198
198
midItem . focus ( ) ;
199
199
200
- // Destroy the middle item
201
- testComponent . remove = 2 ;
200
+ // Remove the middle item
201
+ testComponent . items . splice ( 2 , 1 ) ;
202
202
fixture . detectChanges ( ) ;
203
203
204
204
// It focuses the 4th item (now at index 2)
@@ -213,8 +213,8 @@ describe('MatChipList', () => {
213
213
// Focus the last item
214
214
lastItem . focus ( ) ;
215
215
216
- // Destroy the last item
217
- testComponent . remove = lastIndex ;
216
+ // Remove the last item
217
+ testComponent . items . splice ( lastIndex , 1 ) ;
218
218
fixture . detectChanges ( ) ;
219
219
220
220
// It focuses the next-to-last item
@@ -230,8 +230,8 @@ describe('MatChipList', () => {
230
230
midItem . _blur ( ) ;
231
231
zone . simulateZoneExit ( ) ;
232
232
233
- // Destroy the middle item
234
- testComponent . remove = 2 ;
233
+ // Remove the middle item
234
+ testComponent . items . splice ( 2 , 1 ) ;
235
235
fixture . detectChanges ( ) ;
236
236
237
237
// Should not have focus
@@ -1322,20 +1322,17 @@ describe('MatChipList', () => {
1322
1322
@Component ( {
1323
1323
template : `
1324
1324
<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>
1332
1330
</mat-chip-list>`
1333
1331
} )
1334
1332
class StandardChipList {
1335
1333
items = [ 0 , 1 , 2 , 3 , 4 ] ;
1336
1334
name : string = 'Test' ;
1337
1335
selectable : boolean = true ;
1338
- remove : number ;
1339
1336
chipSelect : ( index ?: number ) => void = ( ) => { } ;
1340
1337
chipDeselect : ( index ?: number ) => void = ( ) => { } ;
1341
1338
tabIndex : number = 0 ;
@@ -1594,12 +1591,10 @@ class StandardChipListWithAnimations {
1594
1591
template : `
1595
1592
<mat-form-field>
1596
1593
<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>
1603
1598
</mat-chip-list>
1604
1599
</mat-form-field>
1605
1600
`
0 commit comments