buttonBar.spec.jsx 968 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. import React from 'react';
  2. import {mountWithTheme} from 'sentry-test/enzyme';
  3. import Button from 'app/components/button';
  4. import ButtonBar from 'app/components/buttonBar';
  5. describe('ButtonBar', function() {
  6. const createWrapper = () =>
  7. mountWithTheme(
  8. <ButtonBar active="2" merged>
  9. <Button barId="1">First Button</Button>
  10. <Button barId="2">Second Button</Button>
  11. <Button barId="3">Third Button</Button>
  12. <Button barId="4">Fourth Button</Button>
  13. </ButtonBar>
  14. );
  15. it('has "Second Button" as the active button in the bar', function() {
  16. const wrapper = createWrapper();
  17. expect(
  18. wrapper
  19. .find('Button')
  20. .at(1)
  21. .prop('priority')
  22. ).toBe('primary');
  23. });
  24. it('does not pass `barId` down to the button', function() {
  25. const wrapper = createWrapper();
  26. expect(
  27. wrapper
  28. .find('Button')
  29. .at(1)
  30. .prop('barId')
  31. ).toBeUndefined();
  32. });
  33. });