summaryrefslogtreecommitdiff
path: root/packages/frontend/src/components/MkChatHistories.stories.impl.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/frontend/src/components/MkChatHistories.stories.impl.ts')
-rw-r--r--packages/frontend/src/components/MkChatHistories.stories.impl.ts45
1 files changed, 45 insertions, 0 deletions
diff --git a/packages/frontend/src/components/MkChatHistories.stories.impl.ts b/packages/frontend/src/components/MkChatHistories.stories.impl.ts
new file mode 100644
index 0000000000..8268adc36f
--- /dev/null
+++ b/packages/frontend/src/components/MkChatHistories.stories.impl.ts
@@ -0,0 +1,45 @@
+/*
+ * SPDX-FileCopyrightText: syuilo and misskey-project
+ * SPDX-License-Identifier: AGPL-3.0-only
+ */
+
+import { http, HttpResponse } from 'msw';
+import { action } from '@storybook/addon-actions';
+import { chatMessage } from '../../.storybook/fakes';
+import MkChatHistories from './MkChatHistories.vue';
+import type { StoryObj } from '@storybook/vue3';
+import type * as Misskey from 'misskey-js';
+export const Default = {
+ render(args) {
+ return {
+ components: {
+ MkChatHistories,
+ },
+ setup() {
+ return {
+ args,
+ };
+ },
+ computed: {
+ props() {
+ return {
+ ...this.args,
+ };
+ },
+ },
+ template: '<MkChatHistories v-bind="props" />',
+ };
+ },
+ parameters: {
+ layout: 'centered',
+ msw: {
+ handlers: [
+ http.post('/api/chat/history', async ({ request }) => {
+ const body = await request.json() as Misskey.entities.ChatHistoryRequest;
+ action('POST /api/chat/history')(body);
+ return HttpResponse.json([chatMessage(body.room)]);
+ }),
+ ],
+ },
+ },
+} satisfies StoryObj<typeof MkChatHistories>;