@@ -87,16 +87,25 @@ test.describe('Example 10 - Large Select Dataset with Virtual Scroll', () => {
8787 await page . locator ( '[data-test="select10-2"].ms-parent' ) . click ( ) ;
8888 await page . locator ( '[data-test="select10-2"] .ms-search .ms-icon-close' ) . click ( ) ;
8989 await ulElm2 . evaluate ( e => ( e . scrollTop = 0 ) ) ;
90- await expect ( await liElms2 . nth ( 4 ) . locator ( 'span' ) . innerHTML ( ) ) . toBe ( '<i class="fa fa-star"></i> Task 4' ) ;
91- await expect ( await liElms2 . nth ( 5 ) . locator ( 'span' ) . innerHTML ( ) ) . toBe ( '<i class="fa fa-star"></i> Task 5' ) ;
92- expect ( await liElms2 . nth ( 4 ) . locator ( 'input[type=checkbox][data-key=option_4]' ) . isChecked ( ) ) . toBeTruthy ( ) ;
93- expect ( await liElms2 . nth ( 5 ) . locator ( 'input[type=checkbox][data-key=option_5]' ) . isChecked ( ) ) . toBeTruthy ( ) ;
94- expect ( await liElms2 . nth ( 6 ) . locator ( 'input[type=checkbox][data-key=option_6]' ) . isChecked ( ) ) . toBeFalsy ( ) ;
90+ await page . getByRole ( 'option' , { name : ' Task 4' , exact : true } ) ;
91+ await page . getByRole ( 'option' , { name : ' Task 5' , exact : true } ) ;
92+ expect (
93+ await page . getByRole ( 'option' , { name : ' Task 4' , exact : true } ) . locator ( 'input[type=checkbox][data-key=option_4]' ) . isChecked ( ) ,
94+ ) . toBeTruthy ( ) ;
95+ expect (
96+ await page . getByRole ( 'option' , { name : ' Task 5' , exact : true } ) . locator ( 'input[type=checkbox][data-key=option_5]' ) . isChecked ( ) ,
97+ ) . toBeTruthy ( ) ;
98+ expect (
99+ await page . getByRole ( 'option' , { name : ' Task 6' , exact : true } ) . locator ( 'input[type=checkbox][data-key=option_6]' ) . isChecked ( ) ,
100+ ) . toBeFalsy ( ) ;
95101
96102 // scroll back to middle and expect 5003 to still be checked
97103 await ulElm2 . evaluate ( e => ( e . scrollTop = e . scrollHeight / 2 ) ) ;
98104 expect ( await page . locator ( '[data-test="select10-2"] .ms-drop label' ) . filter ( { hasText : '5003' } ) ) . toBeVisible ( ) ;
99- expect ( await liElms2 . locator ( 'input[type=checkbox][data-key=option_5003]' ) . isChecked ( ) ) . toBeTruthy ( ) ;
105+ expect ( await page . getByRole ( 'option' , { name : ' Task 5003' , exact : true } ) . filter ( { hasText : '5003' } ) ) . toBeVisible ( ) ;
106+ expect (
107+ await page . getByRole ( 'option' , { name : ' Task 5003' , exact : true } ) . locator ( 'input[type=checkbox][data-key=option_5003]' ) . isChecked ( ) ,
108+ ) . toBeTruthy ( ) ;
100109 await page . locator ( '[data-test=select10-2].ms-parent' ) . click ( ) ; // close drop
101110 } ) ;
102111} ) ;
0 commit comments