mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-19 07:19:41 +02:00
+ spec stateRenderer-v2.js getClasses() to verify it returns a {}
This commit is contained in:

parent
d3f5474f38
commit
c6db0524bd
@@ -1,8 +1,24 @@
|
|||||||
import { parser } from './parser/stateDiagram';
|
import { parser } from './parser/stateDiagram';
|
||||||
import stateDb from './stateDb';
|
import stateDb from './stateDb';
|
||||||
import stateDiagram from './parser/stateDiagram.jison';
|
import stateDiagram from './parser/stateDiagram.jison';
|
||||||
|
import stateRendererV2 from './stateRenderer-v2';
|
||||||
|
|
||||||
|
// Can use this instead of having to register diagrams and load/orchestrate them, etc.
|
||||||
|
class FauxDiagramObj {
|
||||||
|
db = stateDb;
|
||||||
|
parser = parser;
|
||||||
|
renderer = stateRendererV2;
|
||||||
|
|
||||||
|
constructor(options = { db: stateDb, parser: parser, renderer: stateRendererV2 }) {
|
||||||
|
this.db = options.db;
|
||||||
|
this.parser = options.parser;
|
||||||
|
this.renderer = options.renderer;
|
||||||
|
this.parser.yy = this.db;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
describe('state diagram V2, ', function () {
|
describe('state diagram V2, ', function () {
|
||||||
|
// TODO - these examples should be put into ./parser/stateDiagram.spec.js
|
||||||
describe('when parsing an info graph it', function () {
|
describe('when parsing an info graph it', function () {
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
parser.yy = stateDb;
|
parser.yy = stateDb;
|
||||||
@@ -423,4 +439,16 @@ describe('state diagram V2, ', function () {
|
|||||||
expect(rel_Active_Active.relationTitle).toEqual('LOG');
|
expect(rel_Active_Active.relationTitle).toEqual('LOG');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('stateRenderer-v2', () => {
|
||||||
|
describe('getClasses', () => {
|
||||||
|
const diagramText = 'statediagram-v2\n';
|
||||||
|
const fauxStateDiagram = new FauxDiagramObj();
|
||||||
|
|
||||||
|
it('returns a {}', () => {
|
||||||
|
const result = stateRendererV2.getClasses(diagramText, fauxStateDiagram);
|
||||||
|
expectTypeOf(result).toBeObject();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user