progressBar.spec.tsx 760 B

1234567891011121314151617181920212223
  1. import {render, screen} from 'sentry-test/reactTestingLibrary';
  2. import ProgressBar from 'sentry/components/progressBar';
  3. describe('ProgressBar', function () {
  4. it('basic', function () {
  5. const progressBarValue = 50;
  6. const {container} = render(<ProgressBar value={progressBarValue} />);
  7. expect(container).toSnapshot();
  8. const elementProperties = screen.getByRole('progressbar');
  9. // element exists
  10. expect(elementProperties).toBeInTheDocument();
  11. // check aria attributes
  12. expect(elementProperties).toHaveAttribute(
  13. 'aria-valuenow',
  14. progressBarValue.toString()
  15. );
  16. expect(elementProperties).toHaveAttribute('aria-valuemin', '0');
  17. expect(elementProperties).toHaveAttribute('aria-valuemax', '100');
  18. });
  19. });