@@ -56,7 +56,7 @@ const CSS_CLASS_EMPTY = 'igx-combo__empty';
56
56
const CSS_CLASS_ITEM_CHECKBOX = 'igx-combo__checkbox' ;
57
57
const CSS_CLASS_ITME_CHECKBOX_CHECKED = 'igx-checkbox--checked' ;
58
58
const defaultDropdownItemHeight = 40 ;
59
- const defaultDropdownItemMaxHeight = 400 ;
59
+ const defaultDropdownItemMaxHeight = 240 ;
60
60
61
61
describe ( 'igxCombo' , ( ) => {
62
62
let fixture : ComponentFixture < any > ;
@@ -1211,13 +1211,11 @@ describe('igxCombo', () => {
1211
1211
const dropdownItems = dropdownList . querySelectorAll ( `.${ CSS_CLASS_DROPDOWNLISTITEM } ` ) ;
1212
1212
expect ( dropdownItems [ 1 ] . classList . contains ( CSS_CLASS_SELECTED ) ) . toBeFalsy ( ) ;
1213
1213
expect ( dropdownItems [ 3 ] . classList . contains ( CSS_CLASS_SELECTED ) ) . toBeFalsy ( ) ;
1214
- expect ( dropdownItems [ 7 ] . classList . contains ( CSS_CLASS_SELECTED ) ) . toBeFalsy ( ) ;
1215
1214
1216
- combo . select ( [ 'Illinois' , 'Mississippi' , ' Ohio'] ) ;
1215
+ combo . select ( [ 'Illinois' , 'Ohio' ] ) ;
1217
1216
fixture . detectChanges ( ) ;
1218
1217
expect ( dropdownItems [ 1 ] . classList . contains ( CSS_CLASS_SELECTED ) ) . toBeTruthy ( ) ;
1219
1218
expect ( dropdownItems [ 3 ] . classList . contains ( CSS_CLASS_SELECTED ) ) . toBeTruthy ( ) ;
1220
- expect ( dropdownItems [ 7 ] . classList . contains ( CSS_CLASS_SELECTED ) ) . toBeTruthy ( ) ;
1221
1219
1222
1220
combo . deselect ( [ 'Ohio' ] ) ;
1223
1221
fixture . detectChanges ( ) ;
@@ -1237,9 +1235,9 @@ describe('igxCombo', () => {
1237
1235
expect ( focusedItem_1 . classList . contains ( CSS_CLASS_FOCUSED ) ) . toBeTruthy ( ) ;
1238
1236
1239
1237
// Change focus
1240
- dropdown . navigateItem ( 6 ) ;
1238
+ dropdown . navigateItem ( 4 ) ;
1241
1239
fixture . detectChanges ( ) ;
1242
- const focusedItem_2 = dropdownItems [ 5 ] ;
1240
+ const focusedItem_2 = dropdownItems [ 3 ] ;
1243
1241
expect ( focusedItem_2 . classList . contains ( CSS_CLASS_FOCUSED ) ) . toBeTruthy ( ) ;
1244
1242
expect ( focusedItem_1 . classList . contains ( CSS_CLASS_FOCUSED ) ) . toBeFalsy ( ) ;
1245
1243
} ) ;
@@ -1803,7 +1801,7 @@ describe('igxCombo', () => {
1803
1801
dropdown . toggle ( ) ;
1804
1802
fixture . detectChanges ( ) ;
1805
1803
expect ( dropdown . items ) . toBeDefined ( ) ;
1806
- expect ( dropdown . items . length ) . toEqual ( 9 ) ;
1804
+ expect ( dropdown . items . length ) . toEqual ( 5 ) ;
1807
1805
dropdown . onFocus ( ) ;
1808
1806
expect ( dropdown . focusedItem ) . toEqual ( dropdown . items [ 0 ] ) ;
1809
1807
expect ( dropdown . focusedItem . focused ) . toEqual ( true ) ;
@@ -1925,17 +1923,17 @@ describe('igxCombo', () => {
1925
1923
selectedItemsCount ++ ;
1926
1924
selectAndVerifyItem ( 0 ) ;
1927
1925
1928
- for ( let index = 1 ; index < 7 ; index ++ ) {
1926
+ for ( let index = 1 ; index < 5 ; index ++ ) {
1929
1927
focusAndVerifyItem ( index , 'ArrowDown' ) ;
1930
1928
}
1931
1929
selectedItemsCount ++ ;
1932
- selectAndVerifyItem ( 6 ) ;
1930
+ selectAndVerifyItem ( 4 ) ;
1933
1931
1934
- for ( let index = 5 ; index > 3 ; index -- ) {
1932
+ for ( let index = 3 ; index >= 2 ; index -- ) {
1935
1933
focusAndVerifyItem ( index , 'ArrowUp' ) ;
1936
1934
}
1937
1935
selectedItemsCount ++ ;
1938
- selectAndVerifyItem ( 4 ) ;
1936
+ selectAndVerifyItem ( 2 ) ;
1939
1937
} ) ;
1940
1938
it ( 'should properly navigate using HOME/END key' , ( async ( ) => {
1941
1939
let firstVisibleItem : Element ;
@@ -2093,7 +2091,7 @@ describe('igxCombo', () => {
2093
2091
const scrollbar = fixture . debugElement . query ( By . css ( `.${ CSS_CLASS_SCROLLBAR_VERTICAL } ` ) ) . nativeElement as HTMLElement ;
2094
2092
expect ( scrollbar . scrollTop ) . toEqual ( 0 ) ;
2095
2093
2096
- combo . virtualScrollContainer . scrollTo ( 16 ) ;
2094
+ combo . virtualScrollContainer . scrollTo ( 12 ) ;
2097
2095
await firstValueFrom ( combo . virtualScrollContainer . chunkLoad ) ;
2098
2096
fixture . detectChanges ( ) ;
2099
2097
let selectedItem = fixture . debugElement . queryAll ( By . css ( `.${ CSS_CLASS_DROPDOWNLISTITEM } ` ) ) [ 1 ] ;
@@ -2109,7 +2107,7 @@ describe('igxCombo', () => {
2109
2107
// Content was scrolled to bottom
2110
2108
expect ( scrollbar . scrollHeight - scrollbar . scrollTop ) . toEqual ( scrollbar . clientHeight ) ;
2111
2109
2112
- combo . virtualScrollContainer . scrollTo ( 5 ) ;
2110
+ combo . virtualScrollContainer . scrollTo ( 4 ) ;
2113
2111
await firstValueFrom ( combo . virtualScrollContainer . chunkLoad ) ;
2114
2112
fixture . detectChanges ( ) ;
2115
2113
selectedItem = fixture . debugElement . query ( By . css ( `.${ CSS_CLASS_SELECTED } ` ) ) ;
@@ -2184,15 +2182,14 @@ describe('igxCombo', () => {
2184
2182
expect ( input . nativeElement . value ) . toEqual ( expectedOutput ) ;
2185
2183
} ) ;
2186
2184
it ( 'should dismiss all selected items by pressing clear button' , ( ) => {
2187
- const expectedOutput = 'Kentucky, Ohio, Indiana' ;
2188
- combo . select ( [ 'Kentucky' , ' Ohio', 'Indiana' ] ) ;
2185
+ const expectedOutput = 'Ohio, Indiana' ;
2186
+ combo . select ( [ 'Ohio' , 'Indiana' ] ) ;
2189
2187
fixture . detectChanges ( ) ;
2190
2188
expect ( input . nativeElement . value ) . toEqual ( expectedOutput ) ;
2191
2189
combo . toggle ( ) ;
2192
2190
fixture . detectChanges ( ) ;
2193
2191
expect ( combo . dropdown . items [ 1 ] . selected ) . toBeTruthy ( ) ;
2194
2192
expect ( combo . dropdown . items [ 4 ] . selected ) . toBeTruthy ( ) ;
2195
- expect ( combo . dropdown . items [ 6 ] . selected ) . toBeTruthy ( ) ;
2196
2193
2197
2194
const clearBtn = fixture . debugElement . query ( By . css ( `.${ CSS_CLASS_CLEARBUTTON } ` ) ) ;
2198
2195
clearBtn . triggerEventHandler ( 'click' , UIInteractions . getMouseEvent ( 'click' ) ) ;
@@ -2205,7 +2202,6 @@ describe('igxCombo', () => {
2205
2202
fixture . detectChanges ( ) ;
2206
2203
expect ( combo . dropdown . items [ 1 ] . selected ) . toBeFalsy ( ) ;
2207
2204
expect ( combo . dropdown . items [ 4 ] . selected ) . toBeFalsy ( ) ;
2208
- expect ( combo . dropdown . items [ 6 ] . selected ) . toBeFalsy ( ) ;
2209
2205
} ) ;
2210
2206
it ( 'should show/hide clear button after selecting/deselecting items' , ( ) => {
2211
2207
// This is a workaround for issue github.com/angular/angular/issues/14235
@@ -2263,8 +2259,8 @@ describe('igxCombo', () => {
2263
2259
cancel : false
2264
2260
} ) ;
2265
2261
2266
- const selectedItem_2 = dropdown . items [ 5 ] ;
2267
- simulateComboItemClick ( 5 ) ;
2262
+ const selectedItem_2 = dropdown . items [ 4 ] ;
2263
+ simulateComboItemClick ( 4 ) ;
2268
2264
expect ( combo . selection [ 1 ] ) . toEqual ( selectedItem_2 . value ) ;
2269
2265
expect ( combo . value [ 1 ] ) . toEqual ( selectedItem_2 . value [ combo . valueKey ] ) ;
2270
2266
expect ( selectedItem_2 . selected ) . toBeTruthy ( ) ;
@@ -2681,19 +2677,19 @@ describe('igxCombo', () => {
2681
2677
combo . toggle ( ) ;
2682
2678
fixture . detectChanges ( ) ;
2683
2679
let headers = combo . dropdown . headers . map ( header => header . element . nativeElement . textContent ?. trim ( ) ) ;
2684
- expect ( headers ) . toEqual ( [ 'Ángel' , 'Boris' , 'México' , 'Méxícó' ] ) ;
2680
+ expect ( headers ) . toEqual ( [ 'Ángel' , 'Boris' , 'México' ] ) ;
2685
2681
2686
2682
combo . groupSortingDirection = SortingDirection . Desc ;
2687
2683
combo . toggle ( ) ;
2688
2684
fixture . detectChanges ( ) ;
2689
2685
headers = combo . dropdown . headers . map ( header => header . element . nativeElement . textContent ?. trim ( ) ) ;
2690
- expect ( headers ) . toEqual ( [ 'Méxícó' , 'México' , 'Boris' , 'Ángel' ] ) ;
2686
+ expect ( headers ) . toEqual ( [ 'Méxícó' , 'México' , 'Boris' ] ) ;
2691
2687
2692
2688
combo . groupSortingDirection = SortingDirection . None ;
2693
2689
combo . toggle ( ) ;
2694
2690
fixture . detectChanges ( ) ;
2695
2691
headers = combo . dropdown . headers . map ( header => header . element . nativeElement . textContent ?. trim ( ) ) ;
2696
- expect ( headers ) . toEqual ( [ 'Méxícó' , 'Ángel' , 'México' , 'Boris' ] ) ;
2692
+ expect ( headers ) . toEqual ( [ 'Méxícó' , 'Ángel' , 'México' ] ) ;
2697
2693
} ) ;
2698
2694
} ) ;
2699
2695
describe ( 'Filtering tests: ' , ( ) => {
@@ -2852,8 +2848,8 @@ describe('igxCombo', () => {
2852
2848
2853
2849
verifyFilteredItems ( 'jose' , 1 ) ;
2854
2850
verifyFilteredItems ( 'mexico' , 3 ) ;
2855
- verifyFilteredItems ( 'o' , 7 ) ;
2856
- verifyFilteredItems ( 'é' , 7 ) ;
2851
+ verifyFilteredItems ( 'o' , 6 ) ;
2852
+ verifyFilteredItems ( 'é' , 6 ) ;
2857
2853
} ) ) ;
2858
2854
2859
2855
it ( 'should filter the dropdown items when typing in the search input' , fakeAsync ( ( ) => {
@@ -2878,9 +2874,9 @@ describe('igxCombo', () => {
2878
2874
dropdownItems = dropdownList . querySelectorAll ( `.${ CSS_CLASS_DROPDOWNLISTITEM } ` ) ;
2879
2875
expect ( dropdownItems . length ) . toEqual ( expectedItemsNumber ) ;
2880
2876
} ;
2881
- verifyFilteredItems ( 'M' , 7 ) ;
2877
+ verifyFilteredItems ( 'M' , 4 ) ;
2882
2878
2883
- verifyFilteredItems ( 'Mi' , 5 ) ;
2879
+ verifyFilteredItems ( 'Mi' , 3 ) ;
2884
2880
expectedValues = expectedValues . filter ( data => data . field . toLowerCase ( ) . includes ( 'mi' ) ) ;
2885
2881
checkFilteredItems ( dropdownItems ) ;
2886
2882
@@ -2950,9 +2946,9 @@ describe('igxCombo', () => {
2950
2946
expect ( combo . filteredData . length ) . toEqual ( expectedFilteredItemsNumber ) ;
2951
2947
} ;
2952
2948
2953
- verifyFilteredItems ( 'M' , 7 , 15 ) ;
2954
- verifyFilteredItems ( 'Mi' , 5 , 5 ) ;
2955
- verifyFilteredItems ( 'M' , 7 , 15 ) ;
2949
+ verifyFilteredItems ( 'M' , 4 , 15 ) ;
2950
+ verifyFilteredItems ( 'Mi' , 3 , 5 ) ;
2951
+ verifyFilteredItems ( 'M' , 4 , 15 ) ;
2956
2952
combo . filteredData . forEach ( ( item ) => expect ( combo . data ) . toContain ( item ) ) ;
2957
2953
} ) ;
2958
2954
it ( 'should clear the search input and close the dropdown list on pressing ESC key' , fakeAsync ( ( ) => {
0 commit comments