mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-04 08:06:43 +02:00
Cleared sankey renderer
This commit is contained in:
14
cypress/integration/rendering/sankey.spec.js
Normal file
14
cypress/integration/rendering/sankey.spec.js
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
import { imgSnapshotTest, renderGraph } from '../../helpers/util.js';
|
||||||
|
|
||||||
|
describe('Sankey Diagram', () => {
|
||||||
|
it('should render a simple sankey diagram', () => {
|
||||||
|
imgSnapshotTest(
|
||||||
|
`
|
||||||
|
sankey
|
||||||
|
a -> 30 -> b
|
||||||
|
`,
|
||||||
|
{}
|
||||||
|
);
|
||||||
|
cy.get('svg');
|
||||||
|
});
|
||||||
|
});
|
@@ -28,7 +28,7 @@ Interviewed,Declined Offer,2
|
|||||||
Interviewed,Accepted Offer,1,orange
|
Interviewed,Accepted Offer,1,orange
|
||||||
```
|
```
|
||||||
|
|
||||||
GoJS uses similar approach
|
GoJS uses similar approach:
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"nodeDataArray": [
|
"nodeDataArray": [
|
||||||
|
44
packages/mermaid/src/diagrams/sankey/parser/sankey.spec.js
Normal file
44
packages/mermaid/src/diagrams/sankey/parser/sankey.spec.js
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
import diagram from './sankey.jison';
|
||||||
|
import { parser } from './sankey.jison';
|
||||||
|
import db from '../sankeyDB.js';
|
||||||
|
|
||||||
|
describe('Sankey diagram', function () {
|
||||||
|
// TODO - these examples should be put into ./parser/stateDiagram.spec.js
|
||||||
|
describe('when parsing an info graph it', function () {
|
||||||
|
beforeEach(function () {
|
||||||
|
parser.yy = db;
|
||||||
|
diagram.parser.yy = db;
|
||||||
|
diagram.parser.yy.clear();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('one simple flow', function () {
|
||||||
|
const str = `
|
||||||
|
sankey
|
||||||
|
a -> 30 -> b
|
||||||
|
`;
|
||||||
|
|
||||||
|
parser.parse(str);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('multiple flows', function () {
|
||||||
|
const str = `
|
||||||
|
sankey
|
||||||
|
a -> 30 -> b
|
||||||
|
c -> 30 -> d
|
||||||
|
c -> 40 -> e
|
||||||
|
`;
|
||||||
|
|
||||||
|
parser.parse(str);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('multiple flows', function () {
|
||||||
|
const str = `
|
||||||
|
sankey
|
||||||
|
a -> 30 -> b
|
||||||
|
c -> 30 -> d
|
||||||
|
`;
|
||||||
|
|
||||||
|
parser.parse(str);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
@@ -1,24 +0,0 @@
|
|||||||
import diagram from './parser/sankey.jison';
|
|
||||||
import { parser } from './parser/sankey.jison';
|
|
||||||
import db from './sankeyDB.js';
|
|
||||||
|
|
||||||
describe('state diagram V2, ', function () {
|
|
||||||
// TODO - these examples should be put into ./parser/stateDiagram.spec.js
|
|
||||||
describe('when parsing an info graph it', function () {
|
|
||||||
beforeEach(function () {
|
|
||||||
parser.yy = stateDb;
|
|
||||||
diagram.parser.yy = db;
|
|
||||||
diagram.parser.yy.clear();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('super simple', function () {
|
|
||||||
const str = `
|
|
||||||
stateDiagram-v2
|
|
||||||
[*] --> State1
|
|
||||||
State1 --> [*]
|
|
||||||
`;
|
|
||||||
|
|
||||||
parser.parse(str);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
@@ -11,3 +11,4 @@ export const diagram: DiagramDefinition = {
|
|||||||
renderer,
|
renderer,
|
||||||
styles,
|
styles,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user