File size: 818 Bytes
1e92f2d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
/**
* @jest-environment jsdom
*/
import { Button } from '@automattic/components';
import { render, screen } from '@testing-library/react';
import ButtonGroup from '..';
describe( 'ButtonGroup', () => {
test( 'should have ButtonGroup class', () => {
render( <ButtonGroup /> );
expect( screen.getByRole( 'group' ) ).toHaveClass( 'button-group' );
} );
test( 'should contains the same number of .button nodes than <Button>s it receives', () => {
render(
<ButtonGroup>
<Button>test</Button>
<Button>test2</Button>
</ButtonGroup>
);
expect( screen.getAllByRole( 'button' ) ).toHaveLength( 2 );
} );
test( 'should get the busy `is-busy` class when passed the `busy` prop', () => {
render( <ButtonGroup busy /> );
expect( screen.getByRole( 'group' ) ).toHaveClass( 'is-busy' );
} );
} );
|