Expose builder chip selection beyond color, raise unselected contrast, and make the five-value limit visible.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1,8 +1,11 @@
|
||||
import { describe } from "vitest";
|
||||
import { describe, it, expect } from "vitest";
|
||||
import { screen } from "@testing-library/react";
|
||||
import "@testing-library/jest-dom/vitest";
|
||||
import {
|
||||
componentTestSuite,
|
||||
type ComponentTestSuiteConfig,
|
||||
} from "../utils/componentTestSuite";
|
||||
import { renderWithProviders as render } from "../utils/test-utils";
|
||||
import Chip from "../../app/components/controls/Chip";
|
||||
|
||||
type Props = React.ComponentProps<typeof Chip>;
|
||||
@@ -30,4 +33,18 @@ const config: ComponentTestSuiteConfig<Props> = {
|
||||
|
||||
describe("Chip", () => {
|
||||
componentTestSuite<Props>(config);
|
||||
|
||||
it("exposes aria-pressed false when unselected", () => {
|
||||
render(<Chip label="Worker cooperative" state="unselected" />);
|
||||
const chip = screen.getByRole("button", { name: "Worker cooperative" });
|
||||
expect(chip).toHaveAttribute("aria-pressed", "false");
|
||||
expect(chip.querySelector("svg")).toBeNull();
|
||||
});
|
||||
|
||||
it("exposes aria-pressed and a check mark when selected", () => {
|
||||
render(<Chip label="Worker cooperative" state="selected" />);
|
||||
const chip = screen.getByRole("button", { name: "Worker cooperative" });
|
||||
expect(chip).toHaveAttribute("aria-pressed", "true");
|
||||
expect(chip.querySelector("svg[aria-hidden]")).not.toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user