@@ -146,16 +146,6 @@ describe('MatChipList', () => {
146
146
expect ( manager . activeItemIndex ) . toBe ( 0 ) ;
147
147
} ) ;
148
148
149
- it ( 'should watch for chip focus' , ( ) => {
150
- let array = chips . toArray ( ) ;
151
- let lastIndex = array . length - 1 ;
152
- let lastItem = array [ lastIndex ] ;
153
- lastItem . focus ( ) ;
154
- fixture . detectChanges ( ) ;
155
-
156
- expect ( manager . activeItemIndex ) . toBe ( lastIndex ) ;
157
- } ) ;
158
-
159
149
it ( 'should watch for chip focus' , ( ) => {
160
150
let array = chips . toArray ( ) ;
161
151
let lastIndex = array . length - 1 ;
@@ -238,6 +228,18 @@ describe('MatChipList', () => {
238
228
expect ( chipListInstance . _keyManager . activeItemIndex ) . toEqual ( - 1 ) ;
239
229
} ) ;
240
230
231
+ it ( 'should focus the list if the last focused item is removed' , ( ) => {
232
+ testComponent . chips = [ 0 ] ;
233
+
234
+ spyOn ( chipListInstance , 'focus' ) ;
235
+ chips . last . focus ( ) ;
236
+
237
+ testComponent . chips . pop ( ) ;
238
+ fixture . detectChanges ( ) ;
239
+
240
+ expect ( chipListInstance . focus ) . toHaveBeenCalled ( ) ;
241
+ } ) ;
242
+
241
243
it ( 'should move focus to the last chip when the focused chip was deleted inside a' +
242
244
'component with animations' , fakeAsync ( ( ) => {
243
245
fixture . destroy ( ) ;
0 commit comments