overleaf/services/web/test/frontend/features/layout/components/switch-to-editor-button.spec.tsx
Tim Down e60885aa88 Merge pull request #19347 from overleaf/td-bs5-cypress-css
Move CSS loading in Cypress to individual test spec files

GitOrigin-RevId: 92bb5167cfa81b0bd54acc724efb23b397421ccb
2024-07-25 08:05:16 +00:00

39 lines
1.2 KiB
TypeScript

import '../../../helpers/bootstrap-3'
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')
})
})