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

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