CommonProgressBar.spec.ts 997 B

123456789101112131415161718192021222324252627282930
  1. // Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. import { renderComponent } from '#tests/support/components/index.ts'
  3. import CommonProgressBar from '../CommonProgressBar.vue'
  4. describe('CommonProgressBar.vue', () => {
  5. it('renders a progress bar with indeterminate state', async () => {
  6. const view = renderComponent(CommonProgressBar)
  7. const progressBar = view.getByRole('progressbar')
  8. expect(progressBar).toHaveClass('progress')
  9. expect(progressBar).not.toHaveAttribute('value')
  10. expect(progressBar).not.toHaveAttribute('max')
  11. })
  12. it('renders a progress bar with given value + max', async () => {
  13. const view = renderComponent(CommonProgressBar, {
  14. props: {
  15. value: '50',
  16. max: '100',
  17. },
  18. })
  19. const progressBar = view.getByRole('progressbar')
  20. expect(progressBar).toHaveClass('progress')
  21. expect(progressBar).toHaveAttribute('value', '50')
  22. expect(progressBar).toHaveAttribute('max', '100')
  23. })
  24. })