Merged in chore/fix-tests (pull request #3430)
Chore/fix tests * chore: Upgrade nextjs@16.1.1 * chore: upgrade next@16.1.1 * upgrade underlying types * merge * Fix broken tests * bump @swc/plugin-formatjs to latest version * bump sentry * transpile "import-in-the-middle" & "require-in-the-middle" * revert next@16.1.1 upgrade * revert transpilation addition * .
This commit is contained in:
@@ -39,39 +39,43 @@ const renderPasswordInput = (
|
||||
|
||||
describe("PasswordInput", () => {
|
||||
describe("rendering", () => {
|
||||
it("renders with default password label", () => {
|
||||
it("renders with default password label", async () => {
|
||||
renderPasswordInput()
|
||||
expect(screen.getByLabelText("Password")).toBeTruthy()
|
||||
expect(await screen.findByLabelText("Password")).toBeTruthy()
|
||||
})
|
||||
|
||||
it("renders with custom label", () => {
|
||||
it("renders with custom label", async () => {
|
||||
renderPasswordInput({ label: "Enter your password" })
|
||||
expect(screen.getByLabelText("Enter your password")).toBeTruthy()
|
||||
expect(await screen.findByLabelText("Enter your password")).toBeTruthy()
|
||||
})
|
||||
|
||||
it("renders with new password label when isNewPassword is true", () => {
|
||||
it("renders with new password label when isNewPassword is true", async () => {
|
||||
renderPasswordInput({ isNewPassword: true })
|
||||
expect(screen.getByLabelText("New password")).toBeTruthy()
|
||||
expect(await screen.findByLabelText("New password")).toBeTruthy()
|
||||
})
|
||||
})
|
||||
|
||||
describe("visibility toggle", () => {
|
||||
it("shows visibility toggle button by default", () => {
|
||||
it("shows visibility toggle button by default", async () => {
|
||||
renderPasswordInput()
|
||||
expect(screen.getByLabelText("Show password")).toBeTruthy()
|
||||
expect(await screen.findByLabelText("Show password")).toBeTruthy()
|
||||
})
|
||||
|
||||
it("hides visibility toggle when visibilityToggleable is false", () => {
|
||||
it("hides visibility toggle when visibilityToggleable is false", async () => {
|
||||
renderPasswordInput({ visibilityToggleable: false })
|
||||
expect(await screen.findByLabelText("Password")).toBeTruthy()
|
||||
expect(screen.queryByLabelText("Show password")).toBeNull()
|
||||
expect(screen.queryByLabelText("Hide password")).toBeNull()
|
||||
})
|
||||
})
|
||||
|
||||
describe("disabled state", () => {
|
||||
it("disables the input when disabled prop is true", () => {
|
||||
it("disables the input when disabled prop is true", async () => {
|
||||
renderPasswordInput({ disabled: true })
|
||||
expect(screen.getByLabelText("Password")).toHaveProperty("disabled", true)
|
||||
expect(await screen.findByLabelText("Password")).toHaveProperty(
|
||||
"disabled",
|
||||
true
|
||||
)
|
||||
})
|
||||
})
|
||||
|
||||
@@ -80,7 +84,7 @@ describe("PasswordInput", () => {
|
||||
const user = userEvent.setup()
|
||||
renderPasswordInput()
|
||||
|
||||
const input = screen.getByLabelText("Password")
|
||||
const input = await screen.findByLabelText("Password")
|
||||
await user.type(input, "secret123")
|
||||
|
||||
expect(input).toHaveProperty("value", "secret123")
|
||||
@@ -90,7 +94,7 @@ describe("PasswordInput", () => {
|
||||
const user = userEvent.setup()
|
||||
renderPasswordInput({ name: "confirmPassword" }, { confirmPassword: "" })
|
||||
|
||||
const input = screen.getByLabelText("Password")
|
||||
const input = await screen.findByLabelText("Password")
|
||||
await user.type(input, "test")
|
||||
|
||||
expect(input).toHaveProperty("value", "test")
|
||||
|
||||
Reference in New Issue
Block a user