From d35d84468e2cc869d1d3db31be32354acdee4a2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Filip=20Tammerg=C3=A5rd?= Date: Tue, 10 Oct 2023 12:36:07 +0200 Subject: [PATCH] chore: replace deprecated testing function toHaveErrorMessage was deprecated a while back. --- .../NumberInput/NumberInput.stories.tsx | 20 ++++++++--------- .../SearchInput/SearchInput.stories.tsx | 6 ++--- .../inputs/TextInput/TextInput.stories.tsx | 20 ++++++++--------- .../inputs/TimeInput/TimeInput.stories.tsx | 22 +++++++++---------- .../SearchSelect/SearchSelect.stories.tsx | 2 +- .../textareas/Textarea/Textarea.stories.tsx | 2 +- 6 files changed, 36 insertions(+), 36 deletions(-) diff --git a/packages/einride-ui/src/components/controls/inputs/NumberInput/NumberInput.stories.tsx b/packages/einride-ui/src/components/controls/inputs/NumberInput/NumberInput.stories.tsx index e6d06ec09..21e38c036 100644 --- a/packages/einride-ui/src/components/controls/inputs/NumberInput/NumberInput.stories.tsx +++ b/packages/einride-ui/src/components/controls/inputs/NumberInput/NumberInput.stories.tsx @@ -34,7 +34,7 @@ export const Basic = { await step("Expect default state", async () => { await expect(input).toHaveValue("") await expect(input).not.toHaveAccessibleDescription() - await expect(input).not.toHaveErrorMessage() + await expect(input).not.toHaveAccessibleErrorMessage() }) }, } satisfies Story @@ -52,7 +52,7 @@ export const WithoutLabel = { await step("Expect default state", async () => { await expect(input).toHaveValue("") await expect(input).not.toHaveAccessibleDescription() - await expect(input).not.toHaveErrorMessage() + await expect(input).not.toHaveAccessibleErrorMessage() }) }, } satisfies Story @@ -70,7 +70,7 @@ export const ReadOnly = { await step("Expect default state", async () => { await expect(input).toHaveValue(ReadOnly.args.value) await expect(input).not.toHaveAccessibleDescription() - await expect(input).not.toHaveErrorMessage() + await expect(input).not.toHaveAccessibleErrorMessage() await expect(input).toHaveAttribute("readonly") }) }, @@ -88,7 +88,7 @@ export const DefaultValue = { await step("Expect default state", async () => { await expect(input).toHaveValue(DefaultValue.args.defaultValue) await expect(input).not.toHaveAccessibleDescription() - await expect(input).not.toHaveErrorMessage() + await expect(input).not.toHaveAccessibleErrorMessage() }) }, } satisfies Story @@ -110,7 +110,7 @@ export const Controlled = { await step("Expect default state", async () => { await expect(input).toHaveValue("") await expect(input).not.toHaveAccessibleDescription() - await expect(input).not.toHaveErrorMessage() + await expect(input).not.toHaveAccessibleErrorMessage() }) }, } satisfies Story @@ -127,7 +127,7 @@ export const Message = { await step("Expect default state", async () => { await expect(input).toHaveValue("") - await expect(input).not.toHaveErrorMessage() + await expect(input).not.toHaveAccessibleErrorMessage() }) await step("Expect input to have accessible description based on `message`", async () => { @@ -148,7 +148,7 @@ export const SuccessMessage = { await step("Expect default state", async () => { await expect(input).toHaveValue("") - await expect(input).not.toHaveErrorMessage() + await expect(input).not.toHaveAccessibleErrorMessage() }) await step("Expect input to have accessible description based on `message`", async () => { @@ -173,7 +173,7 @@ export const ErrorMessage = { }) await step("Expect input to have error message based on `message`", async () => { - await expect(input).toHaveErrorMessage(ErrorMessage.args.message) + await expect(input).toHaveAccessibleErrorMessage(ErrorMessage.args.message) }) }, } satisfies Story @@ -193,7 +193,7 @@ export const Suffix = { await step("Expect default state", async () => { await expect(input).toHaveValue("") await expect(input).not.toHaveAccessibleDescription() - await expect(input).not.toHaveErrorMessage() + await expect(input).not.toHaveAccessibleErrorMessage() }) await step("Expect suffix to show", async () => { @@ -213,7 +213,7 @@ export const Keyboard = { await step("Expect default state", async () => { await expect(input).toHaveValue("") await expect(input).not.toHaveAccessibleDescription() - await expect(input).not.toHaveErrorMessage() + await expect(input).not.toHaveAccessibleErrorMessage() }) await step("Expect focus when tabbing", async () => { diff --git a/packages/einride-ui/src/components/controls/inputs/SearchInput/SearchInput.stories.tsx b/packages/einride-ui/src/components/controls/inputs/SearchInput/SearchInput.stories.tsx index 9e5637e73..c9dde92d1 100644 --- a/packages/einride-ui/src/components/controls/inputs/SearchInput/SearchInput.stories.tsx +++ b/packages/einride-ui/src/components/controls/inputs/SearchInput/SearchInput.stories.tsx @@ -79,7 +79,7 @@ export const Message = { const canvas = within(canvasElement) const input = canvas.getByRole("textbox", { name: "Search for something fun" }) await expect(input).toHaveAccessibleDescription("Message.") - await expect(input).not.toHaveErrorMessage() + await expect(input).not.toHaveAccessibleErrorMessage() }, } satisfies Story @@ -93,7 +93,7 @@ export const SuccessMessage = { const canvas = within(canvasElement) const input = canvas.getByRole("textbox", { name: "Search for something fun" }) await expect(input).toHaveAccessibleDescription("Success message.") - await expect(input).not.toHaveErrorMessage() + await expect(input).not.toHaveAccessibleErrorMessage() }, } satisfies Story @@ -107,7 +107,7 @@ export const ErrorMessage = { const canvas = within(canvasElement) const input = canvas.getByRole("textbox", { name: "Search for something fun" }) await expect(input).not.toHaveAccessibleDescription() - await expect(input).toHaveErrorMessage("Error message.") + await expect(input).toHaveAccessibleErrorMessage("Error message.") }, } satisfies Story diff --git a/packages/einride-ui/src/components/controls/inputs/TextInput/TextInput.stories.tsx b/packages/einride-ui/src/components/controls/inputs/TextInput/TextInput.stories.tsx index be6dc9e06..c607ef7d2 100644 --- a/packages/einride-ui/src/components/controls/inputs/TextInput/TextInput.stories.tsx +++ b/packages/einride-ui/src/components/controls/inputs/TextInput/TextInput.stories.tsx @@ -34,7 +34,7 @@ export const Basic = { await step("Expect default state", async () => { await expect(input).toHaveValue("") await expect(input).not.toHaveAccessibleDescription() - await expect(input).not.toHaveErrorMessage() + await expect(input).not.toHaveAccessibleErrorMessage() }) }, } satisfies Story @@ -52,7 +52,7 @@ export const WithoutLabel = { await step("Expect default state", async () => { await expect(input).toHaveValue("") await expect(input).not.toHaveAccessibleDescription() - await expect(input).not.toHaveErrorMessage() + await expect(input).not.toHaveAccessibleErrorMessage() }) }, } satisfies Story @@ -70,7 +70,7 @@ export const ReadOnly = { await step("Expect default state", async () => { await expect(input).toHaveValue(ReadOnly.args.value) await expect(input).not.toHaveAccessibleDescription() - await expect(input).not.toHaveErrorMessage() + await expect(input).not.toHaveAccessibleErrorMessage() await expect(input).toHaveAttribute("readonly") }) }, @@ -88,7 +88,7 @@ export const DefaultValue = { await step("Expect default state", async () => { await expect(input).toHaveValue(DefaultValue.args.defaultValue) await expect(input).not.toHaveAccessibleDescription() - await expect(input).not.toHaveErrorMessage() + await expect(input).not.toHaveAccessibleErrorMessage() }) }, } satisfies Story @@ -110,7 +110,7 @@ export const Controlled = { await step("Expect default state", async () => { await expect(input).toHaveValue("") await expect(input).not.toHaveAccessibleDescription() - await expect(input).not.toHaveErrorMessage() + await expect(input).not.toHaveAccessibleErrorMessage() }) }, } satisfies Story @@ -127,7 +127,7 @@ export const Message = { await step("Expect default state", async () => { await expect(input).toHaveValue("") - await expect(input).not.toHaveErrorMessage() + await expect(input).not.toHaveAccessibleErrorMessage() }) await step("Expect input to have accessible description based on `message`", async () => { @@ -148,7 +148,7 @@ export const SuccessMessage = { await step("Expect default state", async () => { await expect(input).toHaveValue("") - await expect(input).not.toHaveErrorMessage() + await expect(input).not.toHaveAccessibleErrorMessage() }) await step("Expect input to have accessible description based on `message`", async () => { @@ -173,7 +173,7 @@ export const ErrorMessage = { }) await step("Expect input to have error message based on `message`", async () => { - await expect(input).toHaveErrorMessage(ErrorMessage.args.message) + await expect(input).toHaveAccessibleErrorMessage(ErrorMessage.args.message) }) }, } satisfies Story @@ -193,7 +193,7 @@ export const Suffix = { await step("Expect default state", async () => { await expect(input).toHaveValue("") await expect(input).not.toHaveAccessibleDescription() - await expect(input).not.toHaveErrorMessage() + await expect(input).not.toHaveAccessibleErrorMessage() }) await step("Expect suffix to show", async () => { @@ -213,7 +213,7 @@ export const Keyboard = { await step("Expect default state", async () => { await expect(input).toHaveValue("") await expect(input).not.toHaveAccessibleDescription() - await expect(input).not.toHaveErrorMessage() + await expect(input).not.toHaveAccessibleErrorMessage() }) await step("Expect focus when tabbing", async () => { diff --git a/packages/einride-ui/src/components/controls/inputs/TimeInput/TimeInput.stories.tsx b/packages/einride-ui/src/components/controls/inputs/TimeInput/TimeInput.stories.tsx index f1287889c..433549b03 100644 --- a/packages/einride-ui/src/components/controls/inputs/TimeInput/TimeInput.stories.tsx +++ b/packages/einride-ui/src/components/controls/inputs/TimeInput/TimeInput.stories.tsx @@ -31,7 +31,7 @@ export const Basic = { await step("Expect default state", async () => { await expect(input).toHaveValue("") await expect(input).not.toHaveAccessibleDescription() - await expect(input).not.toHaveErrorMessage() + await expect(input).not.toHaveAccessibleErrorMessage() }) }, } satisfies Story @@ -48,7 +48,7 @@ export const WithoutLabel = { await step("Expect default state", async () => { await expect(input).toHaveValue("") await expect(input).not.toHaveAccessibleDescription() - await expect(input).not.toHaveErrorMessage() + await expect(input).not.toHaveAccessibleErrorMessage() }) }, } satisfies Story @@ -66,7 +66,7 @@ export const ReadOnly = { await step("Expect default state", async () => { await expect(input).toHaveValue(ReadOnly.args.value) await expect(input).not.toHaveAccessibleDescription() - await expect(input).not.toHaveErrorMessage() + await expect(input).not.toHaveAccessibleErrorMessage() await expect(input).toHaveAttribute("readonly") }) }, @@ -84,7 +84,7 @@ export const DefaultValue = { await step("Expect default state", async () => { await expect(input).toHaveValue(DefaultValue.args.defaultValue) await expect(input).not.toHaveAccessibleDescription() - await expect(input).not.toHaveErrorMessage() + await expect(input).not.toHaveAccessibleErrorMessage() }) }, } satisfies Story @@ -106,7 +106,7 @@ export const Controlled = { await step("Expect default state", async () => { await expect(input).toHaveValue("") await expect(input).not.toHaveAccessibleDescription() - await expect(input).not.toHaveErrorMessage() + await expect(input).not.toHaveAccessibleErrorMessage() }) }, } satisfies Story @@ -136,10 +136,10 @@ export const Range = { await step("Expect default state", async () => { await expect(inputFrom).toHaveValue("") await expect(inputFrom).not.toHaveAccessibleDescription() - await expect(inputFrom).not.toHaveErrorMessage() + await expect(inputFrom).not.toHaveAccessibleErrorMessage() await expect(inputTo).toHaveValue("") await expect(inputTo).not.toHaveAccessibleDescription() - await expect(inputTo).not.toHaveErrorMessage() + await expect(inputTo).not.toHaveAccessibleErrorMessage() }) }, } satisfies StoryObj @@ -157,7 +157,7 @@ export const Message = { await step("Expect default state", async () => { await expect(input).toHaveValue("") await expect(input).toHaveAccessibleDescription(Message.args.message) - await expect(input).not.toHaveErrorMessage() + await expect(input).not.toHaveAccessibleErrorMessage() }) }, } satisfies Story @@ -175,7 +175,7 @@ export const SuccessMessage = { await step("Expect default state", async () => { await expect(input).toHaveValue("") await expect(input).toHaveAccessibleDescription(SuccessMessage.args.message) - await expect(input).not.toHaveErrorMessage() + await expect(input).not.toHaveAccessibleErrorMessage() }) }, } satisfies Story @@ -193,7 +193,7 @@ export const ErrorMessage = { await step("Expect default state", async () => { await expect(input).toHaveValue("") await expect(input).not.toHaveAccessibleDescription() - await expect(input).toHaveErrorMessage(ErrorMessage.args.message) + await expect(input).toHaveAccessibleErrorMessage(ErrorMessage.args.message) }) }, } satisfies Story @@ -209,7 +209,7 @@ export const Keyboard = { await step("Expect default state", async () => { await expect(input).toHaveValue("") await expect(input).not.toHaveAccessibleDescription() - await expect(input).not.toHaveErrorMessage() + await expect(input).not.toHaveAccessibleErrorMessage() }) await step("Expect focus when tabbing", async () => { diff --git a/packages/einride-ui/src/components/controls/selects/SearchSelect/SearchSelect.stories.tsx b/packages/einride-ui/src/components/controls/selects/SearchSelect/SearchSelect.stories.tsx index 2dd059a2c..8f0e25ea0 100644 --- a/packages/einride-ui/src/components/controls/selects/SearchSelect/SearchSelect.stories.tsx +++ b/packages/einride-ui/src/components/controls/selects/SearchSelect/SearchSelect.stories.tsx @@ -201,7 +201,7 @@ export const Message = { const canvas = within(canvasElement) const input = canvas.getByRole("textbox", { name: "Label" }) await expect(input).toHaveAccessibleDescription("Message.") - await expect(input).not.toHaveErrorMessage() + await expect(input).not.toHaveAccessibleErrorMessage() }, } satisfies Story diff --git a/packages/einride-ui/src/components/controls/textareas/Textarea/Textarea.stories.tsx b/packages/einride-ui/src/components/controls/textareas/Textarea/Textarea.stories.tsx index 4542752bd..7829f4270 100644 --- a/packages/einride-ui/src/components/controls/textareas/Textarea/Textarea.stories.tsx +++ b/packages/einride-ui/src/components/controls/textareas/Textarea/Textarea.stories.tsx @@ -73,7 +73,7 @@ export const Negative = { play: async ({ canvasElement }) => { const canvas = within(canvasElement) const textarea = canvas.getByRole("textbox", { name: Negative.args.label }) - await expect(textarea).toHaveErrorMessage("Negative message") + await expect(textarea).toHaveAccessibleErrorMessage("Negative message") await expect(textarea).toBeInvalid() }, } satisfies Story