Merged in fix/3697-prettier-configs (pull request #3396)

fix(SW-3691): Setup one prettier config for whole repo

* Setup prettierrc in root and remove other configs


Approved-by: Joakim Jäderberg
Approved-by: Linus Flood
This commit is contained in:
Rasmus Langvad
2026-01-07 12:45:50 +00:00
parent 932413412b
commit d0546926a9
500 changed files with 18367 additions and 18419 deletions

View File

@@ -1,9 +1,9 @@
import { describe, expect, it, afterEach } from 'vitest'
import { render, screen, cleanup } from '@testing-library/react'
import userEvent from '@testing-library/user-event'
import { FormProvider, useForm } from 'react-hook-form'
import { IntlProvider } from 'react-intl'
import { PasswordInput } from './PasswordInput'
import { describe, expect, it, afterEach } from "vitest"
import { render, screen, cleanup } from "@testing-library/react"
import userEvent from "@testing-library/user-event"
import { FormProvider, useForm } from "react-hook-form"
import { IntlProvider } from "react-intl"
import { PasswordInput } from "./PasswordInput"
afterEach(() => {
cleanup()
@@ -11,7 +11,7 @@ afterEach(() => {
function FormWrapper({
children,
defaultValues = { password: '' },
defaultValues = { password: "" },
}: {
children: React.ReactNode
defaultValues?: Record<string, string>
@@ -37,63 +37,63 @@ const renderPasswordInput = (
)
}
describe('PasswordInput', () => {
describe('rendering', () => {
it('renders with default password label', () => {
describe("PasswordInput", () => {
describe("rendering", () => {
it("renders with default password label", () => {
renderPasswordInput()
expect(screen.getByLabelText('Password')).toBeTruthy()
expect(screen.getByLabelText("Password")).toBeTruthy()
})
it('renders with custom label', () => {
renderPasswordInput({ label: 'Enter your password' })
expect(screen.getByLabelText('Enter your password')).toBeTruthy()
it("renders with custom label", () => {
renderPasswordInput({ label: "Enter your password" })
expect(screen.getByLabelText("Enter your password")).toBeTruthy()
})
it('renders with new password label when isNewPassword is true', () => {
it("renders with new password label when isNewPassword is true", () => {
renderPasswordInput({ isNewPassword: true })
expect(screen.getByLabelText('New password')).toBeTruthy()
expect(screen.getByLabelText("New password")).toBeTruthy()
})
})
describe('visibility toggle', () => {
it('shows visibility toggle button by default', () => {
describe("visibility toggle", () => {
it("shows visibility toggle button by default", () => {
renderPasswordInput()
expect(screen.getByLabelText('Show password')).toBeTruthy()
expect(screen.getByLabelText("Show password")).toBeTruthy()
})
it('hides visibility toggle when visibilityToggleable is false', () => {
it("hides visibility toggle when visibilityToggleable is false", () => {
renderPasswordInput({ visibilityToggleable: false })
expect(screen.queryByLabelText('Show password')).toBeNull()
expect(screen.queryByLabelText('Hide password')).toBeNull()
expect(screen.queryByLabelText("Show password")).toBeNull()
expect(screen.queryByLabelText("Hide password")).toBeNull()
})
})
describe('disabled state', () => {
it('disables the input when disabled prop is true', () => {
describe("disabled state", () => {
it("disables the input when disabled prop is true", () => {
renderPasswordInput({ disabled: true })
expect(screen.getByLabelText('Password')).toHaveProperty('disabled', true)
expect(screen.getByLabelText("Password")).toHaveProperty("disabled", true)
})
})
describe('form integration', () => {
it('updates form value when typing', async () => {
describe("form integration", () => {
it("updates form value when typing", async () => {
const user = userEvent.setup()
renderPasswordInput()
const input = screen.getByLabelText('Password')
await user.type(input, 'secret123')
const input = screen.getByLabelText("Password")
await user.type(input, "secret123")
expect(input).toHaveProperty('value', 'secret123')
expect(input).toHaveProperty("value", "secret123")
})
it('uses custom name prop', async () => {
it("uses custom name prop", async () => {
const user = userEvent.setup()
renderPasswordInput({ name: 'confirmPassword' }, { confirmPassword: '' })
renderPasswordInput({ name: "confirmPassword" }, { confirmPassword: "" })
const input = screen.getByLabelText('Password')
await user.type(input, 'test')
const input = screen.getByLabelText("Password")
await user.type(input, "test")
expect(input).toHaveProperty('value', 'test')
expect(input).toHaveProperty("value", "test")
})
})
})