personal-setting-overviews-a11y.spec.ts 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. // Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. import { axe } from 'vitest-axe'
  3. import { visitView } from '#tests/support/components/visitView.ts'
  4. import { mockPermissions } from '#tests/support/mock-permissions.ts'
  5. import { mockUserCurrent } from '#tests/support/mock-userCurrent.ts'
  6. import { convertToGraphQLId } from '#shared/graphql/utils.ts'
  7. import { mockUserCurrentOverviewListQuery } from '../graphql/queries/userCurrentOverviewList.mocks.ts'
  8. const userCurrentOverviewList = [
  9. {
  10. id: convertToGraphQLId('Overview', 1),
  11. name: 'Open Tickets',
  12. },
  13. {
  14. id: convertToGraphQLId('Overview', 2),
  15. name: 'My Tickets',
  16. },
  17. {
  18. id: convertToGraphQLId('Overview', 3),
  19. name: 'All Tickets',
  20. },
  21. ]
  22. describe('personal settings for token access', () => {
  23. beforeEach(() => {
  24. mockUserCurrent({
  25. firstname: 'John',
  26. lastname: 'Doe',
  27. })
  28. mockPermissions(['user_preferences.overview_sorting'])
  29. })
  30. it('has no accessibility violations', async () => {
  31. mockUserCurrentOverviewListQuery({ userCurrentOverviewList })
  32. const view = await visitView('/personal-setting/ticket-overviews')
  33. const results = await axe(view.html())
  34. expect(results).toHaveNoViolations()
  35. })
  36. })