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

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