From bc6d576a4ec15df8fb569c6e4dc0d379a2e81480 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Acid=20Chicken=20=28=E7=A1=AB=E9=85=B8=E9=B6=8F=29?= Date: Sat, 25 Mar 2023 23:35:47 +0900 Subject: [PATCH] build(#10336): add an interaction test for `` --- .../src/components/global/MkA.stories.impl.ts | 18 +++++++++--------- .../src/components/global/MkA.stories.ts | 3 +++ 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/packages/frontend/src/components/global/MkA.stories.impl.ts b/packages/frontend/src/components/global/MkA.stories.impl.ts index b1a88be5a..3afec7f81 100644 --- a/packages/frontend/src/components/global/MkA.stories.impl.ts +++ b/packages/frontend/src/components/global/MkA.stories.impl.ts @@ -25,15 +25,6 @@ export const Default = { template: 'Text', }; }, - args: { - to: '#test', - }, - parameters: { - layout: 'centered', - }, -} satisfies StoryObj; -export const ContextMenu = { - ...Default, async play({ canvasElement }) { const canvas = within(canvasElement); const a = canvas.getByRole('link'); @@ -42,5 +33,14 @@ export const ContextMenu = { await tick(); const menu = canvas.getByRole('menu'); await expect(menu).toBeInTheDocument(); + await userEvent.click(a, { button: 0 }); + await tick(); + await expect(menu).not.toBeInTheDocument(); + }, + args: { + to: '#test', + }, + parameters: { + layout: 'centered', }, } satisfies StoryObj; diff --git a/packages/frontend/src/components/global/MkA.stories.ts b/packages/frontend/src/components/global/MkA.stories.ts index ce648f2d5..5bb6b3b5a 100644 --- a/packages/frontend/src/components/global/MkA.stories.ts +++ b/packages/frontend/src/components/global/MkA.stories.ts @@ -41,6 +41,9 @@ export const Default = { await tick(); const menu = canvas.getByRole('menu'); await expect(menu).toBeInTheDocument(); + await userEvent.click(a, { button: 0 }); + await tick(); + await expect(menu).not.toBeInTheDocument(); }, args: { to: '#test',