Skip to content

Commit

Permalink
Merge pull request #74 from storybookjs/update-configure-page-styles
Browse files Browse the repository at this point in the history
Update Configure page design
  • Loading branch information
cdedreuille authored Jul 6, 2023
2 parents 7fcc007 + 85c1178 commit 89bbe97
Show file tree
Hide file tree
Showing 26 changed files with 307 additions and 316 deletions.
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
dist
*.mdx
41 changes: 1 addition & 40 deletions src/components/SyntaxHighlighter/SyntaxHighlighter.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import { Meta, StoryObj } from "@storybook/react";
import { SyntaxHighlighter } from "./SyntaxHighlighter";
import React from "react";
import { userEvent, within } from "@storybook/testing-library";
import { expect } from "@storybook/jest";
import { textContentMatcher } from "../../helpers/textContentMatcher";
import { CodeSnippets } from "../../features/WriteStoriesModal/code/types";

const meta: Meta<typeof SyntaxHighlighter> = {
Expand All @@ -17,7 +14,7 @@ export default meta;

type Story = StoryObj<typeof SyntaxHighlighter>;

const data: CodeSnippets['code'] = [
const data: CodeSnippets["code"] = [
[
{
snippet: `import type { Meta, StoryObj } from '@storybook/react';
Expand Down Expand Up @@ -88,40 +85,4 @@ export const Default: Story = {
width: 480,
filename: "Button.stories.tsx",
},
play: async ({ canvasElement }) => {
const canvas = within(canvasElement);
const nextButton = canvas.getByText("Next");
const firstElement = await canvas.findByText(
textContentMatcher(data[0][0].snippet), undefined, { timeout: 3000 }
);
await expect(
firstElement.closest('[aria-hidden="false"]')
).toBeInTheDocument();

const secondElement = await canvas.findByText(
textContentMatcher(data[1][0].snippet)
);
await expect(
secondElement.closest('[aria-hidden="true"]')
).toBeInTheDocument();

const thirdElement = await canvas.findByText(
textContentMatcher(data[2][0].snippet)
);
await expect(
thirdElement.closest('[aria-hidden="true"]')
).toBeInTheDocument();

await userEvent.click(nextButton);

await expect(
firstElement.closest('[aria-hidden="true"]')
).toBeInTheDocument();
await expect(
secondElement.closest('[aria-hidden="false"]')
).toBeInTheDocument();
await expect(
thirdElement.closest('[aria-hidden="true"]')
).toBeInTheDocument();
},
};
Loading

0 comments on commit 89bbe97

Please sign in to comment.