Skip to content
Snippets Groups Projects
Unverified Commit b6a432fd authored by Kagami Sascha Rosylight's avatar Kagami Sascha Rosylight Committed by GitHub
Browse files

fix(storybook): solve test failures (#11262)

* fix(locales, storybook): use default import

* fix(storybook): solve test failures

* Update MkAd.stories.impl.ts
parent cd9affd5
No related branches found
No related tags found
No related merge requests found
......@@ -29,11 +29,11 @@ export const Default = {
const canvas = within(canvasElement);
const a = canvas.getByRole<HTMLAnchorElement>('link');
await expect(a.href).toMatch(/^https?:\/\/.*#test$/);
await userEvent.click(a, { button: 2 });
await userEvent.pointer({ keys: '[MouseRight]', target: a });
await tick();
const menu = canvas.getByRole('menu');
await expect(menu).toBeInTheDocument();
await userEvent.click(a, { button: 0 });
await userEvent.click(a);
a.blur();
await tick();
await expect(menu).not.toBeInTheDocument();
......
/* eslint-disable @typescript-eslint/explicit-function-return-type */
import { expect } from '@storybook/jest';
import { userEvent, within } from '@storybook/testing-library';
import { userEvent, waitFor, within } from '@storybook/testing-library';
import { StoryObj } from '@storybook/vue3';
import { i18n } from '@/i18n';
import MkAd from './MkAd.vue';
import { i18n } from '@/i18n';
const common = {
render(args) {
return {
......@@ -36,6 +36,7 @@ const common = {
const i = buttons[0];
await expect(i).toBeInTheDocument();
await userEvent.click(i);
await waitFor(() => expect(canvasElement).toHaveTextContent(i18n.ts._ad.back));
await expect(a).not.toBeInTheDocument();
await expect(i).not.toBeInTheDocument();
buttons = canvas.getAllByRole<HTMLButtonElement>('button');
......@@ -49,6 +50,7 @@ const common = {
await expect(back).toBeInTheDocument();
await expect(back).toHaveTextContent(i18n.ts._ad.back);
await userEvent.click(back);
await waitFor(() => expect(canvas.queryByRole('img')).toBeTruthy());
if (reduce) {
await expect(reduce).not.toBeInTheDocument();
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment