@@ -146,16 +146,6 @@ describe('MatChipList', () => {
146146 expect ( manager . activeItemIndex ) . toBe ( 0 ) ;
147147 } ) ;
148148
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-
159149 it ( 'should watch for chip focus' , ( ) => {
160150 let array = chips . toArray ( ) ;
161151 let lastIndex = array . length - 1 ;
@@ -238,6 +228,18 @@ describe('MatChipList', () => {
238228 expect ( chipListInstance . _keyManager . activeItemIndex ) . toEqual ( - 1 ) ;
239229 } ) ;
240230
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+
241243 it ( 'should move focus to the last chip when the focused chip was deleted inside a' +
242244 'component with animations' , fakeAsync ( ( ) => {
243245 fixture . destroy ( ) ;
0 commit comments