/
ai_sampletext
/
DiplomWork
Обзор
Документация
Войти
/
ai_sampletext
/
DiplomWork
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
node_modules/react-day-picker/src/components/Button/Button.test.tsx
45 строк
1 KB
boolyshareyo
Initial commit
08 июн 2026, 16:00
08 июн 2026, 16:00
6216a29
Код
Авторство
О чём код?
import { screen } from '@testing-library/react'; import { customRender } from 'test/render'; import { Button } from './Button'; let button: HTMLButtonElement; describe('when rendered without props', () => { beforeEach(() => { customRender(<Button className="foo" style={{ color: 'blue' }} />); button = screen.getByRole('button'); }); test('should render a button with type "button"', () => { expect(button).toHaveAttribute('type', 'button'); }); test('should render a button with the button class name', () => { expect(button).toHaveClass('rdp-button'); }); test('should render a button with the reset class name', () => { expect(button).toHaveClass('rdp-button_reset'); }); test('should add the class name', () => { expect(button).toHaveClass('foo'); }); test('should apply the style', () => { expect(button).toHaveStyle({ color: 'blue' }); }); }); describe('when using class names and styles from context', () => { beforeEach(() => { customRender(<Button />, { classNames: { button: 'foo' }, styles: { button: { color: 'red' } } }); button = screen.getByRole('button'); }); test('should apply the style', () => { expect(button).toHaveStyle({ color: 'red' }); }); test('should apply the class name', () => { expect(button).toHaveClass('foo'); }); });