build(#10336): fix missing type definition

This commit is contained in:
Acid Chicken (硫酸鶏)
2023-03-31 16:34:54 +09:00
parent bf9846a269
commit 558d73b21a
5 changed files with 26 additions and 7 deletions

View File

@@ -89,6 +89,7 @@
"@storybook/types": "7.0.0-rc.10",
"@storybook/vue3": "7.0.0-rc.10",
"@storybook/vue3-vite": "7.0.0-rc.10",
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/vue": "^6.6.1",
"@types/escape-regexp": "0.0.1",
"@types/estree": "^1.0.0",
@@ -99,6 +100,7 @@
"@types/punycode": "2.1.0",
"@types/sanitize-html": "2.9.0",
"@types/seedrandom": "3.0.5",
"@types/testing-library__jest-dom": "^5.14.5",
"@types/throttle-debounce": "5.0.0",
"@types/tinycolor2": "1.4.3",
"@types/uuid": "9.0.1",

View File

@@ -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,
},
};

View File

@@ -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();

View File

@@ -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);