Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: replace deprecated testing function #2144

Merged
merged 1 commit into from
Oct 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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")
})
},
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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 () => {
Expand All @@ -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 () => {
Expand All @@ -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
Expand All @@ -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 () => {
Expand All @@ -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 () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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

Expand All @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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")
})
},
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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 () => {
Expand All @@ -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 () => {
Expand All @@ -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
Expand All @@ -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 () => {
Expand All @@ -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 () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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")
})
},
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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 () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down