From 5ea0fadd38090c6a938851909068543cc4852d58 Mon Sep 17 00:00:00 2001 From: Ghislain B Date: Thu, 9 Nov 2023 02:03:55 -0500 Subject: [PATCH] chore: add more test for Large Dataset example (#155) --- playwright/e2e/example10.spec.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/playwright/e2e/example10.spec.ts b/playwright/e2e/example10.spec.ts index 3a19750ab..5df6d726f 100644 --- a/playwright/e2e/example10.spec.ts +++ b/playwright/e2e/example10.spec.ts @@ -31,5 +31,20 @@ test.describe('Example 10 - Large Select Dataset with Virtual Scroll', () => { await page.locator('label').filter({ hasText: '9998' }).click(); await page.locator('label').filter({ hasText: '9999' }).click(); await page.getByRole('button', { name: '0, 1, 5001' }).click(); + + // clear filter, scroll back to top and expect 0,1 to still be checked + await page.locator('[data-test="select10"].ms-parent').click(); + await page.locator('[data-test="select10"] .ms-search .icon-close').click(); + await ulElm.evaluate((e) => (e.scrollTop = 0)); + await expect(liElms.nth(0)).toContainText('0'); + await expect(liElms.nth(1)).toContainText('1'); + expect(await liElms.nth(0).locator('input[type=checkbox][data-key=option_0]').isChecked()).toBeTruthy(); + expect(await liElms.nth(1).locator('input[type=checkbox][data-key=option_1]').isChecked()).toBeTruthy(); + expect(await liElms.nth(2).locator('input[type=checkbox][data-key=option_2]').isChecked()).toBeFalsy(); + + // scroll back to middle and expect 5001 to still be checked + await ulElm.evaluate((e) => (e.scrollTop = e.scrollHeight / 2)); + expect(await page.locator('label').filter({ hasText: '5001' })).toBeVisible(); + expect(await liElms.locator('input[type=checkbox][data-key=option_5001]').isChecked()).toBeTruthy(); }); });