2021-06-21 17:13:39 -04:00
|
|
|
/*
|
|
|
|
* SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
*/
|
|
|
|
|
|
|
|
describe('Split view', () => {
|
|
|
|
beforeEach(() => {
|
|
|
|
cy.visitTestEditor()
|
|
|
|
})
|
|
|
|
|
|
|
|
it('can show both panes', () => {
|
2021-11-19 12:04:04 -05:00
|
|
|
cy.getById('view-mode-both').click()
|
2021-06-21 17:13:39 -04:00
|
|
|
cy.get('.splitter.left').should('be.visible')
|
|
|
|
cy.get('.splitter.right').should('be.visible')
|
|
|
|
})
|
|
|
|
|
|
|
|
it('can show only preview pane', () => {
|
2021-11-19 12:04:04 -05:00
|
|
|
cy.getById('view-mode-preview').click()
|
2021-06-21 17:13:39 -04:00
|
|
|
cy.get('.splitter.left').should('be.not.visible')
|
|
|
|
cy.get('.splitter.right').should('be.visible')
|
|
|
|
})
|
|
|
|
|
|
|
|
it('can show only editor pane', () => {
|
2021-11-19 12:04:04 -05:00
|
|
|
cy.getById('view-mode-editor').click()
|
2021-06-21 17:13:39 -04:00
|
|
|
cy.get('.splitter.left').should('be.visible')
|
|
|
|
cy.get('.splitter.right').should('be.not.visible')
|
|
|
|
})
|
|
|
|
|
|
|
|
it('can change the split by dragging', () => {
|
|
|
|
cy.get('.splitter.left').then((leftPanebefore) => {
|
|
|
|
const widthBefore = leftPanebefore.outerWidth()
|
|
|
|
|
2021-11-19 12:04:04 -05:00
|
|
|
cy.getById('view-mode-both').click()
|
2021-06-21 17:13:39 -04:00
|
|
|
cy.get('.split-divider').should('be.visible').trigger('mousedown', { buttons: 1 })
|
|
|
|
cy.document().trigger('mousemove', { buttons: 1, pageX: 0, pageY: 0 })
|
|
|
|
cy.get('.split-divider').trigger('mouseup')
|
|
|
|
|
|
|
|
cy.get('.splitter.left').should('not.eq', widthBefore)
|
|
|
|
})
|
|
|
|
})
|
|
|
|
})
|