@@ -1688,6 +1688,52 @@ describe('IgxSimpleCombo', () => {
1688
1688
1689
1689
expect ( comboInput . nativeElement . value ) . toEqual ( 'Connecticut' ) ;
1690
1690
} ) ;
1691
+
1692
+ it ( 'should properly filter dropdown when a key is pressed while the combo is focused but not opened, with no selected item' , fakeAsync ( ( ) => {
1693
+ expect ( combo . collapsed ) . toEqual ( true ) ;
1694
+
1695
+ // filter with a specific character when there is no selected item
1696
+ combo . handleInputChange ( 'z' ) ;
1697
+ tick ( ) ;
1698
+ fixture . detectChanges ( ) ;
1699
+
1700
+ expect ( combo . filteredData . length ) . toEqual ( 1 ) ;
1701
+ expect ( combo . filteredData [ 0 ] . field ) . toEqual ( 'Arizona' ) ;
1702
+
1703
+ combo . close ( ) ;
1704
+ tick ( ) ;
1705
+ fixture . detectChanges ( ) ;
1706
+
1707
+ expect ( combo . collapsed ) . toEqual ( true ) ;
1708
+
1709
+ // filter with ' ' when there is no selected item
1710
+ combo . handleInputChange ( ' ' ) ;
1711
+ tick ( ) ;
1712
+ fixture . detectChanges ( ) ;
1713
+
1714
+ expect ( combo . filteredData . length ) . toEqual ( 12 ) ;
1715
+ } ) ) ;
1716
+
1717
+ it ( 'should properly filter dropdown when a key is pressed while the combo is focused but not opened, with a selected item' , fakeAsync ( ( ) => {
1718
+ // select an item
1719
+ combo . select ( 'Connecticut' ) ;
1720
+ tick ( ) ;
1721
+ fixture . detectChanges ( ) ;
1722
+
1723
+ expect ( combo . selection . field ) . toEqual ( 'Connecticut' ) ;
1724
+
1725
+ combo . close ( ) ;
1726
+ tick ( ) ;
1727
+ fixture . detectChanges ( ) ;
1728
+
1729
+ // filter with a specific character when there is a selected item
1730
+ combo . handleInputChange ( 'z' ) ;
1731
+ tick ( ) ;
1732
+ fixture . detectChanges ( ) ;
1733
+
1734
+ expect ( combo . filteredData . length ) . toEqual ( 1 ) ;
1735
+ expect ( combo . filteredData [ 0 ] . field ) . toEqual ( 'Arizona' ) ;
1736
+ } ) ) ;
1691
1737
} ) ;
1692
1738
1693
1739
describe ( 'Display density' , ( ) => {
0 commit comments