mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-06-04 16:54:11 -04:00
Wrap markdown rendering in iframe (#837)
Signed-off-by: Tilman Vatteroth <tilman.vatteroth@tu-dortmund.de>
This commit is contained in:
parent
bd31076928
commit
586969f368
45 changed files with 1014 additions and 287 deletions
|
@ -49,6 +49,10 @@ beforeEach(() => {
|
|||
version: 'mock',
|
||||
sourceCodeUrl: 'https://www.youtube.com/watch?v=dQw4w9WgXcQ',
|
||||
issueTrackerUrl: 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
|
||||
},
|
||||
"iframeCommunication": {
|
||||
"editorOrigin": "http://127.0.0.1:3001",
|
||||
"rendererOrigin": "http://127.0.0.1:3001"
|
||||
}
|
||||
}
|
||||
})
|
||||
|
|
27
cypress/support/getMarkdownRenderer.ts
Normal file
27
cypress/support/getMarkdownRenderer.ts
Normal file
|
@ -0,0 +1,27 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
declare namespace Cypress {
|
||||
interface Chainable {
|
||||
getMarkdownRenderer (): Chainable<Element>
|
||||
|
||||
getMarkdownBody (): Chainable<Element>
|
||||
}
|
||||
}
|
||||
|
||||
Cypress.Commands.add('getMarkdownRenderer', () => {
|
||||
return cy.get(`iframe[data-cy="documentIframe"]`)
|
||||
.its('0.contentDocument')
|
||||
.should('exist')
|
||||
.its('body')
|
||||
.should('not.be.undefined')
|
||||
.then(cy.wrap.bind(cy))
|
||||
})
|
||||
|
||||
Cypress.Commands.add('getMarkdownBody', () => {
|
||||
return cy.getMarkdownRenderer()
|
||||
.find('.markdown-body')
|
||||
})
|
|
@ -24,4 +24,5 @@ import 'cypress-file-upload'
|
|||
import './checkLinks'
|
||||
import './config'
|
||||
import './fill'
|
||||
import './getMarkdownRenderer'
|
||||
import './login'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue