2023-07-07 17:21:18 +05:30
|
|
|
import { imgSnapshotTest } from '../../helpers/util.ts';
|
2020-07-29 18:38:59 +02:00
|
|
|
|
|
|
|
describe('Configuration and directives - nodes should be light blue', () => {
|
2021-11-18 19:17:00 +01:00
|
|
|
it('No config - use default', () => {
|
|
|
|
imgSnapshotTest(
|
|
|
|
`
|
2020-07-29 18:38:59 +02:00
|
|
|
graph TD
|
|
|
|
A(Default) --> B[/Another/]
|
|
|
|
A --> C[End]
|
|
|
|
subgraph section
|
|
|
|
B
|
|
|
|
C
|
|
|
|
end
|
|
|
|
`,
|
2021-11-18 19:17:00 +01:00
|
|
|
{}
|
|
|
|
);
|
|
|
|
cy.get('svg');
|
|
|
|
});
|
2022-06-27 12:29:50 +09:00
|
|
|
it('Settings from initialize - nodes should be green', () => {
|
2021-11-18 19:17:00 +01:00
|
|
|
imgSnapshotTest(
|
|
|
|
`
|
2020-07-29 18:38:59 +02:00
|
|
|
graph TD
|
|
|
|
A(Forest) --> B[/Another/]
|
|
|
|
A --> C[End]
|
|
|
|
subgraph section
|
|
|
|
B
|
|
|
|
C
|
|
|
|
end `,
|
2021-11-18 19:17:00 +01:00
|
|
|
{ theme: 'forest' }
|
|
|
|
);
|
|
|
|
cy.get('svg');
|
|
|
|
});
|
2022-06-27 12:29:50 +09:00
|
|
|
it('Settings from initialize overriding themeVariable - nodes should be red', () => {
|
2021-11-18 19:17:00 +01:00
|
|
|
imgSnapshotTest(
|
|
|
|
`
|
2020-07-29 18:38:59 +02:00
|
|
|
|
|
|
|
|
|
|
|
%%{init: { 'theme': 'base', 'themeVariables':{ 'primaryColor': '#ff0000'}}}%%
|
|
|
|
graph TD
|
|
|
|
A(Start) --> B[/Another/]
|
|
|
|
A[/Another/] --> C[End]
|
|
|
|
subgraph section
|
|
|
|
B
|
|
|
|
C
|
|
|
|
end
|
|
|
|
`,
|
2021-11-18 19:17:00 +01:00
|
|
|
{ theme: 'base', themeVariables: { primaryColor: '#ff0000' }, logLevel: 0 }
|
|
|
|
);
|
|
|
|
cy.get('svg');
|
|
|
|
});
|
|
|
|
it('Settings from directive - nodes should be grey', () => {
|
|
|
|
imgSnapshotTest(
|
|
|
|
`
|
2020-07-29 18:38:59 +02:00
|
|
|
%%{init: { 'logLevel': 0, 'theme': 'neutral'} }%%
|
|
|
|
graph TD
|
|
|
|
A(Start) --> B[/Another/]
|
|
|
|
A[/Another/] --> C[End]
|
|
|
|
subgraph section
|
|
|
|
B
|
|
|
|
C
|
|
|
|
end
|
|
|
|
`,
|
2021-11-18 19:17:00 +01:00
|
|
|
{}
|
|
|
|
);
|
|
|
|
cy.get('svg');
|
|
|
|
});
|
2020-07-29 18:38:59 +02:00
|
|
|
|
2021-11-18 19:17:00 +01:00
|
|
|
it('Settings from directive overriding theme variable - nodes should be red', () => {
|
|
|
|
imgSnapshotTest(
|
|
|
|
`
|
2020-07-29 18:38:59 +02:00
|
|
|
%%{init: {'theme': 'base', 'themeVariables':{ 'primaryColor': '#ff0000'}}}%%
|
|
|
|
graph TD
|
|
|
|
A(Start) --> B[/Another/]
|
|
|
|
A[/Another/] --> C[End]
|
|
|
|
subgraph section
|
|
|
|
B
|
|
|
|
C
|
|
|
|
end
|
|
|
|
`,
|
2021-11-18 19:17:00 +01:00
|
|
|
{}
|
|
|
|
);
|
|
|
|
cy.get('svg');
|
2020-07-29 18:38:59 +02:00
|
|
|
});
|
2021-11-18 19:17:00 +01:00
|
|
|
it('Settings from initialize and directive - nodes should be grey', () => {
|
|
|
|
imgSnapshotTest(
|
|
|
|
`
|
2020-07-29 18:38:59 +02:00
|
|
|
%%{init: { 'logLevel': 0, 'theme': 'neutral'} }%%
|
|
|
|
graph TD
|
|
|
|
A(Start) --> B[/Another/]
|
|
|
|
A[/Another/] --> C[End]
|
|
|
|
subgraph section
|
|
|
|
B
|
|
|
|
C
|
|
|
|
end
|
|
|
|
`,
|
2021-11-18 19:17:00 +01:00
|
|
|
{ theme: 'forest' }
|
|
|
|
);
|
|
|
|
cy.get('svg');
|
|
|
|
});
|
|
|
|
it('Theme from initialize, directive overriding theme variable - nodes should be red', () => {
|
|
|
|
imgSnapshotTest(
|
|
|
|
`
|
2020-07-29 18:38:59 +02:00
|
|
|
%%{init: {'theme': 'base', 'themeVariables':{ 'primaryColor': '#ff0000'}}}%%
|
|
|
|
graph TD
|
|
|
|
A(Start) --> B[/Another/]
|
|
|
|
A[/Another/] --> C[End]
|
|
|
|
subgraph section
|
|
|
|
B
|
|
|
|
C
|
|
|
|
end
|
|
|
|
`,
|
2021-11-18 19:17:00 +01:00
|
|
|
{ theme: 'base' }
|
|
|
|
);
|
|
|
|
cy.get('svg');
|
|
|
|
});
|
|
|
|
it('Theme variable from initialize, theme from directive - nodes should be red', () => {
|
|
|
|
imgSnapshotTest(
|
|
|
|
`
|
2020-07-29 18:38:59 +02:00
|
|
|
%%{init: { 'logLevel': 0, 'theme': 'base'} }%%
|
|
|
|
graph TD
|
|
|
|
A(Start) --> B[/Another/]
|
|
|
|
A[/Another/] --> C[End]
|
|
|
|
subgraph section
|
|
|
|
B
|
|
|
|
C
|
|
|
|
end
|
|
|
|
`,
|
2021-11-18 19:17:00 +01:00
|
|
|
{ themeVariables: { primaryColor: '#ff0000' } }
|
|
|
|
);
|
|
|
|
cy.get('svg');
|
|
|
|
});
|
|
|
|
describe('when rendering several diagrams', () => {
|
|
|
|
it('diagrams should not taint later diagrams', () => {
|
|
|
|
const url = 'http://localhost:9000/theme-directives.html';
|
|
|
|
cy.visit(url);
|
2020-07-29 18:38:59 +02:00
|
|
|
cy.get('svg');
|
2022-03-31 19:14:37 +02:00
|
|
|
cy.matchImageSnapshot('conf-and-directives.spec-when-rendering-several-diagrams-diagram-1');
|
2020-07-29 18:38:59 +02:00
|
|
|
});
|
|
|
|
});
|
2021-11-18 19:17:00 +01:00
|
|
|
});
|