CommonPopoverMenuItem.spec.ts 923 B

123456789101112131415161718192021222324252627282930313233343536
  1. // Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. import { renderComponent } from '#tests/support/components/index.ts'
  3. import CommonPopoverMenuItem from '../CommonPopoverMenuItem.vue'
  4. const renderMenuItem = (props: any = {}, slots: any = {}) => {
  5. return renderComponent(CommonPopoverMenuItem, {
  6. props,
  7. slots,
  8. shallow: false,
  9. router: true,
  10. store: true,
  11. })
  12. }
  13. describe('rendering item for section', () => {
  14. it('renders a link, if link is provided', () => {
  15. const view = renderMenuItem({
  16. link: '/',
  17. label: 'Test Title',
  18. })
  19. expect(view.getByTestId('popover-menu-item').tagName).toBe('A')
  20. expect(view.getByText('Test Title')).toBeInTheDocument()
  21. })
  22. it('has an icon, if provided', () => {
  23. const view = renderMenuItem({
  24. link: '/',
  25. icon: 'search',
  26. })
  27. expect(view.getByIconName('search')).toBeInTheDocument()
  28. })
  29. })