From 1a910be78c2ef2ef49cdc53246cfb6c4051b0e0b Mon Sep 17 00:00:00 2001 From: Johan Bisse Mattsson Date: Fri, 29 Nov 2024 10:35:24 +0100 Subject: [PATCH] chore(supersearch): add test for closing expanded search --- packages/supersearch/e2e/supersearch.spec.ts | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/packages/supersearch/e2e/supersearch.spec.ts b/packages/supersearch/e2e/supersearch.spec.ts index 9a67f12c7..dbd1b5eb8 100644 --- a/packages/supersearch/e2e/supersearch.spec.ts +++ b/packages/supersearch/e2e/supersearch.spec.ts @@ -41,6 +41,26 @@ three`) ).toHaveText('One two three'); }); +test('expanded search is closable', async ({ page }) => { + await page.locator('[data-test-id="test1"]').getByRole('textbox').locator('div').click(); + await expect(page.locator('[data-test-id="test1"]').getByRole('dialog').first()).toBeVisible(); + await page.keyboard.press('Escape'); + await expect( + page.locator('[data-test-id="test1"]').getByRole('dialog').first(), + 'by pressing the Escape key' + ).not.toBeVisible(); + await page.locator('[data-test-id="test1"]').getByRole('textbox').locator('div').click(); + await page + .locator('[data-test-id="test1"]') + .getByRole('dialog') + .first() + .click({ position: { x: 0, y: 0 } }); + await expect( + page.locator('[data-test-id="test1"]').getByRole('dialog').first(), + 'by clicking outside' + ).not.toBeVisible(); +}); + test('syncs collapsed and expanded editor views', async ({ page }) => { await page.locator('[data-test-id="test1"]').getByRole('textbox').locator('div').click(); await page