@@ -1529,27 +1529,51 @@ describe('IgxSimpleCombo', () => {
15291529 expect ( combo . filteredData [ 0 ] . field ) . toBe ( target . value )
15301530 } ) ;
15311531
1532- it ( 'should properly filter dropdown when a key is pressed while the combo is focused but not opened' , fakeAsync ( ( ) => {
1532+ it ( 'should properly filter dropdown when a key is pressed while the combo is focused but not opened, with no selected item ' , fakeAsync ( ( ) => {
15331533 expect ( combo . collapsed ) . toEqual ( true ) ;
15341534
1535+ // filter with a specific character when there is no selected item
15351536 combo . handleInputChange ( 'z' ) ;
15361537 tick ( ) ;
15371538 fixture . detectChanges ( ) ;
15381539
15391540 expect ( combo . filteredData . length ) . toEqual ( 1 ) ;
1541+ expect ( combo . filteredData [ 0 ] . field ) . toEqual ( 'Arizona' ) ;
15401542
15411543 combo . close ( ) ;
15421544 tick ( ) ;
15431545 fixture . detectChanges ( ) ;
15441546
15451547 expect ( combo . collapsed ) . toEqual ( true ) ;
15461548
1549+ // filter with ' ' when there is no selected item
15471550 combo . handleInputChange ( ' ' ) ;
15481551 tick ( ) ;
15491552 fixture . detectChanges ( ) ;
15501553
15511554 expect ( combo . filteredData . length ) . toEqual ( 12 ) ;
15521555 } ) ) ;
1556+
1557+ it ( 'should properly filter dropdown when a key is pressed while the combo is focused but not opened, with a selected item' , fakeAsync ( ( ) => {
1558+ // select an item
1559+ combo . select ( 'Connecticut' ) ;
1560+ tick ( ) ;
1561+ fixture . detectChanges ( ) ;
1562+
1563+ expect ( combo . selection . field ) . toEqual ( 'Connecticut' ) ;
1564+
1565+ combo . close ( ) ;
1566+ tick ( ) ;
1567+ fixture . detectChanges ( ) ;
1568+
1569+ // filter with a specific character when there is a selected item
1570+ combo . handleInputChange ( 'z' ) ;
1571+ tick ( ) ;
1572+ fixture . detectChanges ( ) ;
1573+
1574+ expect ( combo . filteredData . length ) . toEqual ( 1 ) ;
1575+ expect ( combo . filteredData [ 0 ] . field ) . toEqual ( 'Arizona' ) ;
1576+ } ) ) ;
15531577 } ) ;
15541578
15551579 describe ( 'Display density' , ( ) => {
0 commit comments