2021-02-22 21:27:59 +00:00
|
|
|
/*
|
|
|
|
* SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
*/
|
|
|
|
|
|
|
|
describe('Diagram codeblock ', () => {
|
|
|
|
beforeEach(() => {
|
|
|
|
cy.visitTestEditor()
|
|
|
|
})
|
|
|
|
|
|
|
|
it('renders markmap', () => {
|
2021-10-04 10:50:39 +00:00
|
|
|
cy.setCodemirrorContent('```markmap\n- pro\n- contra\n```')
|
2021-02-22 21:27:59 +00:00
|
|
|
cy.getMarkdownBody()
|
2021-10-17 19:20:23 +00:00
|
|
|
.find('[data-cypress-id=markmap]')
|
2021-02-22 21:27:59 +00:00
|
|
|
.children()
|
|
|
|
.should('be.visible')
|
|
|
|
})
|
|
|
|
|
|
|
|
it('renders vega-lite', () => {
|
2021-10-04 10:50:39 +00:00
|
|
|
cy.setCodemirrorContent('```vega-lite\n{"$schema":"https://vega.github.io/schema/vega-lite/v4.json","data":{"values":[{"a":"","b":28}]},"mark":"bar","encoding":{"x":{"field":"a"},"y":{"field":"b"}}}\n```')
|
2021-02-22 21:27:59 +00:00
|
|
|
cy.getMarkdownBody()
|
|
|
|
.find('.vega-embed')
|
|
|
|
.children()
|
|
|
|
.should('be.visible')
|
|
|
|
})
|
|
|
|
|
|
|
|
it('renders graphviz', () => {
|
2021-10-04 10:50:39 +00:00
|
|
|
cy.setCodemirrorContent('```graphviz\ngraph {\na -- b\n}\n```')
|
2021-02-22 21:27:59 +00:00
|
|
|
cy.getMarkdownBody()
|
2021-10-17 19:20:23 +00:00
|
|
|
.find('[data-cypress-id=graphviz]')
|
2021-02-22 21:27:59 +00:00
|
|
|
.children()
|
|
|
|
.should('be.visible')
|
|
|
|
})
|
|
|
|
|
|
|
|
it('renders mermaid', () => {
|
2021-10-04 10:50:39 +00:00
|
|
|
cy.setCodemirrorContent('```mermaid\ngraph TD;\n A-->B;\n```')
|
2021-02-22 21:27:59 +00:00
|
|
|
cy.getMarkdownBody()
|
|
|
|
.find('.mermaid')
|
|
|
|
.children()
|
|
|
|
.should('be.visible')
|
|
|
|
})
|
|
|
|
|
|
|
|
it('renders flowcharts', () => {
|
2021-10-04 10:50:39 +00:00
|
|
|
cy.setCodemirrorContent('```flow\nst=>start: Start\ne=>end: End\nst->e\n```')
|
2021-02-22 21:27:59 +00:00
|
|
|
cy.getMarkdownBody()
|
2021-10-17 19:20:23 +00:00
|
|
|
.find('[data-cypress-id=flowchart]')
|
2021-02-22 21:27:59 +00:00
|
|
|
.children()
|
|
|
|
.should('be.visible')
|
|
|
|
})
|
|
|
|
|
|
|
|
it('renders abc scores', () => {
|
2021-10-04 10:50:39 +00:00
|
|
|
cy.setCodemirrorContent('```abc\nM:4/4\nK:G\n|:GABc dedB:|\n```')
|
2021-02-22 21:27:59 +00:00
|
|
|
cy.getMarkdownBody()
|
|
|
|
.find('.abcjs-score')
|
|
|
|
.children()
|
|
|
|
.should('be.visible')
|
|
|
|
})
|
|
|
|
|
|
|
|
it('renders csv as table', () => {
|
2021-10-04 10:50:39 +00:00
|
|
|
cy.setCodemirrorContent('```csv delimiter=; header\na;b;c;d\n1;2;3;4\n```')
|
2021-02-22 21:27:59 +00:00
|
|
|
cy.getMarkdownBody()
|
|
|
|
.find('.csv-html-table')
|
|
|
|
.should('be.visible')
|
|
|
|
})
|
|
|
|
|
|
|
|
it('renders plantuml', () => {
|
2021-10-04 10:50:39 +00:00
|
|
|
cy.setCodemirrorContent('```plantuml\nclass Example\n```')
|
2021-02-22 21:27:59 +00:00
|
|
|
cy.getMarkdownBody()
|
|
|
|
.find('img')
|
|
|
|
// PlantUML uses base64 encoded version of zip-deflated PlantUML code in the request URL.
|
|
|
|
.should('have.attr', 'src', 'http://mock-plantuml.local/svg/SoWkIImgAStDuKhEIImkLd2jICmjo4dbSaZDIm6A0W00')
|
|
|
|
})
|
|
|
|
})
|