@@ -181,7 +181,7 @@ describe('MatChipList', () => {
181181 midItem . focus ( ) ;
182182
183183 // Destroy the middle item
184- testComponent . remove = 2 ;
184+ testComponent . chips . splice ( 2 , 1 ) ;
185185 fixture . detectChanges ( ) ;
186186
187187 // It focuses the 4th item (now at index 2)
@@ -197,7 +197,7 @@ describe('MatChipList', () => {
197197 lastItem . focus ( ) ;
198198
199199 // Destroy the last item
200- testComponent . remove = lastIndex ;
200+ testComponent . chips . pop ( ) ;
201201 fixture . detectChanges ( ) ;
202202
203203 // It focuses the next-to-last item
@@ -214,7 +214,7 @@ describe('MatChipList', () => {
214214 zone . simulateZoneExit ( ) ;
215215
216216 // Destroy the middle item
217- testComponent . remove = 2 ;
217+ testComponent . chips . splice ( 2 , 1 ) ;
218218 fixture . detectChanges ( ) ;
219219
220220 // Should not have focus
@@ -1305,22 +1305,18 @@ describe('MatChipList', () => {
13051305@Component ( {
13061306 template : `
13071307 <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>
13151311 </mat-chip-list>`
13161312} )
13171313class StandardChipList {
13181314 name : string = 'Test' ;
13191315 selectable : boolean = true ;
1320- remove : number ;
13211316 chipSelect : ( index ?: number ) => void = ( ) => { } ;
13221317 chipDeselect : ( index ?: number ) => void = ( ) => { } ;
13231318 tabIndex : number = 0 ;
1319+ chips = [ 0 , 1 , 2 , 3 , 4 ] ;
13241320}
13251321
13261322@Component ( {
@@ -1576,12 +1572,10 @@ class StandardChipListWithAnimations {
15761572 template : `
15771573 <mat-form-field>
15781574 <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>
15851579 </mat-chip-list>
15861580 </mat-form-field>
15871581 `
0 commit comments