build(#10336): add an interaction test for <MkA/>

This commit is contained in:
Acid Chicken (硫酸鶏) 2023-03-25 23:35:47 +09:00
parent 356fd72603
commit bc6d576a4e
No known key found for this signature in database
GPG Key ID: 3E87B98A3F6BAB99
2 changed files with 12 additions and 9 deletions

View File

@ -25,15 +25,6 @@ export const Default = {
template: '<MkA v-bind="props">Text</MkA>',
};
},
args: {
to: '#test',
},
parameters: {
layout: 'centered',
},
} satisfies StoryObj<typeof MkA>;
export const ContextMenu = {
...Default,
async play({ canvasElement }) {
const canvas = within(canvasElement);
const a = canvas.getByRole<HTMLAnchorElement>('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<typeof MkA>;

View File

@ -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',