@vertisanpro/flowbite-react
Version:
Non-Official React components built for Flowbite and Tailwind CSS
29 lines (28 loc) • 1.1 kB
JavaScript
import { render, screen } from '@testing-library/react';
import React from 'react';
import { describe, expect, it } from 'vitest';
import { Flowbite } from '../Flowbite';
import { Checkbox } from './Checkbox';
describe.concurrent('Components / Checkbox', () => {
describe.concurrent('A11y', () => {
it('should have role="checkbox" by default', () => {
const checkbox = render(React.createElement(Checkbox, null)).getByRole('checkbox');
expect(checkbox).toBeInTheDocument();
});
});
describe('Theme', () => {
it('should use custom `base` classes', () => {
const theme = {
checkbox: {
root: {
base: 'bg-yellow-400 dark:bg-yellow-40',
},
},
};
render(React.createElement(Flowbite, { theme: { theme } },
React.createElement(Checkbox, null)));
expect(checkbox()).toHaveClass('bg-yellow-400 dark:bg-yellow-40');
});
});
});
const checkbox = () => screen.getByRole('checkbox');