CommonDivider.spec.ts 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. // Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. import { renderComponent } from '#tests/support/components/index.ts'
  3. import CommonDivider from '../CommonDivider.vue'
  4. describe('CommonDivider.vue', () => {
  5. it('renders with default prop values', async () => {
  6. const view = renderComponent(CommonDivider)
  7. expect(view.getByRole('separator')).toHaveClasses(['w-full', 'h-px'])
  8. })
  9. it('supports vertical orientation', async () => {
  10. const view = renderComponent(CommonDivider, {
  11. props: {
  12. orientation: 'vertical',
  13. },
  14. })
  15. expect(view.getByRole('separator')).toHaveClasses(['w-px', 'h-full'])
  16. })
  17. it('supports padding prop', async () => {
  18. const view = renderComponent(CommonDivider, {
  19. props: {
  20. padding: true,
  21. },
  22. })
  23. const container = view.getByRole('separator').parentElement
  24. expect(container).toHaveClass('px-2.5')
  25. await view.rerender({
  26. orientation: 'vertical',
  27. })
  28. expect(container).not.toHaveClass('px-2.5')
  29. expect(container).toHaveClass('py-2.5')
  30. })
  31. it('supports alternative background prop', async () => {
  32. const view = renderComponent(CommonDivider, {
  33. props: {
  34. alternativeBackground: true,
  35. },
  36. })
  37. const separator = view.getByRole('separator')
  38. expect(separator).toHaveClasses(['bg-white', 'dark:bg-gray-200'])
  39. await view.rerender({
  40. alternativeBackground: false,
  41. })
  42. expect(separator).toHaveClasses(['bg-neutral-100', 'dark:bg-gray-900'])
  43. })
  44. })