buttonBar.spec.tsx 757 B

12345678910111213141516171819202122
  1. import {render, screen} from 'sentry-test/reactTestingLibrary';
  2. import Button from 'sentry/components/button';
  3. import ButtonBar from 'sentry/components/buttonBar';
  4. describe('ButtonBar', function () {
  5. const createWrapper = () =>
  6. render(
  7. <ButtonBar active="2" merged>
  8. <Button barId="1">First Button</Button>
  9. <Button barId="2">Second Button</Button>
  10. <Button barId="3">Third Button</Button>
  11. <Button barId="4">Fourth Button</Button>
  12. </ButtonBar>
  13. );
  14. it('has "Second Button" as the active button in the bar', function () {
  15. createWrapper();
  16. expect(screen.getByLabelText('First Button')).not.toHaveClass('active');
  17. expect(screen.getByLabelText('Second Button')).toHaveClass('active');
  18. });
  19. });