Something went wrong. Try again.
Monorepo for Tangled forked from tangled.org/core
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657<script module lang="ts"> import { defineMeta } from "@storybook/addon-svelte-csf"; import { expect, userEvent, waitFor, within } from "storybook/test"; import StringForm from "$lib/components/strings/StringForm.svelte";
const noop = () => undefined;
const { Story } = defineMeta({ title: "Strings/StringForm", component: StringForm, tags: ["autodocs"], args: { mode: "create", filename: "hello.rs", description: "a tiny snippet", content: 'fn main() {\n\tprintln!("hello");\n}', bobbinUrl: "https://bobbin.tangled.local", onsaved: noop, oncancel: noop } });</script>
<Story name="Create" />
<Story parameters={{ auth: { accounts: 2 } }} name="Publishing as another account" play={async ({ canvasElement }) => { const canvas = within(canvasElement); await userEvent.click(canvas.getByRole("button", { name: /publish as alice/i })); await userEvent.click(await canvas.findByRole("menuitem", { name: /bob/i })); await waitFor(() => expect(canvas.getByRole("button", { name: /publish as bob/i })).toBeVisible() ); }}> {#snippet template(args)} <StringForm {...args} /> {/snippet}</Story>
<Story parameters={{ auth: { accounts: 2 } }} name="Editing has no picker" args={{ mode: "edit", rkey: "3l7abc" }} play={async ({ canvasElement }) => { const canvas = within(canvasElement); expect(canvas.queryByRole("button", { name: /publish as/i })).toBeNull(); await waitFor(() => expect(canvas.getByRole("button", { name: "Publish" })).toBeVisible()); }}> {#snippet template(args)} <StringForm {...args} /> {/snippet}</Story>