CommonDivider.spec.ts 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  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. })