Files
novalon-website/src/components/ui/switch.test.tsx
T
zhangxiang 602ed6a671 test(hooks): finalize mutation test improvements and release acceptance
- Raise use-swipe-gesture mutation score to 66.13% (target 65%+)
- Maintain use-reduced-motion mutation score at 76.32% (target 50%+)
- Fix use-reduced-motion.ts ESLint set-state-in-effect warning
- Add UJ-10 deep searcher journey (category browse → article read → content discovery)
- Add 40 new test files (analytics, detail, sections, ui, lib components)
- Update test-strategy-plan.md to v2.0 (sync test count to 1591)
- Sync README.md with final release metrics

Quality gates: TS 0 errors, ESLint 0 errors, 121 suites / 1591 tests passed
2026-08-02 19:39:27 +08:00

31 lines
1.0 KiB
TypeScript

// @ts-nocheck
import { describe, it, expect } from '@jest/globals';
import { render, screen } from '@testing-library/react';
import '@testing-library/jest-dom';
import { Switch } from './switch';
describe('Switch', () => {
it('renders with data-slot="switch"', () => {
const { container } = render(<Switch />);
const switchEl = container.querySelector('[data-slot="switch"]');
expect(switchEl).toBeInTheDocument();
});
it('renders thumb with data-slot="switch-thumb"', () => {
const { container } = render(<Switch />);
const thumb = container.querySelector('[data-slot="switch-thumb"]');
expect(thumb).toBeInTheDocument();
});
it('applies custom className', () => {
const { container } = render(<Switch className="custom-class" />);
const switchEl = container.querySelector('[data-slot="switch"]');
expect(switchEl).toHaveClass('custom-class');
});
it('can be disabled', () => {
render(<Switch disabled />);
const switchEl = screen.getByRole('switch');
expect(switchEl).toBeDisabled();
});
});