switch-to-pdf-button.spec.tsx 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. import SwitchToPDFButton from '@/features/source-editor/components/switch-to-pdf-button'
  2. import { EditorProviders } from '../../../helpers/editor-providers'
  3. describe('<SwitchToPDFButton />', function () {
  4. it('shows button in full screen editor layout', function () {
  5. cy.mount(
  6. <EditorProviders
  7. layoutContext={{ view: 'editor', pdfLayout: 'flat', chatIsOpen: false }}
  8. >
  9. <SwitchToPDFButton />
  10. </EditorProviders>
  11. )
  12. cy.findByRole('button', { name: 'Switch to PDF' })
  13. })
  14. it('does not show button in split screen layout', function () {
  15. cy.mount(
  16. <EditorProviders
  17. layoutContext={{
  18. view: 'editor',
  19. pdfLayout: 'sideBySide',
  20. chatIsOpen: false,
  21. }}
  22. >
  23. <SwitchToPDFButton />
  24. </EditorProviders>
  25. )
  26. cy.findByRole('button', { name: 'Switch to PDF' }).should('not.exist')
  27. })
  28. it('does not show button when detached', function () {
  29. window.metaAttributesCache.set('ol-detachRole', 'detacher')
  30. cy.mount(
  31. <EditorProviders
  32. layoutContext={{ view: 'editor', pdfLayout: 'flat', chatIsOpen: false }}
  33. >
  34. <SwitchToPDFButton />
  35. </EditorProviders>
  36. )
  37. cy.findByRole('button', { name: 'Switch to PDF' }).should('not.exist')
  38. })
  39. })