first commit

This commit is contained in:
2025-04-24 13:11:28 +08:00
commit ff9c54d5e4
5960 changed files with 834111 additions and 0 deletions

View File

@@ -0,0 +1,38 @@
import { EditorProviders } from '../../../helpers/editor-providers'
import SwitchToEditorButton from '@/features/pdf-preview/components/switch-to-editor-button'
describe('<SwitchToEditorButton />', function () {
it('shows button in full screen pdf layout', function () {
cy.mount(
<EditorProviders ui={{ view: 'pdf', pdfLayout: 'flat', chatOpen: false }}>
<SwitchToEditorButton />
</EditorProviders>
)
cy.findByRole('button', { name: 'Switch to editor' })
})
it('does not show button in split screen layout', function () {
cy.mount(
<EditorProviders
ui={{ view: 'pdf', pdfLayout: 'sideBySide', chatOpen: false }}
>
<SwitchToEditorButton />
</EditorProviders>
)
cy.findByRole('button', { name: 'Switch to editor' }).should('not.exist')
})
it('does not show button when detached', function () {
window.metaAttributesCache.set('ol-detachRole', 'detacher')
cy.mount(
<EditorProviders ui={{ view: 'pdf', pdfLayout: 'flat', chatOpen: false }}>
<SwitchToEditorButton />
</EditorProviders>
)
cy.findByRole('button', { name: 'Switch to editor' }).should('not.exist')
})
})

View File

@@ -0,0 +1,42 @@
import SwitchToPDFButton from '@/features/source-editor/components/switch-to-pdf-button'
import { EditorProviders } from '../../../helpers/editor-providers'
describe('<SwitchToPDFButton />', function () {
it('shows button in full screen editor layout', function () {
cy.mount(
<EditorProviders
ui={{ view: 'editor', pdfLayout: 'flat', chatOpen: false }}
>
<SwitchToPDFButton />
</EditorProviders>
)
cy.findByRole('button', { name: 'Switch to PDF' })
})
it('does not show button in split screen layout', function () {
cy.mount(
<EditorProviders
ui={{ view: 'editor', pdfLayout: 'sideBySide', chatOpen: false }}
>
<SwitchToPDFButton />
</EditorProviders>
)
cy.findByRole('button', { name: 'Switch to PDF' }).should('not.exist')
})
it('does not show button when detached', function () {
window.metaAttributesCache.set('ol-detachRole', 'detacher')
cy.mount(
<EditorProviders
ui={{ view: 'editor', pdfLayout: 'flat', chatOpen: false }}
>
<SwitchToPDFButton />
</EditorProviders>
)
cy.findByRole('button', { name: 'Switch to PDF' }).should('not.exist')
})
})