2021-01-06 07:09:33 -05:00
|
|
|
/*
|
2021-01-06 15:37:59 -05:00
|
|
|
* SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
|
2021-01-06 07:09:33 -05:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
*/
|
2022-02-13 06:14:01 -05:00
|
|
|
import 'cypress-fill-command'
|
2021-01-06 07:09:33 -05:00
|
|
|
|
|
|
|
declare namespace Cypress {
|
|
|
|
interface Chainable {
|
2021-10-04 06:50:39 -04:00
|
|
|
setCodemirrorContent(value: string): Chainable<Element>
|
2021-01-06 07:09:33 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-10-04 06:50:39 -04:00
|
|
|
Cypress.Commands.add('setCodemirrorContent', (content: string) => {
|
2021-11-19 12:04:04 -05:00
|
|
|
const line = content.split('\n').find((value) => value !== '')
|
2022-02-13 06:14:01 -05:00
|
|
|
cy.get('.cm-editor').click().get('.cm-content').fill(content)
|
2021-02-03 16:13:04 -05:00
|
|
|
if (line) {
|
2022-02-13 06:14:01 -05:00
|
|
|
cy.get('.cm-editor').find('.cm-line').should('contain.text', line)
|
2021-01-15 16:54:43 -05:00
|
|
|
}
|
2021-01-06 07:09:33 -05:00
|
|
|
})
|