Cleared sankey renderer

This commit is contained in:
Nikolay Rozhkov
2023-06-18 01:32:45 +03:00
parent 6b40b394c8
commit 8e001b92f2
6 changed files with 61 additions and 1455 deletions

View 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');
});
});

View File

@@ -28,7 +28,7 @@ Interviewed,Declined Offer,2
Interviewed,Accepted Offer,1,orange
```
GoJS uses similar approach
GoJS uses similar approach:
```json
{
"nodeDataArray": [

View 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);
});
});
});

View File

@@ -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);
});
});
});

View File

@@ -11,3 +11,4 @@ export const diagram: DiagramDefinition = {
renderer,
styles,
};

File diff suppressed because it is too large Load Diff