From bfe9634e53c02318f55c38a59cdda46a329837f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dafydd=20Ll=C5=B7r=20Pearson?= Date: Tue, 2 Apr 2024 15:25:56 +0100 Subject: [PATCH] fix(storybook): Tidy up redundant unlabelled stories --- .../Feedback/FeedbackForm.stories.tsx | 50 +++---------------- 1 file changed, 6 insertions(+), 44 deletions(-) diff --git a/editor.planx.uk/src/components/Feedback/FeedbackForm.stories.tsx b/editor.planx.uk/src/components/Feedback/FeedbackForm.stories.tsx index 325117d148..2d60bd235e 100644 --- a/editor.planx.uk/src/components/Feedback/FeedbackForm.stories.tsx +++ b/editor.planx.uk/src/components/Feedback/FeedbackForm.stories.tsx @@ -12,7 +12,7 @@ type Story = StoryObj; export default meta; -export const EmptyLabelledForm: Story = { +export const EmptyForm: Story = { args: { inputs: [ { id: "userContext", name: "userContext", label: "What were you doing?" }, @@ -24,19 +24,8 @@ export const EmptyLabelledForm: Story = { }, }; -export const EmptyUnlabelledForm: Story = { - args: { - inputs: [ - { id: "userComment", name: "userComment", label: "What's your comment?" }, - ], - handleSubmit: async (values) => { - console.log(values); - }, - }, -}; - -export const SuccessfulLabelledFormSubmit: Story = { - ...EmptyLabelledForm, +export const SuccessfulFormSubmit: Story = { + ...EmptyForm, play: async ({ canvasElement }) => { const canvas = within(canvasElement); @@ -57,8 +46,8 @@ export const SuccessfulLabelledFormSubmit: Story = { }, }; -export const MissingInputLabelledForm: Story = { - ...EmptyLabelledForm, +export const MissingInputForm: Story = { + ...EmptyForm, play: async ({ canvasElement }) => { const canvas = within(canvasElement); @@ -70,31 +59,4 @@ export const MissingInputLabelledForm: Story = { const submitButton = canvas.getByRole("button", { name: "Send feedback" }); await userEvent.click(submitButton); }, -}; - -export const SuccessfulUnlabelledFormSubmit: Story = { - ...EmptyUnlabelledForm, - play: async ({ canvasElement }) => { - const canvas = within(canvasElement); - - const commentInput = canvas.getByLabelText("Leave your feedback"); - await userEvent.type( - commentInput, - "It said I own a house but it's actually a flat.", - { delay: 100 }, - ); - - const submitButton = canvas.getByRole("button", { name: "Send feedback" }); - await userEvent.click(submitButton); - }, -}; - -export const MissingInputUnlabelledFormSubmit: Story = { - ...EmptyUnlabelledForm, - play: async ({ canvasElement }) => { - const canvas = within(canvasElement); - - const submitButton = canvas.getByRole("button", { name: "Send feedback" }); - await userEvent.click(submitButton); - }, -}; +}; \ No newline at end of file