CommonLogo.spec.ts 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. // Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. import { nextTick } from 'vue'
  3. import { renderComponent } from '#tests/support/components/index.ts'
  4. import { useApplicationStore } from '#shared/stores/application.ts'
  5. import CommonLogo from '../CommonLogo.vue'
  6. describe('CommonLogo.vue', () => {
  7. it('renders custom logo', async () => {
  8. const wrapper = renderComponent(CommonLogo, { store: true })
  9. const application = useApplicationStore()
  10. application.config.product_logo = '1234'
  11. application.config.product_name = 'Zammad Custom Logo'
  12. await nextTick()
  13. const img = wrapper.container.querySelector('img')
  14. expect(img).toHaveAttribute('alt', 'Zammad Custom Logo')
  15. expect(img).toHaveAttribute(
  16. 'src',
  17. '/api/v1/system_assets/product_logo/1234',
  18. )
  19. })
  20. it('renders default zammad logo', async () => {
  21. const wrapper = renderComponent(CommonLogo, { store: true })
  22. const application = useApplicationStore()
  23. application.config.product_logo = 'logo.svg'
  24. application.config.product_name = ''
  25. await nextTick()
  26. const img = wrapper.container.querySelector('img')
  27. expect(img).toHaveAttribute('alt', '')
  28. expect(img).toHaveAttribute(
  29. 'src',
  30. '/api/v1/system_assets/product_logo/logo.svg',
  31. )
  32. })
  33. })