1 | import React from 'react';
|
2 | import { render, screen } from '@testing-library/react';
|
3 | import { ButtonGroup } from '..';
|
4 | import { testForChildrenInComponent, testForCustomTag } from '../testUtils';
|
5 |
|
6 | describe('ButtonGroup', () => {
|
7 | it('should render children', () => {
|
8 | testForChildrenInComponent(ButtonGroup);
|
9 | });
|
10 |
|
11 | it('should render different size classes', () => {
|
12 | render(
|
13 | <>
|
14 | <ButtonGroup size="sm">Small Button</ButtonGroup>
|
15 | <ButtonGroup size="lg">Large Button</ButtonGroup>
|
16 | </>,
|
17 | );
|
18 |
|
19 | expect(screen.getByText(/small/i)).toHaveClass('btn-group-sm');
|
20 | expect(screen.getByText(/large/i)).toHaveClass('btn-group-lg');
|
21 | });
|
22 |
|
23 | it('should render vertical class', () => {
|
24 | render(<ButtonGroup vertical>Vertical Group</ButtonGroup>);
|
25 |
|
26 | expect(screen.getByText(/vertical/i)).toHaveClass('btn-group-vertical');
|
27 | });
|
28 |
|
29 | it('should render custom tag', () => {
|
30 | testForCustomTag(ButtonGroup);
|
31 | });
|
32 | });
|