Skip to content

Commit

Permalink
chore: move stories into folders
Browse files Browse the repository at this point in the history
  • Loading branch information
mwargan committed Mar 7, 2024
1 parent 59a5f5f commit e2d573a
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { Meta, StoryObj } from "@storybook/vue3";
import overflowFixture from "../../cypress/fixtures/overflowingData.json";
import overflowFixture from "../../../cypress/fixtures/overflowingData.json";
import { expect, within } from "@storybook/test";

// Note this type is re-used in the Dropdown.stories.ts file
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@ import type { Meta, StoryObj } from "@storybook/vue3";

import BaseButton from "@/components/BaseButton.vue";

import overflowFixture from "../../cypress/fixtures/overflowingData.json";
import overflowFixture from "../../../cypress/fixtures/overflowingData.json";
import { expect, within } from "@storybook/test";
import { checkChildrenForOverflow, checkElementForTextOverflow } from "./utils";
import {
checkChildrenForOverflow,
checkElementForTextOverflow,
} from "../utils";

// More on how to set up stories at: https://storybook.js.org/docs/writing-stories
const meta: Meta<typeof BaseButton> = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import type { Meta, StoryObj } from "@storybook/vue3";
import BaseModal from "@/components/modals/BaseModal.vue";
import { expect, within } from "@storybook/test";

import overflowFixture from "../../cypress/fixtures/overflowingData.json";
import overflowFixture from "../../../cypress/fixtures/overflowingData.json";

// More on how to set up stories at: https://storybook.js.org/docs/writing-stories
const meta: Meta<typeof BaseModal> = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@ import type { Meta, StoryObj } from "@storybook/vue3";
import CardElement from "@/components/CardElement.vue";
import { h } from "vue";

import overflowFixture from "../../cypress/fixtures/overflowingData.json";
import { checkChildrenForOverflow, checkElementForTextOverflow } from "./utils";
import overflowFixture from "../../../cypress/fixtures/overflowingData.json";
import {
checkChildrenForOverflow,
checkElementForTextOverflow,
} from "../utils";

// More on how to set up stories at: https://storybook.js.org/docs/writing-stories
const meta: Meta<typeof CardElement> = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { Meta, StoryObj } from "@storybook/vue3";
import overflowFixture from "../../cypress/fixtures/overflowingData.json";
import { expect, within } from "@storybook/test";
import { checkElementForTextOverflow } from "./utils";
import overflowFixture from "../../../cypress/fixtures/overflowingData.json";
import { expect, userEvent, within } from "@storybook/test";
import { checkElementForTextOverflow } from "../utils";
import type { HTMLDetailsElementCustom } from "./Accordion.stories";

const meta: Meta<HTMLDetailsElementCustom> = {
Expand Down Expand Up @@ -116,10 +116,13 @@ export const WithRadioButtons: Story = {
};

export const WithCheckboxes: Story = {
render: ({ optionText }) => ({
args: {
open: true,
},
render: ({ optionText, title }) => ({
template: `
<summary>
Select phases of matter...
${title}
</summary>
<ul>
<li>
Expand Down Expand Up @@ -148,4 +151,21 @@ export const WithCheckboxes: Story = {
</li>
</ul>`,
}),

play: async ({ canvasElement, args }: any) => {
const canvas = within(canvasElement);
const checkboxes = canvas.getAllByRole("checkbox");

expect(checkboxes).toHaveLength(4);

// Clicking the first checkbox should check it and not hide the dropdown
await userEvent.click(checkboxes[0]);
expect(checkboxes[0]).toBeChecked();
expect(checkboxes[0]).toBeVisible();

// Clickling on the summary should hide the dropdown
const summary = canvas.getByText(args.title);
await userEvent.click(summary);
expect(checkboxes[0]).not.toBeVisible();
},
};
File renamed without changes.
File renamed without changes.

0 comments on commit e2d573a

Please sign in to comment.