CommonLogo.spec.ts 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. // Copyright (C) 2012-2023 Zammad Foundation, https://zammad-foundation.org/
  2. import { nextTick } from 'vue'
  3. import { renderComponent } from '@tests/support/components'
  4. import { useApplicationStore } from '@shared/stores/application'
  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_name = 'Zammad Custom Logo'
  11. await nextTick()
  12. const img = wrapper.container.querySelector('img')
  13. expect(img).toHaveAttribute('alt', 'Zammad Custom Logo')
  14. expect(img).toHaveAttribute('src', '/assets/images/logo.svg')
  15. })
  16. it('renders default zammad logo', async () => {
  17. const wrapper = renderComponent(CommonLogo, { store: true })
  18. const application = useApplicationStore()
  19. application.config.product_logo = 'icons/logotype.svg'
  20. delete application.config.product_name
  21. await nextTick()
  22. const img = wrapper.container.querySelector('img')
  23. expect(img).not.toHaveAttribute('alt')
  24. expect(img).toHaveAttribute('src', '/assets/images/icons/logotype.svg')
  25. })
  26. })