From b2ca3ff0efcf61a6048818c0e56715657c618fd5 Mon Sep 17 00:00:00 2001 From: Joan Perals Tresserra Date: Wed, 20 Sep 2023 11:42:41 +0200 Subject: [PATCH] Update test --- src/internal/components/dropdown/__integ__/width.test.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/internal/components/dropdown/__integ__/width.test.ts b/src/internal/components/dropdown/__integ__/width.test.ts index 0d15f8b648..6d11652b4c 100644 --- a/src/internal/components/dropdown/__integ__/width.test.ts +++ b/src/internal/components/dropdown/__integ__/width.test.ts @@ -135,7 +135,7 @@ describe('Dropdown width', () => { expect(dropdownBox.left + dropdownBox.width).toBeLessThanOrEqual(pageWidth); }); }); - describe('updates between re-renders', () => { + describe('keeps not overflowing the viewport after re-rendering wider', () => { const pageWidth = 500; testForAllCases( { pageWidth, triggerWidth, asyncLoading: true }, @@ -145,13 +145,13 @@ describe('Dropdown width', () => { page, expandToViewport, }); - const oldWidth = dropdownBox.width; + expect(dropdownBox.left + dropdownBox.width).toBeLessThanOrEqual(pageWidth); await expect(page.getText(dropdownSelector)).resolves.toContain('Loading'); await page.waitUntil(async () => (await page.getText(dropdownSelector)).includes('A very'), { timeout: 1000, }); - const newWidth = (await page.getBoundingBox(dropdownSelector)).width; - expect(newWidth).toBeGreaterThan(oldWidth); + const newBox = await page.getBoundingBox(dropdownSelector); + expect(newBox.left + newBox.width).toBeLessThanOrEqual(pageWidth); } ); });