mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-27 21:44:21 -04:00
Rewrite tests (#948)
Signed-off-by: Tilman Vatteroth <tilman.vatteroth@tu-dortmund.de>
This commit is contained in:
parent
9f6b1a9a46
commit
908a5ce984
15 changed files with 286 additions and 398 deletions
|
@ -12,12 +12,26 @@ declare namespace Cypress {
|
|||
* @example cy.get(input).fill('content')
|
||||
*/
|
||||
fill (value: string): Chainable<Element>
|
||||
codemirrorFill (value: string): Chainable<Element>
|
||||
}
|
||||
}
|
||||
|
||||
Cypress.Commands.add('fill', {
|
||||
prevSubject: 'element'
|
||||
}, (subject, value) => {
|
||||
cy.wrap(subject).invoke('val', value)
|
||||
.trigger('change', { force: true })
|
||||
return cy.wrap(subject)
|
||||
.invoke('val', value)
|
||||
.trigger('change', { force: true })
|
||||
})
|
||||
|
||||
Cypress.Commands.add('codemirrorFill', (content: string) => {
|
||||
const line = content.split("\n").find(value => value !== '');
|
||||
cy.get('.CodeMirror')
|
||||
.click()
|
||||
.get('textarea')
|
||||
.fill(content)
|
||||
if(line) {
|
||||
cy.get('.CodeMirror')
|
||||
.contains('.CodeMirror-line', line)
|
||||
}
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue