Something went wrong. Try again.
Monorepo for Tangled forked from tangled.org/core
Something went wrong. Try again.
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647<script module lang="ts"> import { defineMeta } from "@storybook/addon-svelte-csf"; import { expect, userEvent, waitFor, within } from "storybook/test"; import CommentList from "$lib/components/comment/CommentList.svelte"; import { longThread, multiReplyThread, sampleComments, sampleMarkup, sampleSubjectCid, sampleSubjectUri, sampleThreads } from "$fixtures/comments";
const { Story } = defineMeta({ title: "Comment/CommentList", component: CommentList, tags: ["autodocs"], args: { threads: sampleThreads, subjectUri: sampleSubjectUri, subjectCid: sampleSubjectCid, markup: sampleMarkup } });</script>
<Story name="Populated" /><Story name="Empty" args={{ threads: [] }} /><Story name="Multiple replies" args={{ threads: [multiReplyThread] }} />
<!-- logged in as alice: her reply in the middle of the thread is being edited inline --><Story name="Editing a mid-thread reply" args={{ threads: [longThread] }} parameters={{ auth: true }} play={async ({ canvasElement }) => { const canvas = within(canvasElement); // only alice's (middle) reply exposes an edit control await userEvent.click(canvas.getByRole("button", { name: "Edit comment" })); const textarea = await waitFor(() => canvas.getByPlaceholderText(/edit your comment/i)); await expect(textarea).toHaveValue(sampleComments.mine.body); await expect(canvas.getByRole("button", { name: "Save" })).toBeInTheDocument(); await expect(canvas.getByRole("button", { name: "Cancel" })).toBeInTheDocument(); }}/>