hedgedoc/cypress/support/fill.ts
Tilman Vatteroth 6a6f6105b9
Upgrade to CodeMirror 6 (#1787)
Upgrade to CodeMirror 6

Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
2022-02-13 11:14:01 +00:00

20 lines
566 B
TypeScript

/*
* SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
import 'cypress-fill-command'
declare namespace Cypress {
interface Chainable {
setCodemirrorContent(value: string): Chainable<Element>
}
}
Cypress.Commands.add('setCodemirrorContent', (content: string) => {
const line = content.split('\n').find((value) => value !== '')
cy.get('.cm-editor').click().get('.cm-content').fill(content)
if (line) {
cy.get('.cm-editor').find('.cm-line').should('contain.text', line)
}
})