mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-31 07:08:40 -04:00
Update dependency cypress to v7 (#1183)
* Update dependency cypress to v7 Signed-off-by: Renovate Bot <bot@renovateapp.com> * Use global beforeEach for config loading Signed-off-by: Erik Michelson <github@erik.michelson.eu> Co-authored-by: Renovate Bot <bot@renovateapp.com> Co-authored-by: Erik Michelson <github@erik.michelson.eu>
This commit is contained in:
parent
010d451f78
commit
b42cb8fc49
27 changed files with 84 additions and 96 deletions
cypress/integration
91
cypress/integration/linkSchemes.spec.ts
Normal file
91
cypress/integration/linkSchemes.spec.ts
Normal file
|
@ -0,0 +1,91 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
describe('markdown formatted links to', () => {
|
||||
beforeEach(() => {
|
||||
cy.visitTestEditor()
|
||||
})
|
||||
|
||||
it('external domains render as external link', () => {
|
||||
cy.codemirrorFill('[external](https://hedgedoc.org/)')
|
||||
cy.getMarkdownBody()
|
||||
.find('a')
|
||||
.should('have.attr', 'href', 'https://hedgedoc.org/')
|
||||
.should('have.attr', 'rel', 'noreferer noopener')
|
||||
.should('have.attr', 'target', '_blank')
|
||||
})
|
||||
|
||||
it('note anchor references render as anchor link', () => {
|
||||
cy.codemirrorFill('[anchor](#anchor)')
|
||||
cy.getMarkdownBody()
|
||||
.find('a')
|
||||
.should('have.attr', 'href', 'http://127.0.0.1:3001/n/test#anchor')
|
||||
})
|
||||
|
||||
it('internal pages render as internal link', () => {
|
||||
cy.codemirrorFill('[internal](other-note)')
|
||||
cy.getMarkdownBody()
|
||||
.find('a')
|
||||
.should('have.attr', 'href', 'http://127.0.0.1:3001/n/other-note')
|
||||
})
|
||||
|
||||
it('data URIs do not render', () => {
|
||||
cy.codemirrorFill('[data](data:text/plain,evil)')
|
||||
cy.getMarkdownBody()
|
||||
.find('a')
|
||||
.should('not.exist')
|
||||
})
|
||||
|
||||
it('javascript URIs do not render', () => {
|
||||
cy.codemirrorFill('[js](javascript:alert("evil"))')
|
||||
cy.getMarkdownBody()
|
||||
.find('a')
|
||||
.should('not.exist')
|
||||
})
|
||||
})
|
||||
|
||||
describe('HTML anchor element links to', () => {
|
||||
beforeEach(() => {
|
||||
cy.visitTestEditor()
|
||||
})
|
||||
|
||||
it('external domains render as external link', () => {
|
||||
cy.codemirrorFill('<a href="https://hedgedoc.org/">external</a>')
|
||||
cy.getMarkdownBody()
|
||||
.find('a')
|
||||
.should('have.attr', 'href', 'https://hedgedoc.org/')
|
||||
.should('have.attr', 'rel', 'noreferer noopener')
|
||||
.should('have.attr', 'target', '_blank')
|
||||
})
|
||||
|
||||
it('note anchor references render as anchor link', () => {
|
||||
cy.codemirrorFill('<a href="#anchor">anchor</a>')
|
||||
cy.getMarkdownBody()
|
||||
.find('a')
|
||||
.should('have.attr', 'href', 'http://127.0.0.1:3001/n/test#anchor')
|
||||
})
|
||||
|
||||
it('internal pages render as internal link', () => {
|
||||
cy.codemirrorFill('<a href="other-note">internal</a>')
|
||||
cy.getMarkdownBody()
|
||||
.find('a')
|
||||
.should('have.attr', 'href', 'http://127.0.0.1:3001/n/other-note')
|
||||
})
|
||||
|
||||
it('data URIs do not render', () => {
|
||||
cy.codemirrorFill('<a href="data:text/plain,evil">data</a>')
|
||||
cy.getMarkdownBody()
|
||||
.find('a')
|
||||
.should('not.exist')
|
||||
})
|
||||
|
||||
it('javascript URIs do not render', () => {
|
||||
cy.codemirrorFill('<a href="javascript:alert(\'evil\')">js</a>')
|
||||
cy.getMarkdownBody()
|
||||
.find('a')
|
||||
.should('not.exist')
|
||||
})
|
||||
})
|
Loading…
Add table
Add a link
Reference in a new issue