mirror of
https://github.com/usememos/memos.git
synced 2026-11-20 10:59:11 +01:00
c640884067
Use neutral, theme-aware surfaces and consistent density for hints, menus, dialogs, and form controls. Restore visible field focus and use Base UI tabs for keyboard navigation and RTL support.
17 lines
694 B
TypeScript
17 lines
694 B
TypeScript
import { render, screen } from "@testing-library/react";
|
|
import { describe, expect, it } from "vitest";
|
|
import { Switch } from "@/components/ui/switch";
|
|
|
|
describe("Switch", () => {
|
|
it("moves the checked thumb toward the inline end in both text directions", () => {
|
|
render(<Switch aria-label="Example setting" defaultChecked />);
|
|
|
|
const root = screen.getByRole("switch", { name: "Example setting" });
|
|
const thumb = root.querySelector('[data-slot="switch-thumb"]');
|
|
|
|
expect(root).toHaveAttribute("aria-checked", "true");
|
|
expect(thumb).toHaveAttribute("data-checked");
|
|
expect(thumb).toHaveClass("data-checked:translate-x-3", "rtl:data-checked:-translate-x-3");
|
|
});
|
|
});
|