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

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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
  7. layoutContext={{ view: 'pdf', pdfLayout: 'flat', chatIsOpen: false }}
  8. >
  9. <SwitchToEditorButton />
  10. </EditorProviders>
  11. )
  12. cy.findByRole('button', { name: 'Switch to editor' })
  13. })
  14. it('does not show button in split screen layout', function () {
  15. cy.mount(
  16. <EditorProviders
  17. layoutContext={{
  18. view: 'pdf',
  19. pdfLayout: 'sideBySide',
  20. chatIsOpen: false,
  21. }}
  22. >
  23. <SwitchToEditorButton />
  24. </EditorProviders>
  25. )
  26. cy.findByRole('button', { name: 'Switch to editor' }).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={{
  33. view: 'pdf',
  34. pdfLayout: 'flat',
  35. chatIsOpen: false,
  36. }}
  37. >
  38. <SwitchToEditorButton />
  39. </EditorProviders>
  40. )
  41. cy.findByRole('button', { name: 'Switch to editor' }).should('not.exist')
  42. })
  43. })