mirror of
https://codeberg.org/yeentown/barkey
synced 2024-11-22 02:05:12 +00:00
fix(frontend): fix Storybook type errors (#13779)
* fix(frontend): fix Storybook type errors * fix: `hasReduce` doesn't work in args
This commit is contained in:
parent
d2a5bb39e3
commit
9c057e6854
17 changed files with 952 additions and 732 deletions
|
@ -27,7 +27,7 @@ export function galleryPost(isSensitive = false) {
|
||||||
id: 'somepostid',
|
id: 'somepostid',
|
||||||
createdAt: '2016-12-28T22:49:51.000Z',
|
createdAt: '2016-12-28T22:49:51.000Z',
|
||||||
updatedAt: '2016-12-28T22:49:51.000Z',
|
updatedAt: '2016-12-28T22:49:51.000Z',
|
||||||
userid: 'someuserid',
|
userId: 'someuserid',
|
||||||
user: userDetailed(),
|
user: userDetailed(),
|
||||||
title: 'Some post title',
|
title: 'Some post title',
|
||||||
description: 'Some post description',
|
description: 'Some post description',
|
||||||
|
@ -75,9 +75,8 @@ export function userDetailed(id = 'someuserid', username = 'miskist', host = 'mi
|
||||||
avatarUrl: 'https://github.com/misskey-dev/misskey/blob/master/packages/frontend/assets/about-icon.png?raw=true',
|
avatarUrl: 'https://github.com/misskey-dev/misskey/blob/master/packages/frontend/assets/about-icon.png?raw=true',
|
||||||
avatarBlurhash: 'eQFRshof5NWBRi},juayfPju53WB?0ofs;s*a{ofjuay^SoMEJR%ay',
|
avatarBlurhash: 'eQFRshof5NWBRi},juayfPju53WB?0ofs;s*a{ofjuay^SoMEJR%ay',
|
||||||
avatarDecorations: [],
|
avatarDecorations: [],
|
||||||
emojis: [],
|
emojis: {},
|
||||||
bannerBlurhash: 'eQA^IW^-MH8w9tE8I=S^o{$*R4RikXtSxutRozjEnNR.RQadoyozog',
|
bannerBlurhash: 'eQA^IW^-MH8w9tE8I=S^o{$*R4RikXtSxutRozjEnNR.RQadoyozog',
|
||||||
bannerColor: '#000000',
|
|
||||||
bannerUrl: 'https://github.com/misskey-dev/misskey/blob/master/packages/frontend/assets/fedi.jpg?raw=true',
|
bannerUrl: 'https://github.com/misskey-dev/misskey/blob/master/packages/frontend/assets/fedi.jpg?raw=true',
|
||||||
birthday: '2014-06-20',
|
birthday: '2014-06-20',
|
||||||
createdAt: '2016-12-28T22:49:51.000Z',
|
createdAt: '2016-12-28T22:49:51.000Z',
|
||||||
|
@ -118,11 +117,16 @@ export function userDetailed(id = 'someuserid', username = 'miskist', host = 'mi
|
||||||
publicReactions: false,
|
publicReactions: false,
|
||||||
securityKeys: false,
|
securityKeys: false,
|
||||||
twoFactorEnabled: false,
|
twoFactorEnabled: false,
|
||||||
|
usePasswordLessLogin: false,
|
||||||
twoFactorBackupCodesStock: 'none',
|
twoFactorBackupCodesStock: 'none',
|
||||||
updatedAt: null,
|
updatedAt: null,
|
||||||
|
lastFetchedAt: null,
|
||||||
uri: null,
|
uri: null,
|
||||||
url: null,
|
url: null,
|
||||||
|
movedTo: null,
|
||||||
|
alsoKnownAs: null,
|
||||||
notify: 'none',
|
notify: 'none',
|
||||||
|
memo: null
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -82,23 +82,16 @@ function h<T extends estree.Node>(
|
||||||
return Object.assign(props || {}, { type }) as T;
|
return Object.assign(props || {}, { type }) as T;
|
||||||
}
|
}
|
||||||
|
|
||||||
declare global {
|
declare namespace h.JSX {
|
||||||
namespace JSX {
|
type Element = estree.Node;
|
||||||
type Element = estree.Node;
|
type IntrinsicElements = {
|
||||||
type ElementClass = never;
|
[T in keyof typeof generator as ToKebab<SplitCamel<Uncapitalize<T>>>]: {
|
||||||
type ElementAttributesProperty = never;
|
[K in keyof Omit<
|
||||||
type ElementChildrenAttribute = never;
|
Parameters<(typeof generator)[T]>[0],
|
||||||
type IntrinsicAttributes = never;
|
'type'
|
||||||
type IntrinsicClassAttributes<T> = never;
|
>]?: Parameters<(typeof generator)[T]>[0][K];
|
||||||
type IntrinsicElements = {
|
|
||||||
[T in keyof typeof generator as ToKebab<SplitCamel<Uncapitalize<T>>>]: {
|
|
||||||
[K in keyof Omit<
|
|
||||||
Parameters<(typeof generator)[T]>[0],
|
|
||||||
'type'
|
|
||||||
>]?: Parameters<(typeof generator)[T]>[0][K];
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function toStories(component: string): Promise<string> {
|
function toStories(component: string): Promise<string> {
|
||||||
|
@ -388,6 +381,7 @@ function toStories(component: string): Promise<string> {
|
||||||
'/* eslint-disable @typescript-eslint/explicit-function-return-type */\n' +
|
'/* eslint-disable @typescript-eslint/explicit-function-return-type */\n' +
|
||||||
'/* eslint-disable import/no-default-export */\n' +
|
'/* eslint-disable import/no-default-export */\n' +
|
||||||
'/* eslint-disable import/no-duplicates */\n' +
|
'/* eslint-disable import/no-duplicates */\n' +
|
||||||
|
'/* eslint-disable import/order */\n' +
|
||||||
generate(program, { generator }) +
|
generate(program, { generator }) +
|
||||||
(hasImplStories ? readFileSync(`${implStories}.ts`, 'utf-8') : ''),
|
(hasImplStories ? readFileSync(`${implStories}.ts`, 'utf-8') : ''),
|
||||||
{
|
{
|
||||||
|
|
|
@ -34,7 +34,7 @@ const config = {
|
||||||
disableTelemetry: true,
|
disableTelemetry: true,
|
||||||
},
|
},
|
||||||
async viteFinal(config) {
|
async viteFinal(config) {
|
||||||
const replacePluginForIsChromatic = config.plugins?.findIndex((plugin) => plugin && (plugin as Partial<Plugin>)?.name === 'replace') ?? -1;
|
const replacePluginForIsChromatic = config.plugins?.findIndex((plugin: Plugin) => plugin && plugin.name === 'replace') ?? -1;
|
||||||
if (~replacePluginForIsChromatic) {
|
if (~replacePluginForIsChromatic) {
|
||||||
config.plugins?.splice(replacePluginForIsChromatic, 1);
|
config.plugins?.splice(replacePluginForIsChromatic, 1);
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,8 @@
|
||||||
import { type SharedOptions, http, HttpResponse } from 'msw';
|
import { type SharedOptions, http, HttpResponse } from 'msw';
|
||||||
|
|
||||||
export const onUnhandledRequest = ((req, print) => {
|
export const onUnhandledRequest = ((req, print) => {
|
||||||
if (req.url.hostname !== 'localhost' || /^\/(?:client-assets\/|fluent-emojis?\/|iframe.html$|node_modules\/|src\/|sb-|static-assets\/|vite\/)/.test(req.url.pathname)) {
|
const url = new URL(req.url);
|
||||||
|
if (url.hostname !== 'localhost' || /^\/(?:client-assets\/|fluent-emojis?\/|iframe.html$|node_modules\/|src\/|sb-|static-assets\/|vite\/)/.test(url.pathname)) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
print.warning()
|
print.warning()
|
||||||
|
|
|
@ -78,24 +78,24 @@
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@misskey-dev/eslint-plugin": "1.0.0",
|
"@misskey-dev/eslint-plugin": "1.0.0",
|
||||||
"@misskey-dev/summaly": "5.0.3",
|
"@misskey-dev/summaly": "5.0.3",
|
||||||
"@storybook/addon-actions": "8.0.0-beta.6",
|
"@storybook/addon-actions": "8.0.9",
|
||||||
"@storybook/addon-essentials": "8.0.0-beta.6",
|
"@storybook/addon-essentials": "8.0.9",
|
||||||
"@storybook/addon-interactions": "8.0.0-beta.6",
|
"@storybook/addon-interactions": "8.0.9",
|
||||||
"@storybook/addon-links": "8.0.0-beta.6",
|
"@storybook/addon-links": "8.0.9",
|
||||||
"@storybook/addon-mdx-gfm": "8.0.0-beta.6",
|
"@storybook/addon-mdx-gfm": "8.0.9",
|
||||||
"@storybook/addon-storysource": "8.0.0-beta.6",
|
"@storybook/addon-storysource": "8.0.9",
|
||||||
"@storybook/blocks": "8.0.0-beta.6",
|
"@storybook/blocks": "8.0.9",
|
||||||
"@storybook/components": "8.0.0-beta.6",
|
"@storybook/components": "8.0.9",
|
||||||
"@storybook/core-events": "8.0.0-beta.6",
|
"@storybook/core-events": "8.0.9",
|
||||||
"@storybook/manager-api": "8.0.0-beta.6",
|
"@storybook/manager-api": "8.0.9",
|
||||||
"@storybook/preview-api": "8.0.0-beta.6",
|
"@storybook/preview-api": "8.0.9",
|
||||||
"@storybook/react": "8.0.0-beta.6",
|
"@storybook/react": "8.0.9",
|
||||||
"@storybook/react-vite": "8.0.0-beta.6",
|
"@storybook/react-vite": "8.0.9",
|
||||||
"@storybook/test": "8.0.0-beta.6",
|
"@storybook/test": "8.0.9",
|
||||||
"@storybook/theming": "8.0.0-beta.6",
|
"@storybook/theming": "8.0.9",
|
||||||
"@storybook/types": "8.0.0-beta.6",
|
"@storybook/types": "8.0.9",
|
||||||
"@storybook/vue3": "8.0.0-beta.6",
|
"@storybook/vue3": "8.0.9",
|
||||||
"@storybook/vue3-vite": "8.0.0-beta.6",
|
"@storybook/vue3-vite": "8.0.9",
|
||||||
"@testing-library/vue": "8.0.2",
|
"@testing-library/vue": "8.0.2",
|
||||||
"@types/escape-regexp": "0.0.3",
|
"@types/escape-regexp": "0.0.3",
|
||||||
"@types/estree": "1.0.5",
|
"@types/estree": "1.0.5",
|
||||||
|
@ -129,7 +129,7 @@
|
||||||
"react": "18.2.0",
|
"react": "18.2.0",
|
||||||
"react-dom": "18.2.0",
|
"react-dom": "18.2.0",
|
||||||
"start-server-and-test": "2.0.3",
|
"start-server-and-test": "2.0.3",
|
||||||
"storybook": "8.0.0-beta.6",
|
"storybook": "8.0.9",
|
||||||
"storybook-addon-misskey-theme": "github:misskey-dev/storybook-addon-misskey-theme",
|
"storybook-addon-misskey-theme": "github:misskey-dev/storybook-addon-misskey-theme",
|
||||||
"vite-plugin-turbosnap": "1.0.3",
|
"vite-plugin-turbosnap": "1.0.3",
|
||||||
"vitest": "0.34.6",
|
"vitest": "0.34.6",
|
||||||
|
|
|
@ -4,7 +4,10 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* eslint-disable @typescript-eslint/explicit-function-return-type */
|
/* eslint-disable @typescript-eslint/explicit-function-return-type */
|
||||||
|
import { action } from '@storybook/addon-actions';
|
||||||
import { StoryObj } from '@storybook/vue3';
|
import { StoryObj } from '@storybook/vue3';
|
||||||
|
import { HttpResponse, http } from 'msw';
|
||||||
|
import { commonHandlers } from '../../.storybook/mocks.js';
|
||||||
import { userDetailed } from '../../.storybook/fakes.js';
|
import { userDetailed } from '../../.storybook/fakes.js';
|
||||||
import MkAccountMoved from './MkAccountMoved.vue';
|
import MkAccountMoved from './MkAccountMoved.vue';
|
||||||
export const Default = {
|
export const Default = {
|
||||||
|
@ -29,10 +32,18 @@ export const Default = {
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
args: {
|
args: {
|
||||||
username: userDetailed().username,
|
movedTo: userDetailed().id,
|
||||||
host: userDetailed().host,
|
|
||||||
},
|
},
|
||||||
parameters: {
|
parameters: {
|
||||||
layout: 'centered',
|
layout: 'centered',
|
||||||
|
msw: {
|
||||||
|
handlers: [
|
||||||
|
...commonHandlers,
|
||||||
|
http.post('/api/users/show', async ({ request }) => {
|
||||||
|
action('POST /api/users/show')(await request.json());
|
||||||
|
return HttpResponse.json(userDetailed());
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
},
|
||||||
},
|
},
|
||||||
} satisfies StoryObj<typeof MkAccountMoved>;
|
} satisfies StoryObj<typeof MkAccountMoved>;
|
||||||
|
|
|
@ -4,7 +4,10 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* eslint-disable @typescript-eslint/explicit-function-return-type */
|
/* eslint-disable @typescript-eslint/explicit-function-return-type */
|
||||||
|
import { action } from '@storybook/addon-actions';
|
||||||
import { StoryObj } from '@storybook/vue3';
|
import { StoryObj } from '@storybook/vue3';
|
||||||
|
import { HttpResponse, http } from 'msw';
|
||||||
|
import { commonHandlers } from '../../.storybook/mocks.js';
|
||||||
import MkAnnouncementDialog from './MkAnnouncementDialog.vue';
|
import MkAnnouncementDialog from './MkAnnouncementDialog.vue';
|
||||||
export const Default = {
|
export const Default = {
|
||||||
render(args) {
|
render(args) {
|
||||||
|
@ -23,8 +26,13 @@ export const Default = {
|
||||||
...this.args,
|
...this.args,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
events() {
|
||||||
|
return {
|
||||||
|
closed: action('closed'),
|
||||||
|
};
|
||||||
|
},
|
||||||
},
|
},
|
||||||
template: '<MkAnnouncementDialog v-bind="props" />',
|
template: '<MkAnnouncementDialog v-bind="props" v-on="events" />',
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
args: {
|
args: {
|
||||||
|
@ -38,10 +46,20 @@ export const Default = {
|
||||||
imageUrl: null,
|
imageUrl: null,
|
||||||
display: 'dialog',
|
display: 'dialog',
|
||||||
needConfirmationToRead: false,
|
needConfirmationToRead: false,
|
||||||
|
silence: false,
|
||||||
forYou: true,
|
forYou: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
parameters: {
|
parameters: {
|
||||||
layout: 'centered',
|
layout: 'centered',
|
||||||
|
msw: {
|
||||||
|
handlers: [
|
||||||
|
...commonHandlers,
|
||||||
|
http.post('/api/i/read-announcement', async ({ request }) => {
|
||||||
|
action('POST /api/i/read-announcement')(await request.json());
|
||||||
|
return HttpResponse.json();
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
},
|
||||||
},
|
},
|
||||||
} satisfies StoryObj<typeof MkAnnouncementDialog>;
|
} satisfies StoryObj<typeof MkAnnouncementDialog>;
|
||||||
|
|
|
@ -51,13 +51,16 @@ export const Empty = {
|
||||||
expect(buttons.at(-1)).toBeEnabled();
|
expect(buttons.at(-1)).toBeEnabled();
|
||||||
},
|
},
|
||||||
args: {
|
args: {
|
||||||
|
// @ts-expect-error serverRules is for test
|
||||||
serverRules: [],
|
serverRules: [],
|
||||||
tosUrl: null,
|
tosUrl: null,
|
||||||
},
|
},
|
||||||
decorators: [
|
decorators: [
|
||||||
(_, context) => ({
|
(_, context) => ({
|
||||||
setup() {
|
setup() {
|
||||||
|
// @ts-expect-error serverRules is for test
|
||||||
instance.serverRules = context.args.serverRules;
|
instance.serverRules = context.args.serverRules;
|
||||||
|
// @ts-expect-error tosUrl is for test
|
||||||
instance.tosUrl = context.args.tosUrl;
|
instance.tosUrl = context.args.tosUrl;
|
||||||
onBeforeUnmount(() => {
|
onBeforeUnmount(() => {
|
||||||
// FIXME: 呼び出されない
|
// FIXME: 呼び出されない
|
||||||
|
@ -76,6 +79,7 @@ export const ServerRulesOnly = {
|
||||||
...Empty,
|
...Empty,
|
||||||
args: {
|
args: {
|
||||||
...Empty.args,
|
...Empty.args,
|
||||||
|
// @ts-expect-error serverRules is for test
|
||||||
serverRules: [
|
serverRules: [
|
||||||
'ルール',
|
'ルール',
|
||||||
],
|
],
|
||||||
|
@ -85,6 +89,7 @@ export const TOSOnly = {
|
||||||
...Empty,
|
...Empty,
|
||||||
args: {
|
args: {
|
||||||
...Empty.args,
|
...Empty.args,
|
||||||
|
// @ts-expect-error tosUrl is for test
|
||||||
tosUrl: 'https://example.com/tos',
|
tosUrl: 'https://example.com/tos',
|
||||||
},
|
},
|
||||||
} satisfies StoryObj<typeof MkSignupServerRules>;
|
} satisfies StoryObj<typeof MkSignupServerRules>;
|
||||||
|
@ -92,6 +97,7 @@ export const ServerRulesAndTOS = {
|
||||||
...Empty,
|
...Empty,
|
||||||
args: {
|
args: {
|
||||||
...Empty.args,
|
...Empty.args,
|
||||||
|
// @ts-expect-error serverRules is for test
|
||||||
serverRules: ServerRulesOnly.args.serverRules,
|
serverRules: ServerRulesOnly.args.serverRules,
|
||||||
tosUrl: TOSOnly.args.tosUrl,
|
tosUrl: TOSOnly.args.tosUrl,
|
||||||
},
|
},
|
||||||
|
|
|
@ -4,8 +4,10 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* eslint-disable @typescript-eslint/explicit-function-return-type */
|
/* eslint-disable @typescript-eslint/explicit-function-return-type */
|
||||||
|
import { expect, userEvent, waitFor, within } from '@storybook/test';
|
||||||
import { StoryObj } from '@storybook/vue3';
|
import { StoryObj } from '@storybook/vue3';
|
||||||
import MkAd from './MkAd.vue';
|
import MkAd from './MkAd.vue';
|
||||||
|
import { i18n } from '@/i18n.js';
|
||||||
|
|
||||||
let lock: Promise<undefined> | undefined;
|
let lock: Promise<undefined> | undefined;
|
||||||
|
|
||||||
|
@ -30,7 +32,6 @@ const common = {
|
||||||
template: '<MkAd v-bind="props" />',
|
template: '<MkAd v-bind="props" />',
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
/* FIXME: disabled because it still didn’t pass after applying #11267
|
|
||||||
async play({ canvasElement, args }) {
|
async play({ canvasElement, args }) {
|
||||||
if (lock) {
|
if (lock) {
|
||||||
console.warn('This test is unexpectedly running twice in parallel, fix it!');
|
console.warn('This test is unexpectedly running twice in parallel, fix it!');
|
||||||
|
@ -44,7 +45,7 @@ const common = {
|
||||||
try {
|
try {
|
||||||
const canvas = within(canvasElement);
|
const canvas = within(canvasElement);
|
||||||
const a = canvas.getByRole<HTMLAnchorElement>('link');
|
const a = canvas.getByRole<HTMLAnchorElement>('link');
|
||||||
await expect(a.href).toMatch(/^https?:\/\/.*#test$/);
|
// await expect(a.href).toMatch(/^https?:\/\/.*#test$/);
|
||||||
const img = within(a).getByRole('img');
|
const img = within(a).getByRole('img');
|
||||||
await expect(img).toBeInTheDocument();
|
await expect(img).toBeInTheDocument();
|
||||||
let buttons = canvas.getAllByRole<HTMLButtonElement>('button');
|
let buttons = canvas.getAllByRole<HTMLButtonElement>('button');
|
||||||
|
@ -52,13 +53,14 @@ const common = {
|
||||||
const i = buttons[0];
|
const i = buttons[0];
|
||||||
await expect(i).toBeInTheDocument();
|
await expect(i).toBeInTheDocument();
|
||||||
await userEvent.click(i);
|
await userEvent.click(i);
|
||||||
await waitFor(() => expect(canvasElement).toHaveTextContent(i18n.ts._ad.back));
|
// await expect(canvasElement).toHaveTextContent(i18n.ts._ad.back);
|
||||||
await expect(a).not.toBeInTheDocument();
|
await expect(a).not.toBeInTheDocument();
|
||||||
await expect(i).not.toBeInTheDocument();
|
await expect(i).not.toBeInTheDocument();
|
||||||
buttons = canvas.getAllByRole<HTMLButtonElement>('button');
|
buttons = canvas.getAllByRole<HTMLButtonElement>('button');
|
||||||
await expect(buttons).toHaveLength(args.__hasReduce ? 2 : 1);
|
const hasReduceFrequency = args.specify?.ratio !== 0;
|
||||||
const reduce = args.__hasReduce ? buttons[0] : null;
|
await expect(buttons).toHaveLength(hasReduceFrequency ? 2 : 1);
|
||||||
const back = buttons[args.__hasReduce ? 1 : 0];
|
const reduce = hasReduceFrequency ? buttons[0] : null;
|
||||||
|
const back = buttons[hasReduceFrequency ? 1 : 0];
|
||||||
if (reduce) {
|
if (reduce) {
|
||||||
await expect(reduce).toBeInTheDocument();
|
await expect(reduce).toBeInTheDocument();
|
||||||
await expect(reduce).toHaveTextContent(i18n.ts._ad.reduceFrequencyOfThisAd);
|
await expect(reduce).toHaveTextContent(i18n.ts._ad.reduceFrequencyOfThisAd);
|
||||||
|
@ -80,15 +82,16 @@ const common = {
|
||||||
lock = undefined;
|
lock = undefined;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
*/
|
|
||||||
args: {
|
args: {
|
||||||
prefer: [],
|
prefer: [],
|
||||||
specify: {
|
specify: {
|
||||||
id: 'someadid',
|
id: 'someadid',
|
||||||
radio: 1,
|
ratio: 1,
|
||||||
url: '#test',
|
url: '#test',
|
||||||
|
place: '',
|
||||||
|
imageUrl: '',
|
||||||
|
dayOfWeek: 7,
|
||||||
},
|
},
|
||||||
__hasReduce: true,
|
|
||||||
},
|
},
|
||||||
parameters: {
|
parameters: {
|
||||||
layout: 'centered',
|
layout: 'centered',
|
||||||
|
@ -138,6 +141,5 @@ export const ZeroRatio = {
|
||||||
...Square.args.specify,
|
...Square.args.specify,
|
||||||
ratio: 0,
|
ratio: 0,
|
||||||
},
|
},
|
||||||
__hasReduce: false,
|
|
||||||
},
|
},
|
||||||
} satisfies StoryObj<typeof MkAd>;
|
} satisfies StoryObj<typeof MkAd>;
|
||||||
|
|
|
@ -33,7 +33,7 @@ const common = {
|
||||||
},
|
},
|
||||||
decorators: [
|
decorators: [
|
||||||
(Story, context) => ({
|
(Story, context) => ({
|
||||||
// eslint-disable-next-line quotes
|
// @ts-expect-error size is for test
|
||||||
template: `<div :style="{ display: 'grid', width: '${context.args.size}px', height: '${context.args.size}px' }"><story/></div>`,
|
template: `<div :style="{ display: 'grid', width: '${context.args.size}px', height: '${context.args.size}px' }"><story/></div>`,
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
|
@ -45,6 +45,7 @@ export const ProfilePage = {
|
||||||
...common,
|
...common,
|
||||||
args: {
|
args: {
|
||||||
...common.args,
|
...common.args,
|
||||||
|
// @ts-expect-error size is for test
|
||||||
size: 120,
|
size: 120,
|
||||||
indicator: true,
|
indicator: true,
|
||||||
},
|
},
|
||||||
|
|
|
@ -28,6 +28,7 @@ export const Default = {
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
args: {
|
args: {
|
||||||
|
// @ts-expect-error text is for test
|
||||||
text: 'This is a condensed line.',
|
text: 'This is a condensed line.',
|
||||||
},
|
},
|
||||||
parameters: {
|
parameters: {
|
||||||
|
@ -41,4 +42,5 @@ export const ContainerIs100px = {
|
||||||
template: '<div style="width: 100px;"><story/></div>',
|
template: '<div style="width: 100px;"><story/></div>',
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
|
// @ts-expect-error text is for test
|
||||||
} satisfies StoryObj<typeof MkCondensedLine>;
|
} satisfies StoryObj<typeof MkCondensedLine>;
|
||||||
|
|
|
@ -3,8 +3,11 @@
|
||||||
* SPDX-License-Identifier: AGPL-3.0-only
|
* SPDX-License-Identifier: AGPL-3.0-only
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import { Meta } from '@storybook/vue3';
|
||||||
|
import MkError from './MkError.vue';
|
||||||
|
|
||||||
export const argTypes = {
|
export const argTypes = {
|
||||||
retry: {
|
onRetry: {
|
||||||
action: 'retry',
|
action: 'retry',
|
||||||
},
|
},
|
||||||
};
|
} satisfies Meta<typeof MkError>['argTypes'];
|
||||||
|
|
|
@ -33,7 +33,6 @@ export const Empty = {
|
||||||
await waitFor(async () => await wait);
|
await waitFor(async () => await wait);
|
||||||
},
|
},
|
||||||
args: {
|
args: {
|
||||||
static: true,
|
|
||||||
tabs: [],
|
tabs: [],
|
||||||
},
|
},
|
||||||
parameters: {
|
parameters: {
|
||||||
|
@ -71,8 +70,8 @@ export const IconOnly = {
|
||||||
...Icon.args,
|
...Icon.args,
|
||||||
tabs: [
|
tabs: [
|
||||||
{
|
{
|
||||||
...Icon.args.tabs[0],
|
key: Icon.args.tabs[0].key,
|
||||||
title: undefined,
|
icon: Icon.args.tabs[0].icon,
|
||||||
iconOnly: true,
|
iconOnly: true,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|
|
@ -38,7 +38,6 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
export type Tab = {
|
export type Tab = {
|
||||||
key: string;
|
key: string;
|
||||||
title: string;
|
|
||||||
onClick?: (ev: MouseEvent) => void;
|
onClick?: (ev: MouseEvent) => void;
|
||||||
} & (
|
} & (
|
||||||
| {
|
| {
|
||||||
|
|
|
@ -60,7 +60,7 @@ export const RelativeFuture = {
|
||||||
export const AbsoluteFuture = {
|
export const AbsoluteFuture = {
|
||||||
...Empty,
|
...Empty,
|
||||||
async play({ canvasElement, args }) {
|
async play({ canvasElement, args }) {
|
||||||
await expect(canvasElement).toHaveTextContent(dateTimeFormat.format(args.time));
|
await expect(canvasElement).toHaveTextContent(dateTimeFormat.format(typeof args.time === 'string' ? new Date(args.time) : args.time ?? undefined));
|
||||||
},
|
},
|
||||||
args: {
|
args: {
|
||||||
...Empty.args,
|
...Empty.args,
|
||||||
|
@ -97,7 +97,7 @@ export const RelativeNow = {
|
||||||
export const AbsoluteNow = {
|
export const AbsoluteNow = {
|
||||||
...Empty,
|
...Empty,
|
||||||
async play({ canvasElement, args }) {
|
async play({ canvasElement, args }) {
|
||||||
await expect(canvasElement).toHaveTextContent(dateTimeFormat.format(args.time));
|
await expect(canvasElement).toHaveTextContent(dateTimeFormat.format(typeof args.time === 'string' ? new Date(args.time) : args.time ?? undefined));
|
||||||
},
|
},
|
||||||
args: {
|
args: {
|
||||||
...Empty.args,
|
...Empty.args,
|
||||||
|
@ -136,7 +136,7 @@ export const RelativeOneHourAgo = {
|
||||||
export const AbsoluteOneHourAgo = {
|
export const AbsoluteOneHourAgo = {
|
||||||
...Empty,
|
...Empty,
|
||||||
async play({ canvasElement, args }) {
|
async play({ canvasElement, args }) {
|
||||||
await expect(canvasElement).toHaveTextContent(dateTimeFormat.format(args.time));
|
await expect(canvasElement).toHaveTextContent(dateTimeFormat.format(typeof args.time === 'string' ? new Date(args.time) : args.time ?? undefined));
|
||||||
},
|
},
|
||||||
args: {
|
args: {
|
||||||
...Empty.args,
|
...Empty.args,
|
||||||
|
@ -175,7 +175,7 @@ export const RelativeOneDayAgo = {
|
||||||
export const AbsoluteOneDayAgo = {
|
export const AbsoluteOneDayAgo = {
|
||||||
...Empty,
|
...Empty,
|
||||||
async play({ canvasElement, args }) {
|
async play({ canvasElement, args }) {
|
||||||
await expect(canvasElement).toHaveTextContent(dateTimeFormat.format(args.time));
|
await expect(canvasElement).toHaveTextContent(dateTimeFormat.format(typeof args.time === 'string' ? new Date(args.time) : args.time ?? undefined));
|
||||||
},
|
},
|
||||||
args: {
|
args: {
|
||||||
...Empty.args,
|
...Empty.args,
|
||||||
|
@ -214,7 +214,7 @@ export const RelativeOneWeekAgo = {
|
||||||
export const AbsoluteOneWeekAgo = {
|
export const AbsoluteOneWeekAgo = {
|
||||||
...Empty,
|
...Empty,
|
||||||
async play({ canvasElement, args }) {
|
async play({ canvasElement, args }) {
|
||||||
await expect(canvasElement).toHaveTextContent(dateTimeFormat.format(args.time));
|
await expect(canvasElement).toHaveTextContent(dateTimeFormat.format(typeof args.time === 'string' ? new Date(args.time) : args.time ?? undefined));
|
||||||
},
|
},
|
||||||
args: {
|
args: {
|
||||||
...Empty.args,
|
...Empty.args,
|
||||||
|
@ -253,7 +253,7 @@ export const RelativeOneMonthAgo = {
|
||||||
export const AbsoluteOneMonthAgo = {
|
export const AbsoluteOneMonthAgo = {
|
||||||
...Empty,
|
...Empty,
|
||||||
async play({ canvasElement, args }) {
|
async play({ canvasElement, args }) {
|
||||||
await expect(canvasElement).toHaveTextContent(dateTimeFormat.format(args.time));
|
await expect(canvasElement).toHaveTextContent(dateTimeFormat.format(typeof args.time === 'string' ? new Date(args.time) : args.time ?? undefined));
|
||||||
},
|
},
|
||||||
args: {
|
args: {
|
||||||
...Empty.args,
|
...Empty.args,
|
||||||
|
@ -292,7 +292,7 @@ export const RelativeOneYearAgo = {
|
||||||
export const AbsoluteOneYearAgo = {
|
export const AbsoluteOneYearAgo = {
|
||||||
...Empty,
|
...Empty,
|
||||||
async play({ canvasElement, args }) {
|
async play({ canvasElement, args }) {
|
||||||
await expect(canvasElement).toHaveTextContent(dateTimeFormat.format(args.time));
|
await expect(canvasElement).toHaveTextContent(dateTimeFormat.format(typeof args.time === 'string' ? new Date(args.time) : args.time ?? undefined));
|
||||||
},
|
},
|
||||||
args: {
|
args: {
|
||||||
...Empty.args,
|
...Empty.args,
|
||||||
|
|
|
@ -30,7 +30,7 @@ export const Default = {
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
async play({ canvasElement }) {
|
async play({ canvasElement }) {
|
||||||
await expect(canvasElement).toHaveTextContent(userDetailed().name);
|
await expect(canvasElement).toHaveTextContent(userDetailed().name as string);
|
||||||
},
|
},
|
||||||
args: {
|
args: {
|
||||||
user: userDetailed(),
|
user: userDetailed(),
|
||||||
|
|
1508
pnpm-lock.yaml
1508
pnpm-lock.yaml
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue