hedgedoc/cypress/integration/shortcodes.spec.ts
Tilman Vatteroth e9defd60dc
Restructure click shield (#1611)
* Rename one-click-embedding to click shield
* Removes the static fallback image from the vimeo frame. The set URL is broken.
* Adds the ability to define background colors for the click shield background


Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
2021-11-14 18:44:55 +01:00

46 lines
1.3 KiB
TypeScript

/*
* SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
describe('Short code gets replaced or rendered: ', () => {
beforeEach(() => {
cy.visitTestEditor()
})
describe('pdf', () => {
it('renders a plain link', () => {
cy.setCodemirrorContent(`{%pdf https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf %}`)
cy.getMarkdownBody()
.find('a')
.should('have.attr', 'href', 'https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf')
})
})
describe('slideshare', () => {
it('renders a plain link', () => {
cy.setCodemirrorContent(`{%slideshare example/123456789 %}`)
cy.getMarkdownBody()
.find('a')
.should('have.attr', 'href', 'https://www.slideshare.net/example/123456789')
})
})
describe('speakerdeck', () => {
it('renders a plain link', () => {
cy.setCodemirrorContent(`{%speakerdeck example/123456789 %}`)
cy.getMarkdownBody()
.find('a')
.should('have.attr', 'href', 'https://speakerdeck.com/example/123456789')
})
})
describe('youtube', () => {
it('renders click-shield', () => {
cy.setCodemirrorContent(`{%youtube YE7VzlLtp-4 %}`)
cy.getMarkdownBody()
.find('[data-cypress-id="click-shield-youtube"]')
})
})
})