diff options
| author | Acid Chicken (硫酸鶏) <root@acid-chicken.com> | 2023-03-31 16:34:54 +0900 |
|---|---|---|
| committer | Acid Chicken (硫酸鶏) <root@acid-chicken.com> | 2023-03-31 16:34:54 +0900 |
| commit | 558d73b21a91fc19c73682394f0f87cd6ca228ea (patch) | |
| tree | 9c2bb0ef05914840d097565b4048bb8f4aebcca7 /packages/frontend/src | |
| parent | Merge branch 'develop' of https://github.com/misskey-dev/misskey into storybook (diff) | |
| download | misskey-558d73b21a91fc19c73682394f0f87cd6ca228ea.tar.gz misskey-558d73b21a91fc19c73682394f0f87cd6ca228ea.tar.bz2 misskey-558d73b21a91fc19c73682394f0f87cd6ca228ea.zip | |
build(#10336): fix missing type definition
Diffstat (limited to 'packages/frontend/src')
| -rw-r--r-- | packages/frontend/src/components/global/MkAd.stories.impl.ts | 13 | ||||
| -rw-r--r-- | packages/frontend/src/components/global/MkAd.stories.ts | 5 | ||||
| -rw-r--r-- | packages/frontend/src/scripts/test-utils.ts | 2 |
3 files changed, 15 insertions, 5 deletions
diff --git a/packages/frontend/src/components/global/MkAd.stories.impl.ts b/packages/frontend/src/components/global/MkAd.stories.impl.ts index c5c5354222..767f8c691b 100644 --- a/packages/frontend/src/components/global/MkAd.stories.impl.ts +++ b/packages/frontend/src/components/global/MkAd.stories.impl.ts @@ -2,6 +2,7 @@ import { expect } from '@storybook/jest'; import { userEvent, within } from '@storybook/testing-library'; import { StoryObj } from '@storybook/vue3'; +import { i18n } from '@/i18n'; import MkAd from './MkAd.vue'; const common = { render(args) { @@ -38,13 +39,15 @@ const common = { await expect(a).not.toBeInTheDocument(); await expect(i).not.toBeInTheDocument(); buttons = canvas.getAllByRole<HTMLButtonElement>('button'); - await expect(buttons).toHaveLength(args._hasReduce ? 2 : 1); - const reduce = args._hasReduce ? buttons[0] : null; - const back = buttons[args._hasReduce ? 1 : 0]; + await expect(buttons).toHaveLength(args.__hasReduce ? 2 : 1); + const reduce = args.__hasReduce ? buttons[0] : null; + const back = buttons[args.__hasReduce ? 1 : 0]; if (reduce) { await expect(reduce).toBeInTheDocument(); + await expect(reduce.textContent).toBe(i18n.ts._ad.reduceFrequencyOfThisAd); } await expect(back).toBeInTheDocument(); + await expect(back.textContent).toBe(i18n.ts._ad.back); await userEvent.click(back); if (reduce) { await expect(reduce).not.toBeInTheDocument(); @@ -62,7 +65,7 @@ const common = { radio: 1, url: '#test', }, - _hasReduce: true, + __hasReduce: true, }, parameters: { layout: 'centered', @@ -112,6 +115,6 @@ export const ZeroRatio = { ...Square.args.specify, ratio: 0, }, - _hasReduce: false, + __hasReduce: false, }, }; diff --git a/packages/frontend/src/components/global/MkAd.stories.ts b/packages/frontend/src/components/global/MkAd.stories.ts index 29b3fd53eb..23afa7c366 100644 --- a/packages/frontend/src/components/global/MkAd.stories.ts +++ b/packages/frontend/src/components/global/MkAd.stories.ts @@ -10,6 +10,7 @@ export default meta; import { expect } from '@storybook/jest'; import { userEvent, within } from '@storybook/testing-library'; import { StoryObj } from '@storybook/vue3'; +import { i18n } from '@/i18n'; import MkAd from './MkAd.vue'; const common = { render(args) { @@ -51,8 +52,12 @@ const common = { const back = buttons[args._hasReduce ? 1 : 0]; if (reduce) { await expect(reduce).toBeInTheDocument(); + await expect(reduce.textContent).toBe( + i18n.ts._ad.reduceFrequencyOfThisAd + ); } await expect(back).toBeInTheDocument(); + await expect(back.textContent).toBe(i18n.ts._ad.back); await userEvent.click(back); if (reduce) { await expect(reduce).not.toBeInTheDocument(); diff --git a/packages/frontend/src/scripts/test-utils.ts b/packages/frontend/src/scripts/test-utils.ts index c526fc156a..3e018f2d7e 100644 --- a/packages/frontend/src/scripts/test-utils.ts +++ b/packages/frontend/src/scripts/test-utils.ts @@ -1,3 +1,5 @@ +/// <reference types="@testing-library/jest-dom"/> + export async function tick(): Promise<void> { // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition await new Promise((globalThis.requestIdleCallback ?? setTimeout) as never); |