mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-15 05:19:58 +02:00
Add test
This commit is contained in:
@@ -127,8 +127,9 @@ describe('Configuration', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('suppressErrorRendering', () => {
|
||||||
it('should not render error diagram if suppressErrorRendering is set', () => {
|
it('should not render error diagram if suppressErrorRendering is set', () => {
|
||||||
const url = 'http://localhost:9000/regression/issue-1874.html';
|
const url = 'http://localhost:9000/suppressError.html?suppressErrorRendering=true';
|
||||||
cy.viewport(1440, 1024);
|
cy.viewport(1440, 1024);
|
||||||
cy.visit(url);
|
cy.visit(url);
|
||||||
cy.get('#test');
|
cy.get('#test');
|
||||||
@@ -136,4 +137,15 @@ describe('Configuration', () => {
|
|||||||
'configuration.spec-should-not-render-error-diagram-if-suppressErrorRendering-is-set'
|
'configuration.spec-should-not-render-error-diagram-if-suppressErrorRendering-is-set'
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should render error diagram if suppressErrorRendering is not set', () => {
|
||||||
|
const url = 'http://localhost:9000/suppressError.html';
|
||||||
|
cy.viewport(1440, 1024);
|
||||||
|
cy.visit(url);
|
||||||
|
cy.get('#test');
|
||||||
|
cy.matchImageSnapshot(
|
||||||
|
'configuration.spec-should-render-error-diagram-if-suppressErrorRendering-is-not-set'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
@@ -20,13 +20,15 @@
|
|||||||
>
|
>
|
||||||
<pre class="mermaid">
|
<pre class="mermaid">
|
||||||
flowchart
|
flowchart
|
||||||
a[This should be visible, error diagram should not be visible above this]
|
a[This should be visible]
|
||||||
</pre
|
</pre
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
<script type="module">
|
<script type="module">
|
||||||
import mermaid from './mermaid.esm.mjs';
|
import mermaid from './mermaid.esm.mjs';
|
||||||
mermaid.initialize({ startOnLoad: true, suppressErrorRendering: true });
|
const shouldSuppress =
|
||||||
|
new URLSearchParams(window.location.search).get('suppressErrorRendering') === 'true';
|
||||||
|
mermaid.initialize({ startOnLoad: true, suppressErrorRendering: shouldSuppress });
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
Reference in New Issue
Block a user