@@ -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 > ;
@@ -1195,17 +1195,18 @@ describe('igxCombo', () => {
1195
1195
it ( 'should render selected items properly' , ( ) => {
1196
1196
combo . toggle ( ) ;
1197
1197
fixture . detectChanges ( ) ;
1198
+
1198
1199
const dropdownList = fixture . debugElement . query ( By . css ( `.${ CSS_CLASS_DROPDOWNLIST_SCROLL } ` ) ) . nativeElement ;
1199
1200
const dropdownItems = dropdownList . querySelectorAll ( `.${ CSS_CLASS_DROPDOWNLISTITEM } ` ) ;
1201
+
1202
+
1200
1203
expect ( dropdownItems [ 1 ] . classList . contains ( CSS_CLASS_SELECTED ) ) . toBeFalsy ( ) ;
1201
1204
expect ( dropdownItems [ 3 ] . classList . contains ( CSS_CLASS_SELECTED ) ) . toBeFalsy ( ) ;
1202
- expect ( dropdownItems [ 7 ] . classList . contains ( CSS_CLASS_SELECTED ) ) . toBeFalsy ( ) ;
1203
1205
1204
- combo . select ( [ 'Illinois' , 'Mississippi' , ' Ohio'] ) ;
1206
+ combo . select ( [ 'Illinois' , 'Ohio' ] ) ;
1205
1207
fixture . detectChanges ( ) ;
1206
1208
expect ( dropdownItems [ 1 ] . classList . contains ( CSS_CLASS_SELECTED ) ) . toBeTruthy ( ) ;
1207
1209
expect ( dropdownItems [ 3 ] . classList . contains ( CSS_CLASS_SELECTED ) ) . toBeTruthy ( ) ;
1208
- expect ( dropdownItems [ 7 ] . classList . contains ( CSS_CLASS_SELECTED ) ) . toBeTruthy ( ) ;
1209
1210
1210
1211
combo . deselect ( [ 'Ohio' ] ) ;
1211
1212
fixture . detectChanges ( ) ;
@@ -1225,9 +1226,9 @@ describe('igxCombo', () => {
1225
1226
expect ( focusedItem_1 . classList . contains ( CSS_CLASS_FOCUSED ) ) . toBeTruthy ( ) ;
1226
1227
1227
1228
// Change focus
1228
- dropdown . navigateItem ( 6 ) ;
1229
+ dropdown . navigateItem ( 4 ) ;
1229
1230
fixture . detectChanges ( ) ;
1230
- const focusedItem_2 = dropdownItems [ 5 ] ;
1231
+ const focusedItem_2 = dropdownItems [ 3 ] ;
1231
1232
expect ( focusedItem_2 . classList . contains ( CSS_CLASS_FOCUSED ) ) . toBeTruthy ( ) ;
1232
1233
expect ( focusedItem_1 . classList . contains ( CSS_CLASS_FOCUSED ) ) . toBeFalsy ( ) ;
1233
1234
} ) ;
@@ -1772,7 +1773,7 @@ describe('igxCombo', () => {
1772
1773
dropdown . toggle ( ) ;
1773
1774
fixture . detectChanges ( ) ;
1774
1775
expect ( dropdown . items ) . toBeDefined ( ) ;
1775
- expect ( dropdown . items . length ) . toEqual ( 9 ) ;
1776
+ expect ( dropdown . items . length ) . toEqual ( 5 ) ;
1776
1777
dropdown . onFocus ( ) ;
1777
1778
expect ( dropdown . focusedItem ) . toEqual ( dropdown . items [ 0 ] ) ;
1778
1779
expect ( dropdown . focusedItem . focused ) . toEqual ( true ) ;
@@ -1894,17 +1895,17 @@ describe('igxCombo', () => {
1894
1895
selectedItemsCount ++ ;
1895
1896
selectAndVerifyItem ( 0 ) ;
1896
1897
1897
- for ( let index = 1 ; index < 7 ; index ++ ) {
1898
+ for ( let index = 1 ; index < 5 ; index ++ ) {
1898
1899
focusAndVerifyItem ( index , 'ArrowDown' ) ;
1899
1900
}
1900
1901
selectedItemsCount ++ ;
1901
- selectAndVerifyItem ( 6 ) ;
1902
+ selectAndVerifyItem ( 4 ) ;
1902
1903
1903
- for ( let index = 5 ; index > 3 ; index -- ) {
1904
+ for ( let index = 3 ; index >= 2 ; index -- ) {
1904
1905
focusAndVerifyItem ( index , 'ArrowUp' ) ;
1905
1906
}
1906
1907
selectedItemsCount ++ ;
1907
- selectAndVerifyItem ( 4 ) ;
1908
+ selectAndVerifyItem ( 2 ) ;
1908
1909
} ) ;
1909
1910
it ( 'should properly navigate using HOME/END key' , ( async ( ) => {
1910
1911
let firstVisibleItem : Element ;
@@ -2072,7 +2073,7 @@ describe('igxCombo', () => {
2072
2073
const scrollbar = fixture . debugElement . query ( By . css ( `.${ CSS_CLASS_SCROLLBAR_VERTICAL } ` ) ) . nativeElement as HTMLElement ;
2073
2074
expect ( scrollbar . scrollTop ) . toEqual ( 0 ) ;
2074
2075
2075
- combo . virtualScrollContainer . scrollTo ( 16 ) ;
2076
+ combo . virtualScrollContainer . scrollTo ( 12 ) ;
2076
2077
await firstValueFrom ( combo . virtualScrollContainer . chunkLoad ) ;
2077
2078
fixture . detectChanges ( ) ;
2078
2079
let selectedItem = fixture . debugElement . queryAll ( By . css ( `.${ CSS_CLASS_DROPDOWNLISTITEM } ` ) ) [ 1 ] ;
@@ -2088,7 +2089,7 @@ describe('igxCombo', () => {
2088
2089
// Content was scrolled to bottom
2089
2090
expect ( scrollbar . scrollHeight - scrollbar . scrollTop ) . toEqual ( scrollbar . clientHeight ) ;
2090
2091
2091
- combo . virtualScrollContainer . scrollTo ( 5 ) ;
2092
+ combo . virtualScrollContainer . scrollTo ( 4 ) ;
2092
2093
await firstValueFrom ( combo . virtualScrollContainer . chunkLoad ) ;
2093
2094
fixture . detectChanges ( ) ;
2094
2095
selectedItem = fixture . debugElement . query ( By . css ( `.${ CSS_CLASS_SELECTED } ` ) ) ;
@@ -2163,15 +2164,14 @@ describe('igxCombo', () => {
2163
2164
expect ( input . nativeElement . value ) . toEqual ( expectedOutput ) ;
2164
2165
} ) ;
2165
2166
it ( 'should dismiss all selected items by pressing clear button' , ( ) => {
2166
- const expectedOutput = 'Kentucky, Ohio, Indiana' ;
2167
- combo . select ( [ 'Kentucky' , ' Ohio', 'Indiana' ] ) ;
2167
+ const expectedOutput = 'Ohio, Indiana' ;
2168
+ combo . select ( [ 'Ohio' , 'Indiana' ] ) ;
2168
2169
fixture . detectChanges ( ) ;
2169
2170
expect ( input . nativeElement . value ) . toEqual ( expectedOutput ) ;
2170
2171
combo . toggle ( ) ;
2171
2172
fixture . detectChanges ( ) ;
2172
2173
expect ( combo . dropdown . items [ 1 ] . selected ) . toBeTruthy ( ) ;
2173
2174
expect ( combo . dropdown . items [ 4 ] . selected ) . toBeTruthy ( ) ;
2174
- expect ( combo . dropdown . items [ 6 ] . selected ) . toBeTruthy ( ) ;
2175
2175
2176
2176
const clearBtn = fixture . debugElement . query ( By . css ( `.${ CSS_CLASS_CLEARBUTTON } ` ) ) ;
2177
2177
clearBtn . triggerEventHandler ( 'click' , UIInteractions . getMouseEvent ( 'click' ) ) ;
@@ -2184,7 +2184,6 @@ describe('igxCombo', () => {
2184
2184
fixture . detectChanges ( ) ;
2185
2185
expect ( combo . dropdown . items [ 1 ] . selected ) . toBeFalsy ( ) ;
2186
2186
expect ( combo . dropdown . items [ 4 ] . selected ) . toBeFalsy ( ) ;
2187
- expect ( combo . dropdown . items [ 6 ] . selected ) . toBeFalsy ( ) ;
2188
2187
} ) ;
2189
2188
it ( 'should show/hide clear button after selecting/deselecting items' , ( ) => {
2190
2189
// This is a workaround for issue github.com/angular/angular/issues/14235
@@ -2242,8 +2241,8 @@ describe('igxCombo', () => {
2242
2241
cancel : false
2243
2242
} ) ;
2244
2243
2245
- const selectedItem_2 = dropdown . items [ 5 ] ;
2246
- simulateComboItemClick ( 5 ) ;
2244
+ const selectedItem_2 = dropdown . items [ 4 ] ;
2245
+ simulateComboItemClick ( 4 ) ;
2247
2246
expect ( combo . selection [ 1 ] ) . toEqual ( selectedItem_2 . value ) ;
2248
2247
expect ( combo . value [ 1 ] ) . toEqual ( selectedItem_2 . value [ combo . valueKey ] ) ;
2249
2248
expect ( selectedItem_2 . selected ) . toBeTruthy ( ) ;
@@ -2691,19 +2690,19 @@ describe('igxCombo', () => {
2691
2690
combo . toggle ( ) ;
2692
2691
fixture . detectChanges ( ) ;
2693
2692
let headers = combo . dropdown . headers . map ( header => header . element . nativeElement . innerText ) ;
2694
- expect ( headers ) . toEqual ( [ 'Ángel' , 'Boris' , 'México' , 'Méxícó' ] ) ;
2693
+ expect ( headers ) . toEqual ( [ 'Ángel' , 'Boris' , 'México' ] ) ;
2695
2694
2696
2695
combo . groupSortingDirection = SortingDirection . Desc ;
2697
2696
combo . toggle ( ) ;
2698
2697
fixture . detectChanges ( ) ;
2699
2698
headers = combo . dropdown . headers . map ( header => header . element . nativeElement . innerText ) ;
2700
- expect ( headers ) . toEqual ( [ 'Méxícó' , 'México' , 'Boris' , 'Ángel' ] ) ;
2699
+ expect ( headers ) . toEqual ( [ 'Méxícó' , 'México' , 'Boris' ] ) ;
2701
2700
2702
2701
combo . groupSortingDirection = SortingDirection . None ;
2703
2702
combo . toggle ( ) ;
2704
2703
fixture . detectChanges ( ) ;
2705
2704
headers = combo . dropdown . headers . map ( header => header . element . nativeElement . innerText ) ;
2706
- expect ( headers ) . toEqual ( [ 'Méxícó' , 'Ángel' , 'México' , 'Boris' ] ) ;
2705
+ expect ( headers ) . toEqual ( [ 'Méxícó' , 'Ángel' , 'México' ] ) ;
2707
2706
} ) ;
2708
2707
} ) ;
2709
2708
describe ( 'Filtering tests: ' , ( ) => {
@@ -2862,8 +2861,8 @@ describe('igxCombo', () => {
2862
2861
2863
2862
verifyFilteredItems ( 'jose' , 1 ) ;
2864
2863
verifyFilteredItems ( 'mexico' , 3 ) ;
2865
- verifyFilteredItems ( 'o' , 7 ) ;
2866
- verifyFilteredItems ( 'é' , 7 ) ;
2864
+ verifyFilteredItems ( 'o' , 6 ) ;
2865
+ verifyFilteredItems ( 'é' , 6 ) ;
2867
2866
} ) ) ;
2868
2867
2869
2868
it ( 'should filter the dropdown items when typing in the search input' , fakeAsync ( ( ) => {
@@ -2888,9 +2887,9 @@ describe('igxCombo', () => {
2888
2887
dropdownItems = dropdownList . querySelectorAll ( `.${ CSS_CLASS_DROPDOWNLISTITEM } ` ) ;
2889
2888
expect ( dropdownItems . length ) . toEqual ( expectedItemsNumber ) ;
2890
2889
} ;
2891
- verifyFilteredItems ( 'M' , 7 ) ;
2890
+ verifyFilteredItems ( 'M' , 4 ) ;
2892
2891
2893
- verifyFilteredItems ( 'Mi' , 5 ) ;
2892
+ verifyFilteredItems ( 'Mi' , 3 ) ;
2894
2893
expectedValues = expectedValues . filter ( data => data . field . toLowerCase ( ) . includes ( 'mi' ) ) ;
2895
2894
checkFilteredItems ( dropdownItems ) ;
2896
2895
@@ -2960,9 +2959,9 @@ describe('igxCombo', () => {
2960
2959
expect ( combo . filteredData . length ) . toEqual ( expectedFilteredItemsNumber ) ;
2961
2960
} ;
2962
2961
2963
- verifyFilteredItems ( 'M' , 7 , 15 ) ;
2964
- verifyFilteredItems ( 'Mi' , 5 , 5 ) ;
2965
- verifyFilteredItems ( 'M' , 7 , 15 ) ;
2962
+ verifyFilteredItems ( 'M' , 4 , 15 ) ;
2963
+ verifyFilteredItems ( 'Mi' , 3 , 5 ) ;
2964
+ verifyFilteredItems ( 'M' , 4 , 15 ) ;
2966
2965
combo . filteredData . forEach ( ( item ) => expect ( combo . data ) . toContain ( item ) ) ;
2967
2966
} ) ;
2968
2967
it ( 'should clear the search input and close the dropdown list on pressing ESC key' , fakeAsync ( ( ) => {
@@ -3768,7 +3767,6 @@ class IgxComboFormComponent {
3768
3767
password : [ '' , Validators . required ] ,
3769
3768
townCombo : [ [ this . items [ 0 ] ] , Validators . required ]
3770
3769
} ) ;
3771
-
3772
3770
}
3773
3771
public onSubmitReactive ( ) { }
3774
3772
0 commit comments