mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-06 09:06:45 +02:00
Renamed sankey to sankey-beta
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
import { imgSnapshotTest, renderGraph } from '../../helpers/util.js';
|
||||
|
||||
describe('Sankey Diagram', () => {
|
||||
it('should render a simple sankey diagram', () => {
|
||||
it('should render a simple example', () => {
|
||||
imgSnapshotTest(
|
||||
`
|
||||
sankey
|
||||
sankey-beta
|
||||
|
||||
a,b,10
|
||||
`,
|
||||
|
@@ -17,7 +17,7 @@
|
||||
<h1>Sankey diagram demos</h1>
|
||||
<h2>Energy flow</h2>
|
||||
<pre class="mermaid">
|
||||
sankey
|
||||
sankey-beta
|
||||
|
||||
Agricultural 'waste',Bio-conversion,124.729
|
||||
Bio-conversion,Liquid,0.597
|
||||
|
@@ -24,7 +24,7 @@ NUM \d+(.\d+)?
|
||||
//--------------
|
||||
|
||||
(<<EOF>>|[\n;])+ { return 'EOS'; } // end of statement is semicolon ; new line \n or end of file
|
||||
"sankey" { return 'SANKEY'; }
|
||||
"sankey-beta" { return 'SANKEY'; }
|
||||
<INITIAL>{TOKEN} { return 'NODE_ID'; }
|
||||
<link_value>{NUM} { return 'AMOUNT'; }
|
||||
"->" {
|
||||
|
@@ -3,7 +3,7 @@ import { parser } from './sankey-arrow.jison';
|
||||
import db from '../sankeyDB.js';
|
||||
// import { fail } from 'assert';
|
||||
|
||||
describe('Sankey diagram', function () {
|
||||
describe('sankey-beta diagram', function () {
|
||||
// TODO - these examples should be put into ./parser/stateDiagram.spec.js
|
||||
describe('when parsing an info graph it', function () {
|
||||
beforeEach(function () {
|
||||
@@ -13,14 +13,14 @@ describe('Sankey diagram', function () {
|
||||
});
|
||||
|
||||
it('recognizes its type', () => {
|
||||
const str = `sankey`;
|
||||
const str = `sankey-beta`;
|
||||
|
||||
parser.parse(str);
|
||||
});
|
||||
|
||||
it('recognizes one flow', () => {
|
||||
const str = `
|
||||
sankey
|
||||
sankey-beta
|
||||
node_a -> 30 -> node_b -> 20 -> node_c
|
||||
`;
|
||||
|
||||
@@ -29,7 +29,7 @@ describe('Sankey diagram', function () {
|
||||
|
||||
it('recognizes multiple flows', () => {
|
||||
const str = `
|
||||
sankey
|
||||
sankey-beta
|
||||
node_a -> 30 -> node_b -> 12 -> node_e
|
||||
node_c -> 30 -> node_d -> 12 -> node_e
|
||||
node_c -> 40 -> node_e -> 12 -> node_q
|
||||
@@ -40,7 +40,7 @@ describe('Sankey diagram', function () {
|
||||
|
||||
it('parses node as a string', () => {
|
||||
const str = `
|
||||
sankey
|
||||
sankey-beta
|
||||
"node a" -> 30 -> "node b" -> 12 -> "node e"
|
||||
"node c" -> 30 -> "node d" -> 12 -> "node e"
|
||||
"node c" -> 40 -> "node e" -> 12 -> "node q"
|
||||
@@ -52,7 +52,7 @@ describe('Sankey diagram', function () {
|
||||
describe('while attributes parsing', () => {
|
||||
it('recognized node and attribute ids starting with numbers', () => {
|
||||
const str = `
|
||||
sankey
|
||||
sankey-beta
|
||||
1st -> 200 -> 2nd -> 180 -> 3rd;
|
||||
`;
|
||||
|
||||
@@ -61,7 +61,7 @@ describe('Sankey diagram', function () {
|
||||
|
||||
it('parses different quotless variations', () => {
|
||||
const str = `
|
||||
sankey
|
||||
sankey-beta
|
||||
node[]
|
||||
|
||||
node[attr=1]
|
||||
@@ -77,9 +77,9 @@ describe('Sankey diagram', function () {
|
||||
|
||||
it('parses strings as values', () => {
|
||||
const str = `
|
||||
sankey
|
||||
sankey-beta
|
||||
node[title="hello, how are you?"]
|
||||
node[title="hello, mister \\"sankey\\", backslash for you \\\\"]
|
||||
node[title="hello, mister \\"sankey-beta\\", backslash for you \\\\"]
|
||||
`;
|
||||
|
||||
parser.parse(str);
|
||||
@@ -87,7 +87,7 @@ describe('Sankey diagram', function () {
|
||||
|
||||
it('parses real example', () => {
|
||||
const str = `
|
||||
sankey
|
||||
sankey-beta
|
||||
|
||||
"Agricultural 'waste'" -> 124.729 -> "Bio-conversion"
|
||||
"Bio-conversion" -> 0.597 -> "Liquid"
|
||||
|
@@ -27,7 +27,7 @@ TEXTDATA [\u0020-\u0021\u0023-\u002B\u002D-\u007E]
|
||||
|
||||
%%
|
||||
|
||||
<INITIAL>"sankey" { this.pushState('csv'); return 'SANKEY'; }
|
||||
<INITIAL>"sankey-beta" { this.pushState('csv'); return 'SANKEY'; }
|
||||
<INITIAL,csv><<EOF>> { return 'EOF' } // match end of file
|
||||
<INITIAL,csv>({CRLF}|{LF}) { return 'NEWLINE' }
|
||||
<INITIAL,csv>{COMMA} { return 'COMMA' }
|
||||
|
@@ -19,7 +19,7 @@ describe('Sankey diagram', function () {
|
||||
const path = await import('path');
|
||||
const csv = path.resolve(__dirname, './energy.csv');
|
||||
const data = fs.readFileSync(csv, 'utf8');
|
||||
const graphDefinition = prepareTextForParsing(cleanupComments('sankey\n\n ' + data));
|
||||
const graphDefinition = prepareTextForParsing(cleanupComments('sankey-beta\n\n ' + data));
|
||||
|
||||
parser.parse(graphDefinition);
|
||||
});
|
||||
|
@@ -3,7 +3,7 @@ import type { DiagramDetector, ExternalDiagramDefinition } from '../../diagram-a
|
||||
const id = 'sankey';
|
||||
|
||||
const detector: DiagramDetector = (txt) => {
|
||||
return txt.match(/^\s*sankey/) !== null;
|
||||
return txt.match(/^\s*sankey-beta/) !== null;
|
||||
};
|
||||
|
||||
const loader = async () => {
|
||||
|
Reference in New Issue
Block a user