mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-17 16:44:49 -04:00
Move copy button test from e2e to unit test
Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
This commit is contained in:
parent
aca9856766
commit
bf1881eb54
4 changed files with 185 additions and 32 deletions
|
@ -91,21 +91,4 @@ describe('Code', () => {
|
|||
})
|
||||
})
|
||||
})
|
||||
|
||||
it('has a working copy button', () => {
|
||||
cy.setCodemirrorContent('```javascript \nlet x = 0\n```')
|
||||
|
||||
cy.getByCypressId('documentIframe').then((element: JQuery<HTMLElement>) => {
|
||||
const frame = element.get(0) as HTMLIFrameElement
|
||||
if (frame === null || frame.contentWindow === null) {
|
||||
return cy.wrap(null)
|
||||
}
|
||||
|
||||
cy.spy(frame.contentWindow.navigator.clipboard, 'writeText').as('copy')
|
||||
})
|
||||
|
||||
cy.getIframeBody().findByCypressId('copy-code-button').click()
|
||||
|
||||
cy.get('@copy').should('be.calledWithExactly', 'let x = 0\n')
|
||||
})
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue