/* eslint-disable formatjs/no-literal-string-in-jsx */
import { describe, expect, it, afterEach } from "vitest"
import { render, screen, cleanup } from "@testing-library/react"
import userEvent from "@testing-library/user-event"
import { ChipStatic } from "./ChipStatic"
afterEach(() => {
cleanup()
})
describe("ChipStatic accessibility", () => {
describe("semantic HTML", () => {
it("uses span element (non-interactive)", () => {
render(Static Label)
const chip = screen.getByText("Static Label")
expect(chip.tagName).toBe("SPAN")
})
it("is not a button or link", () => {
render(Not Interactive)
expect(screen.queryByRole("button")).toBeNull()
expect(screen.queryByRole("link")).toBeNull()
})
it("content is visible and readable", () => {
render(Readable Content)
expect(screen.getByText("Readable Content")).toBeTruthy()
})
})
describe("non-interactive behavior", () => {
it("is not focusable by default", async () => {
const user = userEvent.setup()
render(
Static Chip
)
await user.tab()
// Focus should skip the static chip and go directly to the button
expect(document.activeElement).toBe(
screen.getByRole("button", { name: "Focusable Button" })
)
})
it("does not receive focus when tabbing through page", async () => {
const user = userEvent.setup()
render(