This repository has no description
0

Configure Feed

Select the types of activity you want to include in your feed.

core / web / src / lib / components / repo / RefChip.stories.svelte
1.0 kB 36 lines
1<script module lang="ts"> 2 import { defineMeta, type StoryContext } from "@storybook/addon-svelte-csf"; 3 import { expect } from "storybook/test"; 4 import RefChip from "./RefChip.svelte"; 5 6 type PlayContext = Pick<StoryContext<Record<string, unknown>>, "canvas">; 7 8 const linksToTree = async ({ canvas }: PlayContext) => { 9 await expect(canvas.getByText("at")).toBeVisible(); 10 await expect(canvas.getByRole("link", { name: "main" })).toHaveAttribute( 11 "href", 12 "/dawn/tangled/tree/main" 13 ); 14 }; 15 16 const encodesRef = async ({ canvas }: PlayContext) => { 17 await expect(canvas.getByRole("link", { name: "feature/split-diffs" })).toHaveAttribute( 18 "href", 19 "/dawn/tangled/tree/feature%2Fsplit-diffs" 20 ); 21 }; 22 23 const { Story } = defineMeta({ 24 title: "Repo/RefChip", 25 component: RefChip, 26 tags: ["autodocs"], 27 args: { 28 ownerHandle: "dawn", 29 repoName: "tangled", 30 ref: "main" 31 } 32 }); 33</script> 34 35<Story name="Branch" play={linksToTree} /> 36<Story name="Branch with slash" args={{ ref: "feature/split-diffs" }} play={encodesRef} />