mirror of
https://github.com/farion1231/cc-switch.git
synced 2026-10-26 01:34:51 +08:00
The neutral switch tone drew the checked track in dark gray next to a medium-gray unchecked track, so on and off were nearly indistinguishable in light mode. Drop the neutral tone (its only caller was the apps page "Show" column) and let those switches use the same action color as every other switch. Closes #8010
22 lines
940 B
TypeScript
22 lines
940 B
TypeScript
import { render, screen } from "@testing-library/react";
|
|
import { describe, expect, it } from "vitest";
|
|
import { Switch } from "@/components/ui/switch";
|
|
|
|
describe("Switch", () => {
|
|
it("keeps the default size and action color", () => {
|
|
render(<Switch aria-label="default" defaultChecked />);
|
|
const element = screen.getByRole("switch", { name: "default" });
|
|
expect(element).toHaveAttribute("data-size", "default");
|
|
expect(element.className).toContain("w-[30px]");
|
|
expect(element.className).toContain("data-[state=checked]:bg-action");
|
|
});
|
|
|
|
it("uses the action color for the small variant too", () => {
|
|
render(<Switch aria-label="small" size="sm" />);
|
|
const element = screen.getByRole("switch", { name: "small" });
|
|
expect(element).toHaveAttribute("data-size", "sm");
|
|
expect(element.className).toContain("w-[26px]");
|
|
expect(element.className).toContain("data-[state=checked]:bg-action");
|
|
});
|
|
});
|