mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2025-07-29 05:00:06 +02:00

* Move `ui.view` to setState * Move `openFile` to setState * Move `ui.leftMenuShown` to setState * Move `ui.miniReviewPanelVisible` to setState * Move `ui.pdfLayout` to setState * Move `ui.chatOpen` to setState * Move `ui.reviewPanelOpen` to setState * Cleanup: remove layout-context-adapter and imports * Replace `ui` scope by mocked `LayoutProvider` in tests * Update test * Remove unnecessary `scopeStore.set('ui.chatOpen' ...` GitOrigin-RevId: 81578bfdc958239eac492905f714a6074c81d0f5
50 lines
1.3 KiB
TypeScript
50 lines
1.3 KiB
TypeScript
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
|
|
layoutContext={{ view: 'pdf', pdfLayout: 'flat', chatIsOpen: false }}
|
|
>
|
|
<SwitchToEditorButton />
|
|
</EditorProviders>
|
|
)
|
|
|
|
cy.findByRole('button', { name: 'Switch to editor' })
|
|
})
|
|
|
|
it('does not show button in split screen layout', function () {
|
|
cy.mount(
|
|
<EditorProviders
|
|
layoutContext={{
|
|
view: 'pdf',
|
|
pdfLayout: 'sideBySide',
|
|
chatIsOpen: 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
|
|
layoutContext={{
|
|
view: 'pdf',
|
|
pdfLayout: 'flat',
|
|
chatIsOpen: false,
|
|
}}
|
|
>
|
|
<SwitchToEditorButton />
|
|
</EditorProviders>
|
|
)
|
|
|
|
cy.findByRole('button', { name: 'Switch to editor' }).should('not.exist')
|
|
})
|
|
})
|