Something went wrong. Try again.
Monorepo for Tangled forked from tangled.org/core
Something went wrong. Try again.
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859<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: "Save changes" })).toBeVisible() ); }}> {#snippet template(args)} <StringForm {...args} /> {/snippet}</Story>