@@ -95,7 +95,7 @@ describe('MatChipList', () => {
9595
9696 expect ( chips . toArray ( ) . every ( chip => chip . disabled ) ) . toBe ( true ) ;
9797
98- fixture . componentInstance . items . push ( 5 , 6 ) ;
98+ fixture . componentInstance . chips . push ( 5 , 6 ) ;
9999 fixture . detectChanges ( ) ;
100100 tick ( ) ;
101101 fixture . detectChanges ( ) ;
@@ -197,8 +197,8 @@ describe('MatChipList', () => {
197197 // Focus the middle item
198198 midItem . focus ( ) ;
199199
200- // Remove the middle item
201- testComponent . items . splice ( 2 , 1 ) ;
200+ // Destroy the middle item
201+ testComponent . chips . 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- // Remove the last item
217- testComponent . items . splice ( lastIndex , 1 ) ;
216+ // Destroy the last item
217+ testComponent . chips . pop ( ) ;
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- // Remove the middle item
234- testComponent . items . splice ( 2 , 1 ) ;
233+ // Destroy the middle item
234+ testComponent . chips . splice ( 2 , 1 ) ;
235235 fixture . detectChanges ( ) ;
236236
237237 // Should not have focus
@@ -1322,20 +1322,18 @@ describe('MatChipList', () => {
13221322@Component ( {
13231323 template : `
13241324 <mat-chip-list [tabIndex]="tabIndex" [selectable]="selectable">
1325- <mat-chip *ngFor="let i of items"
1326- (select)="chipSelect(i)"
1327- (deselect)="chipDeselect(i)">
1325+ <mat-chip *ngFor="let i of chips" (select)="chipSelect(i)" (deselect)="chipDeselect(i)">
13281326 {{name}} {{i + 1}}
13291327 </mat-chip>
13301328 </mat-chip-list>`
13311329} )
13321330class StandardChipList {
1333- items = [ 0 , 1 , 2 , 3 , 4 ] ;
13341331 name : string = 'Test' ;
13351332 selectable : boolean = true ;
13361333 chipSelect : ( index ?: number ) => void = ( ) => { } ;
13371334 chipDeselect : ( index ?: number ) => void = ( ) => { } ;
13381335 tabIndex : number = 0 ;
1336+ chips = [ 0 , 1 , 2 , 3 , 4 ] ;
13391337}
13401338
13411339@Component ( {
@@ -1591,7 +1589,7 @@ class StandardChipListWithAnimations {
15911589 template : `
15921590 <mat-form-field>
15931591 <mat-chip-list>
1594- <mat-chip *ngFor="let i of chips" [value]="i" (removed)="removeChip($event)">
1592+ <mat-chip [value]="i" (removed)="removeChip($event)" *ngFor="let i of chips ">
15951593 Chip {{i + 1}}
15961594 <span matChipRemove>Remove</span>
15971595 </mat-chip>
0 commit comments