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

123456789101112131415161718192021222324252627282930313233343536373839404142
  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. ui={{ view: 'editor', pdfLayout: 'flat', chatOpen: 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. ui={{ view: 'editor', pdfLayout: 'sideBySide', chatOpen: false }}
  18. >
  19. <SwitchToPDFButton />
  20. </EditorProviders>
  21. )
  22. cy.findByRole('button', { name: 'Switch to PDF' }).should('not.exist')
  23. })
  24. it('does not show button when detached', function () {
  25. window.metaAttributesCache.set('ol-detachRole', 'detacher')
  26. cy.mount(
  27. <EditorProviders
  28. ui={{ view: 'editor', pdfLayout: 'flat', chatOpen: false }}
  29. >
  30. <SwitchToPDFButton />
  31. </EditorProviders>
  32. )
  33. cy.findByRole('button', { name: 'Switch to PDF' }).should('not.exist')
  34. })
  35. })