CommonBreadcrumb.spec.ts 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. // Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. import { renderComponent } from '#tests/support/components/index.ts'
  3. import CommonBreadcrumb from '../CommonBreadcrumb.vue'
  4. describe('breadcrumb', () => {
  5. it('renders the breadcrumb', async () => {
  6. const view = renderComponent(CommonBreadcrumb, {
  7. props: {
  8. items: [
  9. {
  10. label: 'Dashboard',
  11. route: '/',
  12. },
  13. {
  14. label: 'Settings',
  15. },
  16. ],
  17. },
  18. router: true,
  19. })
  20. const link = view.getByRole('link')
  21. expect(link).toHaveTextContent('Dashboard')
  22. expect(link).toHaveAttribute('href', '/desktop/')
  23. expect(view.getByText('Settings')).toBeInTheDocument()
  24. })
  25. it('renders icons', async () => {
  26. const view = renderComponent(CommonBreadcrumb, {
  27. props: {
  28. items: [
  29. {
  30. label: 'Dashboard',
  31. route: '/',
  32. icon: 'eye',
  33. },
  34. {
  35. label: 'Settings',
  36. },
  37. ],
  38. },
  39. router: true,
  40. })
  41. const icon = view.getByIconName('eye')
  42. expect(icon).toBeInTheDocument()
  43. })
  44. })