@@ -23,6 +23,7 @@ const CSS_CLASS_COMBO = 'igx-combo';
23
23
const CSS_CLASS_COMBO_DROPDOWN = 'igx-combo__drop-down' ;
24
24
const CSS_CLASS_DROPDOWN = 'igx-drop-down' ;
25
25
const CSS_CLASS_DROPDOWNLIST = 'igx-drop-down__list' ;
26
+ const CSS_CLASS_DROPDOWNLIST_SCROLL = 'igx-drop-down__list-scroll' ;
26
27
const CSS_CLASS_CONTENT = 'igx-combo__content' ;
27
28
const CSS_CLASS_CONTAINER = 'igx-display-container' ;
28
29
const CSS_CLASS_DROPDOWNLISTITEM = 'igx-drop-down__item' ;
@@ -233,7 +234,7 @@ describe('igxCombo', () => {
233
234
tick ( ) ;
234
235
fixture . detectChanges ( ) ;
235
236
expect ( combo . headerTemplate ) . toBeDefined ( ) ;
236
- const dropdownList : HTMLElement = fixture . debugElement . query ( By . css ( '.' + CSS_CLASS_DROPDOWNLIST ) ) . nativeElement ;
237
+ const dropdownList : HTMLElement = fixture . debugElement . query ( By . css ( '.' + CSS_CLASS_DROPDOWNLIST_SCROLL ) ) . nativeElement ;
237
238
headerElement = fixture . debugElement . query ( By . css ( '.' + CSS_CLASS_HEADER ) ) ;
238
239
expect ( headerElement ) . not . toBeNull ( ) ;
239
240
const headerHTMLElement = fixture . debugElement . query ( By . css ( '.' + CSS_CLASS_HEADER ) ) . nativeElement ;
@@ -250,7 +251,7 @@ describe('igxCombo', () => {
250
251
tick ( ) ;
251
252
fixture . detectChanges ( ) ;
252
253
expect ( combo . footerTemplate ) . toBeDefined ( ) ;
253
- const dropdownList : HTMLElement = fixture . debugElement . query ( By . css ( '.' + CSS_CLASS_DROPDOWNLIST ) ) . nativeElement ;
254
+ const dropdownList : HTMLElement = fixture . debugElement . query ( By . css ( '.' + CSS_CLASS_DROPDOWNLIST_SCROLL ) ) . nativeElement ;
254
255
footerElement = fixture . debugElement . query ( By . css ( '.' + CSS_CLASS_FOOTER ) ) ;
255
256
expect ( footerElement ) . not . toBeNull ( ) ;
256
257
const footerHTMLElement = fixture . debugElement . query ( By . css ( '.' + CSS_CLASS_FOOTER ) ) . nativeElement ;
@@ -512,15 +513,16 @@ describe('igxCombo', () => {
512
513
const searchInputElement = fixture . debugElement . query ( By . css ( 'input[name=\'searchInput\']' ) ) . nativeElement ;
513
514
expect ( searchInputElement ) . toBeDefined ( ) ;
514
515
const dropdownList = fixture . debugElement . query ( By . css ( '.' + CSS_CLASS_DROPDOWNLIST ) ) . nativeElement ;
516
+ const dropdownListScrollContainer = fixture . debugElement . query ( By . css ( '.' + CSS_CLASS_DROPDOWNLIST_SCROLL ) ) . nativeElement ;
515
517
expect ( dropdownList . classList . contains ( CSS_CLASS_TOGGLE ) ) . toBeTruthy ( ) ;
516
- const dropdownItems = dropdownList . querySelectorAll ( '.' + CSS_CLASS_DROPDOWNLISTITEM ) ;
518
+ const dropdownItems = dropdownListScrollContainer . querySelectorAll ( '.' + CSS_CLASS_DROPDOWNLISTITEM ) ;
517
519
expect ( dropdownItems . length ) . toEqual ( 11 ) ;
518
520
comboButton . click ( ) ;
519
521
tick ( ) ;
520
522
fixture . detectChanges ( ) ;
521
523
expect ( combo . collapsed ) . toEqual ( true ) ;
522
524
expect ( dropdownList . classList . contains ( CSS_CLASS_TOGGLE + '--hidden' ) ) . toBeTruthy ( ) ;
523
- expect ( dropdownList . children . length ) . toEqual ( 0 ) ;
525
+ expect ( dropdownListScrollContainer . children . length ) . toEqual ( 0 ) ;
524
526
} ) ) ;
525
527
it ( 'Should focus search input after dropdown has been opened' , fakeAsync ( ( ) => {
526
528
let isFocused = false ;
@@ -606,7 +608,7 @@ describe('igxCombo', () => {
606
608
tick ( ) ;
607
609
fixture . detectChanges ( ) ;
608
610
609
- const dropdownList = fixture . debugElement . query ( By . css ( '.' + CSS_CLASS_DROPDOWNLIST ) ) . nativeElement ;
611
+ const dropdownList = fixture . debugElement . query ( By . css ( '.' + CSS_CLASS_DROPDOWNLIST_SCROLL ) ) . nativeElement ;
610
612
const dropdownItems = dropdownList . querySelectorAll ( '.' + CSS_CLASS_DROPDOWNLISTITEM ) ;
611
613
const dropdownContent = fixture . debugElement . query ( By . css ( '.' + CSS_CLASS_CONTENT ) ) . nativeElement ;
612
614
let focusedItems = dropdownList . querySelectorAll ( '.' + CSS_CLASS_FOCUSED ) ;
@@ -1183,7 +1185,7 @@ describe('igxCombo', () => {
1183
1185
1184
1186
comboButton . click ( ) ;
1185
1187
fixture . detectChanges ( ) ;
1186
- const dropdownList = fixture . debugElement . query ( By . css ( '.' + CSS_CLASS_DROPDOWNLIST ) ) . nativeElement ;
1188
+ const dropdownList = fixture . debugElement . query ( By . css ( '.' + CSS_CLASS_DROPDOWNLIST_SCROLL ) ) . nativeElement ;
1187
1189
1188
1190
const verifySelectedItem = function ( itemIndex : number ) {
1189
1191
clickItemCheckbox ( dropdownList , itemIndex ) ;
@@ -1212,7 +1214,7 @@ describe('igxCombo', () => {
1212
1214
comboButton . click ( ) ;
1213
1215
fixture . detectChanges ( ) ;
1214
1216
const dropdownContent = fixture . debugElement . query ( By . css ( '.' + CSS_CLASS_CONTENT ) ) . nativeElement ;
1215
- const dropdownList = fixture . debugElement . query ( By . css ( '.' + CSS_CLASS_DROPDOWNLIST ) ) . nativeElement ;
1217
+ const dropdownList = fixture . debugElement . query ( By . css ( '.' + CSS_CLASS_DROPDOWNLIST_SCROLL ) ) . nativeElement ;
1216
1218
1217
1219
clickItemCheckbox ( dropdownList , 3 ) ;
1218
1220
fixture . detectChanges ( ) ;
@@ -1243,7 +1245,7 @@ describe('igxCombo', () => {
1243
1245
combo . toggle ( ) ;
1244
1246
tick ( ) ;
1245
1247
fixture . detectChanges ( ) ;
1246
- const dropdownList = fixture . debugElement . query ( By . css ( '.' + CSS_CLASS_DROPDOWNLIST ) ) . nativeElement ;
1248
+ const dropdownList = fixture . debugElement . query ( By . css ( '.' + CSS_CLASS_DROPDOWNLIST_SCROLL ) ) . nativeElement ;
1247
1249
1248
1250
clickItemCheckbox ( dropdownList , 3 ) ;
1249
1251
fixture . detectChanges ( ) ;
@@ -1299,7 +1301,7 @@ describe('igxCombo', () => {
1299
1301
combo . toggle ( ) ;
1300
1302
tick ( ) ;
1301
1303
fixture . detectChanges ( ) ;
1302
- const dropdownList = fixture . debugElement . query ( By . css ( '.' + CSS_CLASS_DROPDOWNLIST ) ) . nativeElement ;
1304
+ const dropdownList = fixture . debugElement . query ( By . css ( '.' + CSS_CLASS_DROPDOWNLIST_SCROLL ) ) . nativeElement ;
1303
1305
let selectedItemIndex = - 1 ;
1304
1306
1305
1307
const verifySelectedItem = function ( itemIndex : number ) {
@@ -1339,7 +1341,7 @@ describe('igxCombo', () => {
1339
1341
combo . toggle ( ) ;
1340
1342
tick ( ) ;
1341
1343
fixture . detectChanges ( ) ;
1342
- const dropdownList = fixture . debugElement . query ( By . css ( '.' + CSS_CLASS_DROPDOWNLIST ) ) . nativeElement ;
1344
+ const dropdownList = fixture . debugElement . query ( By . css ( '.' + CSS_CLASS_DROPDOWNLIST_SCROLL ) ) . nativeElement ;
1343
1345
clickItemCheckbox ( dropdownList , 8 ) ;
1344
1346
fixture . detectChanges ( ) ;
1345
1347
expect ( fixture . debugElement . queryAll ( By . css ( '.' + CSS_CLASS_CLEARBUTTON ) ) . length ) . toEqual ( 1 ) ;
@@ -1387,7 +1389,7 @@ describe('igxCombo', () => {
1387
1389
combo . toggle ( ) ;
1388
1390
tick ( ) ;
1389
1391
fixture . detectChanges ( ) ;
1390
- const dropdownList = fixture . debugElement . query ( By . css ( '.' + CSS_CLASS_DROPDOWNLIST ) ) . nativeElement ;
1392
+ const dropdownList = fixture . debugElement . query ( By . css ( '.' + CSS_CLASS_DROPDOWNLIST_SCROLL ) ) . nativeElement ;
1391
1393
let selectedItemIndex = 0 ;
1392
1394
1393
1395
const verifySelectedItem = function ( itemIndex : number ) {
@@ -1432,7 +1434,7 @@ describe('igxCombo', () => {
1432
1434
combo . toggle ( ) ;
1433
1435
tick ( ) ;
1434
1436
fixture . detectChanges ( ) ;
1435
- const dropdownList = fixture . debugElement . query ( By . css ( '.' + CSS_CLASS_DROPDOWNLIST ) ) . nativeElement ;
1437
+ const dropdownList = fixture . debugElement . query ( By . css ( '.' + CSS_CLASS_DROPDOWNLIST_SCROLL ) ) . nativeElement ;
1436
1438
const verifyOnSelectionChangeEventIsFired = function ( itemIndex : number ) {
1437
1439
const dropdownItems = fixture . debugElement . queryAll ( By . css ( '.' + CSS_CLASS_DROPDOWNLISTITEM ) ) ;
1438
1440
const checkbox = dropdownItems [ itemIndex ] ;
@@ -1467,7 +1469,7 @@ describe('igxCombo', () => {
1467
1469
combo . toggle ( ) ;
1468
1470
tick ( ) ;
1469
1471
fixture . detectChanges ( ) ;
1470
- const dropdown = fixture . debugElement . query ( By . css ( '.' + CSS_CLASS_DROPDOWNLIST ) ) . nativeElement ;
1472
+ const dropdown = fixture . debugElement . query ( By . css ( '.' + CSS_CLASS_DROPDOWNLIST_SCROLL ) ) . nativeElement ;
1471
1473
let selectedItemIndex = - 1 ;
1472
1474
1473
1475
const verifySelectedItem = function ( dropdownItemIndex : number , dataItemIndex : number ) {
@@ -1533,7 +1535,7 @@ describe('igxCombo', () => {
1533
1535
combo . toggle ( ) ;
1534
1536
tick ( ) ;
1535
1537
fixture . detectChanges ( ) ;
1536
- const dropdownList = fixture . debugElement . query ( By . css ( '.' + CSS_CLASS_DROPDOWNLIST ) ) . nativeElement ;
1538
+ const dropdownList = fixture . debugElement . query ( By . css ( '.' + CSS_CLASS_DROPDOWNLIST_SCROLL ) ) . nativeElement ;
1537
1539
let selectedItemIndex = 0 ;
1538
1540
1539
1541
clickItemCheckbox ( dropdownList , 3 ) ;
@@ -1703,9 +1705,10 @@ describe('igxCombo', () => {
1703
1705
expect ( dropDownElement . childElementCount ) . toEqual ( 1 ) ;
1704
1706
1705
1707
const dropDownList = dropDownElement . children [ 0 ] ;
1708
+ const dropDownScrollList = dropDownElement . children [ 0 ] . children [ 0 ] ;
1706
1709
expect ( dropDownList . classList . contains ( CSS_CLASS_DROPDOWNLIST ) ) . toBeTruthy ( ) ;
1707
1710
expect ( dropDownList . classList . contains ( 'igx-toggle--hidden' ) ) . toBeTruthy ( ) ;
1708
- expect ( dropDownList . childElementCount ) . toEqual ( 0 ) ;
1711
+ expect ( dropDownScrollList . childElementCount ) . toEqual ( 0 ) ;
1709
1712
} ) ;
1710
1713
it ( 'Should render aria attribute properly' , fakeAsync ( ( ) => {
1711
1714
const fix = TestBed . createComponent ( IgxComboSampleComponent ) ;
@@ -1871,7 +1874,7 @@ describe('igxCombo', () => {
1871
1874
dropDownButton . click ( ) ;
1872
1875
tick ( ) ;
1873
1876
fixture . detectChanges ( ) ;
1874
- const dropdownList = fixture . debugElement . query ( By . css ( '.' + CSS_CLASS_DROPDOWNLIST ) ) . nativeElement ;
1877
+ const dropdownList = fixture . debugElement . query ( By . css ( '.' + CSS_CLASS_DROPDOWNLIST_SCROLL ) ) . nativeElement ;
1875
1878
const dropdownItems = dropdownList . querySelectorAll ( '.' + CSS_CLASS_DROPDOWNLISTITEM ) ;
1876
1879
selectedItem = dropdownItems [ 4 ] ;
1877
1880
expect ( selectedItem . classList . contains ( CSS_CLASS_SELECTED ) ) . toBeFalsy ( ) ;
@@ -1905,7 +1908,7 @@ describe('igxCombo', () => {
1905
1908
dropdown . navigateItem ( 2 ) ;
1906
1909
fixture . detectChanges ( ) ;
1907
1910
1908
- const dropdownList = fixture . debugElement . query ( By . css ( '.' + CSS_CLASS_DROPDOWNLIST ) ) . nativeElement ;
1911
+ const dropdownList = fixture . debugElement . query ( By . css ( '.' + CSS_CLASS_DROPDOWNLIST_SCROLL ) ) . nativeElement ;
1909
1912
const dropdownItems = dropdownList . querySelectorAll ( '.' + CSS_CLASS_DROPDOWNLISTITEM ) ;
1910
1913
const focusedItem_1 = dropdownItems [ 2 ] ;
1911
1914
expect ( focusedItem_1 . classList . contains ( CSS_CLASS_FOCUSED ) ) . toBeTruthy ( ) ;
@@ -1930,7 +1933,7 @@ describe('igxCombo', () => {
1930
1933
dropdown . navigateItem ( 2 ) ; // Componenent is virtualized, so this will focus the ACTUAL 3rd item
1931
1934
fixture . detectChanges ( ) ;
1932
1935
1933
- const dropdownList = fixture . debugElement . query ( By . css ( '.' + CSS_CLASS_DROPDOWNLIST ) ) . nativeElement ;
1936
+ const dropdownList = fixture . debugElement . query ( By . css ( '.' + CSS_CLASS_DROPDOWNLIST_SCROLL ) ) . nativeElement ;
1934
1937
const dropdownItems = dropdownList . querySelectorAll ( '.' + CSS_CLASS_DROPDOWNLISTITEM ) ;
1935
1938
const focusedItem_1 = dropdownItems [ 1 ] ;
1936
1939
expect ( focusedItem_1 . classList . contains ( CSS_CLASS_FOCUSED ) ) . toBeTruthy ( ) ;
@@ -1961,7 +1964,7 @@ describe('igxCombo', () => {
1961
1964
fixture . detectChanges ( ) ;
1962
1965
tick ( ) ;
1963
1966
const inputElement = fixture . debugElement . query ( By . css ( '.' + CSS_CLASS_INPUTGROUP_WRAPPER ) ) . nativeElement ;
1964
- const dropDownElement = fixture . debugElement . query ( By . css ( '.' + CSS_CLASS_DROPDOWNLIST ) ) . nativeElement ;
1967
+ const dropDownElement = fixture . debugElement . query ( By . css ( '.' + CSS_CLASS_DROPDOWNLIST_SCROLL ) ) . nativeElement ;
1965
1968
containerElementWidth = containerElement . getBoundingClientRect ( ) . width ;
1966
1969
wrapperWidth = comboWrapper . getBoundingClientRect ( ) . width ;
1967
1970
const inputWidth = inputElement . getBoundingClientRect ( ) . width ;
@@ -1990,7 +1993,7 @@ describe('igxCombo', () => {
1990
1993
fixture . detectChanges ( ) ;
1991
1994
1992
1995
let inputElement = fixture . debugElement . query ( By . css ( '.' + CSS_CLASS_INPUTGROUP_WRAPPER ) ) . nativeElement ;
1993
- let dropDownElement = fixture . debugElement . query ( By . css ( '.' + CSS_CLASS_DROPDOWNLIST ) ) . nativeElement ;
1996
+ let dropDownElement = fixture . debugElement . query ( By . css ( '.' + CSS_CLASS_DROPDOWNLIST_SCROLL ) ) . nativeElement ;
1994
1997
containerElementWidth = containerElement . style . width ;
1995
1998
wrapperWidth = comboWrapper . style . width ;
1996
1999
let inputWidth = inputElement . getBoundingClientRect ( ) . width + 'px' ;
@@ -2014,7 +2017,7 @@ describe('igxCombo', () => {
2014
2017
2015
2018
comboWrapper = fixture . debugElement . query ( By . css ( CSS_CLASS_COMBO ) ) . nativeElement ;
2016
2019
inputElement = fixture . debugElement . query ( By . css ( '.' + CSS_CLASS_INPUTGROUP_WRAPPER ) ) . nativeElement ;
2017
- dropDownElement = fixture . debugElement . query ( By . css ( '.' + CSS_CLASS_DROPDOWNLIST ) ) . nativeElement ;
2020
+ dropDownElement = fixture . debugElement . query ( By . css ( '.' + CSS_CLASS_DROPDOWNLIST_SCROLL ) ) . nativeElement ;
2018
2021
containerElementWidth = containerElement . style . width ;
2019
2022
wrapperWidth = comboWrapper . style . width ;
2020
2023
inputWidth = inputElement . getBoundingClientRect ( ) . width + 'px' ;
@@ -2145,7 +2148,7 @@ describe('igxCombo', () => {
2145
2148
for ( let itemIndex = 0 ; itemIndex < 10 ; itemIndex ++ ) {
2146
2149
expect ( combo . data [ itemIndex ] . id ) . toEqual ( ind ) ;
2147
2150
expect ( combo . data [ itemIndex ] . product ) . toEqual ( 'Product ' + ind ) ;
2148
- const dropdownList = fixture . debugElement . query ( By . css ( '.' + CSS_CLASS_DROPDOWNLIST ) ) . nativeElement ;
2151
+ const dropdownList = fixture . debugElement . query ( By . css ( '.' + CSS_CLASS_DROPDOWNLIST_SCROLL ) ) . nativeElement ;
2149
2152
const dropdownItems = dropdownList . querySelectorAll ( '.' + CSS_CLASS_DROPDOWNLISTITEM ) ;
2150
2153
expect ( dropdownItems [ itemIndex ] . innerText . trim ( ) ) . toEqual ( 'Product ' + ind ) ;
2151
2154
ind ++ ;
@@ -2202,7 +2205,7 @@ describe('igxCombo', () => {
2202
2205
combo . toggle ( ) ;
2203
2206
fixture . detectChanges ( ) ;
2204
2207
2205
- dropdownList = fixture . debugElement . query ( By . css ( '.' + CSS_CLASS_DROPDOWNLIST ) ) . nativeElement ;
2208
+ dropdownList = fixture . debugElement . query ( By . css ( '.' + CSS_CLASS_DROPDOWNLIST_SCROLL ) ) . nativeElement ;
2206
2209
dropdownItems = dropdownList . querySelectorAll ( '.' + CSS_CLASS_DROPDOWNLISTITEM ) ;
2207
2210
selectedItem = dropdownItems [ 0 ] ;
2208
2211
itemCheckbox = selectedItem . querySelector ( '.' + CSS_CLASS_CHECKBOX ) ;
@@ -2317,7 +2320,7 @@ describe('igxCombo', () => {
2317
2320
combo . toggle ( ) ;
2318
2321
tick ( ) ;
2319
2322
fixture . detectChanges ( ) ;
2320
- const dropdownList = fixture . debugElement . query ( By . css ( '.' + CSS_CLASS_DROPDOWNLIST ) ) . nativeElement ;
2323
+ const dropdownList = fixture . debugElement . query ( By . css ( '.' + CSS_CLASS_DROPDOWNLIST_SCROLL ) ) . nativeElement ;
2321
2324
const dropdownItemsContainer = fixture . debugElement . query ( By . css ( '.' + CSS_CLASS_CONTENT ) ) . nativeElement ;
2322
2325
const dropDownContainer = fixture . debugElement . query ( By . css ( '.' + CSS_CLASS_CONTAINER ) ) . nativeElement ;
2323
2326
const listItems = dropDownContainer . querySelectorAll ( '.' + CSS_CLASS_DROPDOWNLISTITEM ) ;
@@ -2670,7 +2673,7 @@ describe('igxCombo', () => {
2670
2673
searchInputElement = searchInput . nativeElement ;
2671
2674
UIInteractions . sendInput ( searchInput , 'P' , fixture ) ;
2672
2675
fixture . detectChanges ( ) ;
2673
- dropdownList = fixture . debugElement . query ( By . css ( '.' + CSS_CLASS_DROPDOWNLIST ) ) . nativeElement ;
2676
+ dropdownList = fixture . debugElement . query ( By . css ( '.' + CSS_CLASS_DROPDOWNLIST_SCROLL ) ) . nativeElement ;
2674
2677
dropDownContainer = fixture . debugElement . query ( By . css ( '.' + CSS_CLASS_CONTAINER ) ) . nativeElement ;
2675
2678
listItems = dropDownContainer . querySelectorAll ( '.' + CSS_CLASS_DROPDOWNLISTITEM ) ;
2676
2679
expect ( listItems . length ) . toEqual ( 5 ) ;
0 commit comments