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(() => {
|
2022-01-30 15:46:43 -05:00
|
|
|
cy.visitTestNote()
|
2021-06-21 17:13:39 -04:00
|
|
|
})
|
|
|
|
|
|
|
|
it('can show both panes', () => {
|
2021-12-25 10:44:24 -05:00
|
|
|
cy.getByCypressId('view-mode-both').click()
|
|
|
|
cy.getByCypressId('splitter-left').should('be.visible')
|
|
|
|
cy.getByCypressId('splitter-right').should('be.visible')
|
2021-06-21 17:13:39 -04:00
|
|
|
})
|
|
|
|
|
|
|
|
it('can show only preview pane', () => {
|
2021-12-25 10:44:24 -05:00
|
|
|
cy.getByCypressId('view-mode-preview').click()
|
|
|
|
cy.getByCypressId('splitter-left').should('be.not.visible')
|
|
|
|
cy.getByCypressId('splitter-right').should('be.visible')
|
2021-06-21 17:13:39 -04:00
|
|
|
})
|
|
|
|
|
|
|
|
it('can show only editor pane', () => {
|
2021-12-25 10:44:24 -05:00
|
|
|
cy.getByCypressId('view-mode-editor').click()
|
|
|
|
cy.getByCypressId('splitter-left').should('be.visible')
|
|
|
|
cy.getByCypressId('splitter-right').should('be.not.visible')
|
2021-06-21 17:13:39 -04:00
|
|
|
})
|
|
|
|
|
|
|
|
it('can change the split by dragging', () => {
|
2021-12-25 10:44:24 -05:00
|
|
|
cy.getByCypressId('splitter-left').then((leftPanebefore) => {
|
2021-06-21 17:13:39 -04:00
|
|
|
const widthBefore = leftPanebefore.outerWidth()
|
|
|
|
|
2021-12-25 10:44:24 -05:00
|
|
|
cy.getByCypressId('view-mode-both').click()
|
|
|
|
cy.getByCypressId('split-divider').should('be.visible').trigger('mousedown', { buttons: 1 })
|
2021-06-21 17:13:39 -04:00
|
|
|
cy.document().trigger('mousemove', { buttons: 1, pageX: 0, pageY: 0 })
|
2021-12-25 10:44:24 -05:00
|
|
|
cy.getByCypressId('split-divider').trigger('mouseup')
|
2021-06-21 17:13:39 -04:00
|
|
|
|
2021-12-25 10:44:24 -05:00
|
|
|
cy.getByCypressId('splitter-left').should('not.eq', widthBefore)
|
2021-06-21 17:13:39 -04:00
|
|
|
})
|
|
|
|
})
|
|
|
|
})
|