mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
b62cb86bf8
* Create a new shared `SplitMenu` component. * Refactor the pdf compile button & detached compile button: - Rename `detach-compile-button` to `detach-compile-button-wrapper` - Rename `pdf-compile-button-inner` to `detach-compile-button` - Move some of the logic from `detach-compile-button-wrapper` to `detach-compile-button` - Create a new `compile-button.less` to centralize all of the compile button (detached/non-detached) custom styles rule. - Extract the animated striped CSS definition to the dedicated CSS file, change the class from `btn-recompile-group-has-changes` to `btn-striped-animated` - Refactor other className(s) appropriately according to the new component name - Delete the unused `changes-to-autocompile` css rule since it has not been used anywhere * Implement the new pdf compile button with the new `SplitMenu` component. GitOrigin-RevId: d1d055bffd311923fc47b4681605ce8ba8e26f25
77 lines
2 KiB
TypeScript
77 lines
2 KiB
TypeScript
import { EditorProviders } from '../../helpers/editor-providers'
|
|
import DetachCompileButtonWrapper from '../../../../frontend/js/features/pdf-preview/components/detach-compile-button-wrapper'
|
|
import { mockScope } from './scope'
|
|
import { testDetachChannel } from '../../helpers/detach-channel'
|
|
|
|
describe('<DetachCompileButtonWrapper />', function () {
|
|
beforeEach(function () {
|
|
cy.interceptCompile()
|
|
cy.interceptEvents()
|
|
})
|
|
|
|
afterEach(function () {
|
|
window.metaAttributesCache = new Map()
|
|
})
|
|
|
|
it('detacher mode and not linked: does not show button ', function () {
|
|
cy.window().then(win => {
|
|
win.metaAttributesCache = new Map([['ol-detachRole', 'detacher']])
|
|
})
|
|
|
|
const scope = mockScope()
|
|
|
|
cy.mount(
|
|
<EditorProviders scope={scope}>
|
|
<DetachCompileButtonWrapper />
|
|
</EditorProviders>
|
|
)
|
|
|
|
cy.findByRole('button', { name: 'Recompile' }).should('not.exist')
|
|
})
|
|
|
|
it('detacher mode and linked: show button', function () {
|
|
cy.window().then(win => {
|
|
win.metaAttributesCache = new Map([['ol-detachRole', 'detacher']])
|
|
})
|
|
|
|
const scope = mockScope()
|
|
|
|
cy.mount(
|
|
<EditorProviders scope={scope}>
|
|
<DetachCompileButtonWrapper />
|
|
</EditorProviders>
|
|
)
|
|
|
|
cy.wrap(null).then(() => {
|
|
testDetachChannel.postMessage({
|
|
role: 'detached',
|
|
event: 'connected',
|
|
})
|
|
})
|
|
|
|
cy.findByRole('button', { name: 'Recompile' })
|
|
})
|
|
|
|
it('not detacher mode and linked: does not show button ', function () {
|
|
cy.window().then(win => {
|
|
win.metaAttributesCache = new Map([['ol-detachRole', 'detached']])
|
|
})
|
|
|
|
const scope = mockScope()
|
|
|
|
cy.mount(
|
|
<EditorProviders scope={scope}>
|
|
<DetachCompileButtonWrapper />
|
|
</EditorProviders>
|
|
)
|
|
|
|
cy.wrap(null).then(() => {
|
|
testDetachChannel.postMessage({
|
|
role: 'detacher',
|
|
event: 'connected',
|
|
})
|
|
})
|
|
|
|
cy.findByRole('button', { name: 'Recompile' }).should('not.exist')
|
|
})
|
|
})
|