2021-02-22 16:27:59 -05:00
|
|
|
/*
|
|
|
|
* SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
*/
|
|
|
|
|
|
|
|
describe('Diagram codeblock ', () => {
|
|
|
|
beforeEach(() => {
|
2022-01-30 15:46:43 -05:00
|
|
|
cy.visitTestNote()
|
2021-02-22 16:27:59 -05:00
|
|
|
})
|
|
|
|
|
2021-12-25 10:44:24 -05:00
|
|
|
/*
|
|
|
|
TODO: Readd test after fixing https://github.com/hedgedoc/react-client/issues/1709
|
|
|
|
|
|
|
|
it('renders markmap', () => {
|
|
|
|
cy.setCodemirrorContent('```markmap\n- pro\n- contra\n```')
|
|
|
|
cy.getMarkdownBody().findByCypressId('markmap').children().should('be.visible')
|
|
|
|
})
|
|
|
|
*/
|
2021-02-22 16:27:59 -05:00
|
|
|
|
|
|
|
it('renders vega-lite', () => {
|
2021-11-19 12:04:04 -05: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```'
|
|
|
|
)
|
|
|
|
cy.getMarkdownBody().find('.vega-embed').children().should('be.visible')
|
2021-02-22 16:27:59 -05:00
|
|
|
})
|
|
|
|
|
|
|
|
it('renders graphviz', () => {
|
2021-10-04 06:50:39 -04:00
|
|
|
cy.setCodemirrorContent('```graphviz\ngraph {\na -- b\n}\n```')
|
2021-12-25 10:44:24 -05:00
|
|
|
cy.getMarkdownBody().findByCypressId('graphviz').children().should('be.visible')
|
2021-02-22 16:27:59 -05:00
|
|
|
})
|
|
|
|
|
|
|
|
it('renders mermaid', () => {
|
2021-10-04 06:50:39 -04:00
|
|
|
cy.setCodemirrorContent('```mermaid\ngraph TD;\n A-->B;\n```')
|
2021-12-25 10:44:24 -05:00
|
|
|
cy.getMarkdownBody().findByCypressId('mermaid-frame').children().should('be.visible')
|
2021-02-22 16:27:59 -05:00
|
|
|
})
|
|
|
|
|
|
|
|
it('renders flowcharts', () => {
|
2021-10-04 06:50:39 -04:00
|
|
|
cy.setCodemirrorContent('```flow\nst=>start: Start\ne=>end: End\nst->e\n```')
|
2021-12-25 10:44:24 -05:00
|
|
|
cy.getMarkdownBody().findByCypressId('flowchart').children().should('be.visible')
|
2021-02-22 16:27:59 -05:00
|
|
|
})
|
|
|
|
|
|
|
|
it('renders abc scores', () => {
|
2021-10-04 06:50:39 -04:00
|
|
|
cy.setCodemirrorContent('```abc\nM:4/4\nK:G\n|:GABc dedB:|\n```')
|
2021-12-25 10:44:24 -05:00
|
|
|
cy.getMarkdownBody().findByCypressId('abcjs').children().should('be.visible')
|
2021-02-22 16:27:59 -05:00
|
|
|
})
|
|
|
|
|
|
|
|
it('renders csv as table', () => {
|
2021-10-04 06:50:39 -04:00
|
|
|
cy.setCodemirrorContent('```csv delimiter=; header\na;b;c;d\n1;2;3;4\n```')
|
2021-12-25 10:44:24 -05:00
|
|
|
cy.getMarkdownBody().findByCypressId('csv-html-table').first().should('be.visible')
|
2021-02-22 16:27:59 -05:00
|
|
|
})
|
|
|
|
|
|
|
|
it('renders plantuml', () => {
|
2021-10-04 06:50:39 -04:00
|
|
|
cy.setCodemirrorContent('```plantuml\nclass Example\n```')
|
2021-02-22 16:27:59 -05: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')
|
|
|
|
})
|
|
|
|
})
|