- update client and server dependencies within their ranges, keeping all playwright packages aligned at 1.63 - fix code flagged by react-hooks 7.1: refs written during render and synchronous setState in effects - add stories for the ui components that had none, with interaction tests, and cover all DescriptionList layouts - drop the unused mdx stories pattern - run the storybook tests as part of the pre-commit checks - bump version to 1.20.1
34 lines
1.1 KiB
TypeScript
34 lines
1.1 KiB
TypeScript
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
import { expect } from 'storybook/test';
|
|
import { CodeBlock } from '../../src/ui/CodeBlock/CodeBlock';
|
|
|
|
const meta: Meta<typeof CodeBlock> = {
|
|
title: 'UI/CodeBlock',
|
|
component: CodeBlock,
|
|
parameters: { layout: 'padded' },
|
|
tags: ['autodocs'],
|
|
};
|
|
export default meta;
|
|
type Story = StoryObj<typeof CodeBlock>;
|
|
|
|
export const JavaScript: Story = {
|
|
args: {
|
|
language: 'javascript',
|
|
code: "const url = context.getEnv('BASE_URL');\nawait context.page.goto(url);\nreturn await context.page.title();",
|
|
},
|
|
play: async ({ canvasElement }) => {
|
|
// Highlighting splits the code into many spans: check the whole text and
|
|
// that highlighting actually happened
|
|
const code = canvasElement.querySelector('code');
|
|
await expect(code).toHaveTextContent('await context.page.goto(url);');
|
|
await expect(code?.querySelector('.hljs-keyword')).not.toBeNull();
|
|
},
|
|
};
|
|
|
|
export const Json: Story = {
|
|
args: {
|
|
language: 'json',
|
|
code: JSON.stringify({ status: 'pass', output: { title: 'Dashboard' } }, null, 2),
|
|
},
|
|
};
|