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

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