2024-06-20 15:11:38 +05:30
|
|
|
import { renderGraph, verifyScreenshot } from '../../helpers/util.ts';
|
2019-11-20 19:06:46 +01:00
|
|
|
describe('Configuration', () => {
|
|
|
|
describe('arrowMarkerAbsolute', () => {
|
|
|
|
it('should handle default value false of arrowMarkerAbsolute', () => {
|
|
|
|
renderGraph(
|
|
|
|
`graph 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]
|
|
|
|
`,
|
2021-11-18 19:17:00 +01:00
|
|
|
{}
|
2019-11-20 19:06:46 +01:00
|
|
|
);
|
|
|
|
|
|
|
|
// Check the marker-end property to make sure it is properly set to
|
|
|
|
// start with #
|
2022-09-14 01:50:11 +01:00
|
|
|
cy.get('.edgePaths').within(() => {
|
|
|
|
cy.get('path')
|
|
|
|
.first()
|
|
|
|
.should('have.attr', 'marker-end')
|
|
|
|
.should('exist')
|
|
|
|
.and('include', 'url(#');
|
|
|
|
});
|
2019-11-20 19:06:46 +01:00
|
|
|
});
|
|
|
|
it('should handle default value false of arrowMarkerAbsolute', () => {
|
|
|
|
renderGraph(
|
|
|
|
`graph 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]
|
|
|
|
`,
|
2021-11-18 19:17:00 +01:00
|
|
|
{}
|
2019-11-20 19:06:46 +01:00
|
|
|
);
|
|
|
|
|
|
|
|
// Check the marker-end property to make sure it is properly set to
|
|
|
|
// start with #
|
2022-09-14 01:50:11 +01:00
|
|
|
cy.get('.edgePaths').within(() => {
|
|
|
|
cy.get('path')
|
|
|
|
.first()
|
|
|
|
.should('have.attr', 'marker-end')
|
|
|
|
.should('exist')
|
|
|
|
.and('include', 'url(#');
|
|
|
|
});
|
2019-11-20 19:06:46 +01:00
|
|
|
});
|
2022-06-27 12:29:50 +09:00
|
|
|
it('should handle arrowMarkerAbsolute explicitly set to false', () => {
|
2019-11-20 19:06:46 +01:00
|
|
|
renderGraph(
|
|
|
|
`graph 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]
|
|
|
|
`,
|
|
|
|
{
|
2021-11-18 19:17:00 +01:00
|
|
|
arrowMarkerAbsolute: false,
|
2019-11-20 19:06:46 +01:00
|
|
|
}
|
|
|
|
);
|
|
|
|
|
|
|
|
// Check the marker-end property to make sure it is properly set to
|
|
|
|
// start with #
|
2022-09-14 01:50:11 +01:00
|
|
|
cy.get('.edgePaths').within(() => {
|
|
|
|
cy.get('path')
|
|
|
|
.first()
|
|
|
|
.should('have.attr', 'marker-end')
|
|
|
|
.should('exist')
|
|
|
|
.and('include', 'url(#');
|
|
|
|
});
|
2019-11-20 19:06:46 +01:00
|
|
|
});
|
2022-06-27 12:29:50 +09:00
|
|
|
it('should handle arrowMarkerAbsolute explicitly set to "false" as false', () => {
|
2019-11-20 19:06:46 +01:00
|
|
|
renderGraph(
|
|
|
|
`graph 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]
|
|
|
|
`,
|
|
|
|
{
|
2021-11-18 19:17:00 +01:00
|
|
|
arrowMarkerAbsolute: 'false',
|
2019-11-20 19:06:46 +01:00
|
|
|
}
|
|
|
|
);
|
|
|
|
|
|
|
|
// Check the marker-end property to make sure it is properly set to
|
|
|
|
// start with #
|
2022-09-14 01:50:11 +01:00
|
|
|
cy.get('.edgePaths').within(() => {
|
|
|
|
cy.get('path')
|
|
|
|
.first()
|
|
|
|
.should('have.attr', 'marker-end')
|
|
|
|
.should('exist')
|
|
|
|
.and('include', 'url(#');
|
|
|
|
});
|
2019-11-20 19:06:46 +01:00
|
|
|
});
|
|
|
|
it('should handle arrowMarkerAbsolute set to true', () => {
|
|
|
|
renderGraph(
|
2022-09-14 02:12:08 +01:00
|
|
|
`flowchart TD
|
2019-11-20 19:06:46 +01:00
|
|
|
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]
|
|
|
|
`,
|
|
|
|
{
|
2021-11-18 19:17:00 +01:00
|
|
|
arrowMarkerAbsolute: true,
|
2019-11-20 19:06:46 +01:00
|
|
|
}
|
|
|
|
);
|
|
|
|
|
2022-09-14 01:50:11 +01:00
|
|
|
cy.get('.edgePaths').within(() => {
|
|
|
|
cy.get('path')
|
|
|
|
.first()
|
|
|
|
.should('have.attr', 'marker-end')
|
|
|
|
.should('exist')
|
|
|
|
.and('include', 'url(http://localhost');
|
|
|
|
});
|
2019-11-20 19:06:46 +01:00
|
|
|
});
|
2021-01-28 07:52:17 +01:00
|
|
|
it('should not taint the initial configuration when using multiple directives', () => {
|
|
|
|
const url = 'http://localhost:9000/regression/issue-1874.html';
|
|
|
|
cy.visit(url);
|
2024-03-23 15:57:29 +05:30
|
|
|
cy.window().should('have.property', 'rendered', true);
|
2024-06-20 15:11:38 +05:30
|
|
|
verifyScreenshot(
|
2022-04-28 18:26:50 +02:00
|
|
|
'configuration.spec-should-not-taint-initial-configuration-when-using-multiple-directives'
|
|
|
|
);
|
2021-01-28 07:52:17 +01:00
|
|
|
});
|
2019-11-20 19:06:46 +01:00
|
|
|
});
|
2023-09-06 13:09:06 +05:30
|
|
|
|
2023-09-06 13:15:04 +05:30
|
|
|
describe('suppressErrorRendering', () => {
|
2023-09-16 13:54:43 +05:30
|
|
|
beforeEach(() => {
|
|
|
|
cy.on('uncaught:exception', (err, runnable) => {
|
|
|
|
return !err.message.includes('Parse error on line');
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2023-09-06 13:15:04 +05:30
|
|
|
it('should not render error diagram if suppressErrorRendering is set', () => {
|
|
|
|
const url = 'http://localhost:9000/suppressError.html?suppressErrorRendering=true';
|
|
|
|
cy.visit(url);
|
2023-09-16 13:33:28 +05:30
|
|
|
cy.window().should('have.property', 'rendered', true);
|
|
|
|
cy.get('#test')
|
|
|
|
.find('svg')
|
|
|
|
.should(($svg) => {
|
2023-09-16 13:54:43 +05:30
|
|
|
// all failing diagrams should not appear!
|
|
|
|
expect($svg).to.have.length(2);
|
|
|
|
// none of the diagrams should be error diagrams
|
|
|
|
expect($svg).to.not.contain('Syntax error');
|
2023-09-16 13:33:28 +05:30
|
|
|
});
|
2024-06-20 15:11:38 +05:30
|
|
|
verifyScreenshot(
|
2023-09-06 13:15:04 +05:30
|
|
|
'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.visit(url);
|
2023-09-16 13:33:28 +05:30
|
|
|
cy.window().should('have.property', 'rendered', true);
|
2023-09-16 13:54:43 +05:30
|
|
|
cy.get('#test')
|
|
|
|
.find('svg')
|
|
|
|
.should(($svg) => {
|
|
|
|
// all five diagrams should be rendered
|
|
|
|
expect($svg).to.have.length(5);
|
|
|
|
// some of the diagrams should be error diagrams
|
|
|
|
expect($svg).to.contain('Syntax error');
|
|
|
|
});
|
2024-06-20 15:11:38 +05:30
|
|
|
verifyScreenshot(
|
2023-09-06 13:15:04 +05:30
|
|
|
'configuration.spec-should-render-error-diagram-if-suppressErrorRendering-is-not-set'
|
|
|
|
);
|
|
|
|
});
|
2023-09-06 13:09:06 +05:30
|
|
|
});
|
2019-11-20 19:06:46 +01:00
|
|
|
});
|