Skip to content

Commit 885be28

Browse files
committed
test(#10336): use waitFor
1 parent 8bbce8c commit 885be28

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

packages/frontend/src/components/MkGalleryPostPreview.stories.impl.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
/* eslint-disable @typescript-eslint/explicit-function-return-type */
2+
import { expect } from '@storybook/jest';
3+
import { userEvent, waitFor, within } from '@storybook/testing-library';
24
import { StoryObj } from '@storybook/vue3';
35
import { galleryPost } from '../../.storybook/fakes';
46
import MkGalleryPostPreview from './MkGalleryPostPreview.vue';
5-
import { userEvent, within } from '@storybook/testing-library';
6-
import { expect } from '@storybook/jest';
77
export const Default = {
88
render(args) {
99
return {
@@ -50,7 +50,7 @@ export const Hover = {
5050
await Default.play(context);
5151
const canvas = within(context.canvasElement);
5252
const links = canvas.getAllByRole('link');
53-
await userEvent.hover(links[0]);
53+
await waitFor(() => userEvent.hover(links[0]));
5454
},
5555
} satisfies StoryObj<typeof MkGalleryPostPreview>;
5656
export const HoverThenUnhover = {
@@ -59,7 +59,7 @@ export const HoverThenUnhover = {
5959
await Hover.play(context);
6060
const canvas = within(context.canvasElement);
6161
const links = canvas.getAllByRole('link');
62-
await userEvent.unhover(links[0]);
62+
await waitFor(() => userEvent.unhover(links[0]));
6363
},
6464
} satisfies StoryObj<typeof MkGalleryPostPreview>;
6565
export const Sensitive = {

packages/frontend/src/components/global/MkUrl.stories.impl.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* eslint-disable @typescript-eslint/explicit-function-return-type */
22
import { expect } from '@storybook/jest';
3-
import { userEvent, within } from '@storybook/testing-library';
3+
import { userEvent, waitFor, within } from '@storybook/testing-library';
44
import { StoryObj } from '@storybook/vue3';
55
import { rest } from 'msw';
66
import { commonHandlers } from '../../../.storybook/mocks';
@@ -30,7 +30,7 @@ export const Default = {
3030
const canvas = within(canvasElement);
3131
const a = canvas.getByRole<HTMLAnchorElement>('link');
3232
await expect(a).toHaveAttribute('href', 'https://misskey-hub.net/');
33-
await userEvent.hover(a);
33+
await waitFor(() => userEvent.hover(a));
3434
/*
3535
await tick(); // FIXME: wait for network request
3636
const anchors = canvas.getAllByRole<HTMLAnchorElement>('link');
@@ -44,7 +44,7 @@ export const Default = {
4444
await expect(icon).toBeInTheDocument();
4545
await expect(icon).toHaveAttribute('src', 'https://misskey-hub.net/favicon.ico');
4646
*/
47-
await userEvent.unhover(a);
47+
await waitFor(() => userEvent.unhover(a));
4848
},
4949
args: {
5050
url: 'https://misskey-hub.net/',

0 commit comments

Comments
 (0)