{#snippet defaultTemplate(args: { text: string })}

Default template

{args?.text}

{/snippet} { const { canvasElement } = context; const canvas = within(canvasElement); const h2 = await canvas.findByTestId('heading'); expect(h2).toHaveTextContent('Static template'); }} >

Static template

This story is static and isn't defined with a snippet. It will ignore any args changes because they are not passed in.

{ const { args, canvasElement } = context; const canvas = within(canvasElement); const h2 = await canvas.findByTestId('heading'); const p = await canvas.findByText(args.text); expect(h2).toBeInTheDocument(); expect(p).toBeInTheDocument(); }} > {#snippet template(args)}

Template snippet

{args?.text}

{/snippet}
{#snippet sharedTemplate(args: { text: string })}

Shared template

{args?.text}

{/snippet} component', }} play={async (context) => { const { args, canvasElement } = context; const canvas = within(canvasElement); const h2 = await canvas.findByTestId('heading'); const p = await canvas.findByText(args.text); expect(h2).toBeInTheDocument(); expect(p).toBeInTheDocument(); }} /> { const { args, canvasElement } = context; const canvas = within(canvasElement); const h2 = await canvas.findByTestId('heading'); const p = await canvas.findByText(args.text); expect(h2).toBeInTheDocument(); expect(p).toBeInTheDocument(); }} />