mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-11-15 10:14:21 +01:00
chore:add e2e test
on-behalf-of: @Mermaid-Chart <hello@mermaidchart.com>
This commit is contained in:
@@ -97,10 +97,18 @@ export const openURLAndVerifyRendering = (
|
|||||||
|
|
||||||
cy.visit(url);
|
cy.visit(url);
|
||||||
cy.window().should('have.property', 'rendered', true);
|
cy.window().should('have.property', 'rendered', true);
|
||||||
cy.get('svg').should('be.visible');
|
|
||||||
|
|
||||||
if (validation) {
|
// Handle sandbox mode where SVG is inside an iframe
|
||||||
cy.get('svg').should(validation);
|
if (options.securityLevel === 'sandbox') {
|
||||||
|
cy.get('iframe').should('be.visible');
|
||||||
|
if (validation) {
|
||||||
|
cy.get('iframe').should(validation);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
cy.get('svg').should('be.visible');
|
||||||
|
if (validation) {
|
||||||
|
cy.get('svg').should(validation);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
verifyScreenshot(name);
|
verifyScreenshot(name);
|
||||||
|
|||||||
@@ -79,6 +79,18 @@ describe('Flowchart v2', () => {
|
|||||||
{ htmlLabels: true, flowchart: { htmlLabels: true }, securityLevel: 'loose' }
|
{ htmlLabels: true, flowchart: { htmlLabels: true }, securityLevel: 'loose' }
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
it('6a: should render complex HTML in labels with sandbox security', () => {
|
||||||
|
imgSnapshotTest(
|
||||||
|
`flowchart TD
|
||||||
|
A[Christmas] -->|Get money| B(Go shopping)
|
||||||
|
B --> C{Let me think}
|
||||||
|
C -->|One| D[Laptop]
|
||||||
|
C -->|Two| E[iPhone]
|
||||||
|
C -->|Three| F[fa:fa-car Car]
|
||||||
|
`,
|
||||||
|
{ securityLevel: 'sandbox', flowchart: { htmlLabels: true } }
|
||||||
|
);
|
||||||
|
});
|
||||||
it('7: should render a flowchart when useMaxWidth is true (default)', () => {
|
it('7: should render a flowchart when useMaxWidth is true (default)', () => {
|
||||||
renderGraph(
|
renderGraph(
|
||||||
`flowchart TD
|
`flowchart TD
|
||||||
|
|||||||
Reference in New Issue
Block a user