Something went wrong. Try again.
Monorepo for Tangled forked from tangled.org/core
Something went wrong. Try again.
12345678910111213141516171819202122232425262728293031323334353637383940414243<script module lang="ts"> import { defineMeta } from "@storybook/addon-svelte-csf"; import { expect, userEvent, waitFor, within } from "storybook/test"; import CommentBox from "#lib/components/comment/CommentBox.svelte"; import { sampleComments, sampleMarkup, sampleSubjectCid, sampleSubjectUri } from "#fixtures/comments.ts";
const { Story } = defineMeta({ title: "Comment/CommentBox", component: CommentBox, tags: ["autodocs"], args: { subjectUri: sampleSubjectUri, subjectCid: sampleSubjectCid, authorDid: sampleComments.mine.authorDid, authorHandle: sampleComments.mine.authorHandle, markup: sampleMarkup } });</script>
<Story name="Default" />
<!-- types a comment and submits with ctrl+enter against a fake agent that rejects, showing the error alert --><Story name="Failed submission" parameters={{ auth: true }} play={async ({ canvasElement }) => { const canvas = within(canvasElement); await userEvent.type( canvas.getByPlaceholderText(/add to the discussion/i), "This will fail{Control>}{Enter}{/Control}" ); await waitFor(() => expect(canvas.getByRole("alert")).toHaveTextContent(/network request failed/i) ); }}/>