mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-08-15 22:39:26 +02:00
Added changeset.
This commit is contained in:
5
.changeset/witty-crews-smell.md
Normal file
5
.changeset/witty-crews-smell.md
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'mermaid': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
`mermaidAPI.getDiagramFromText()` now returns a new different db for each state diagram
|
@@ -30,12 +30,15 @@ export class StateDb {
|
|||||||
#START_TYPE = 'start';
|
#START_TYPE = 'start';
|
||||||
#END_NODE = this.#START_NODE;
|
#END_NODE = this.#START_NODE;
|
||||||
#END_TYPE = 'end';
|
#END_TYPE = 'end';
|
||||||
|
|
||||||
#COLOR_KEYWORD = 'color';
|
#COLOR_KEYWORD = 'color';
|
||||||
#FILL_KEYWORD = 'fill';
|
#FILL_KEYWORD = 'fill';
|
||||||
#BG_FILL = 'bgFill';
|
#BG_FILL = 'bgFill';
|
||||||
#STYLECLASS_SEP = ',';
|
#STYLECLASS_SEP = ',';
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
this.clear();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a new list of classes.
|
* Returns a new list of classes.
|
||||||
* In the future, this can be replaced with a class common to all diagrams.
|
* In the future, this can be replaced with a class common to all diagrams.
|
||||||
@@ -54,10 +57,6 @@ export class StateDb {
|
|||||||
#rootDoc = [];
|
#rootDoc = [];
|
||||||
#classes = this.#newClassesList(); // style classes defined by a classDef
|
#classes = this.#newClassesList(); // style classes defined by a classDef
|
||||||
|
|
||||||
constructor() {
|
|
||||||
this.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
// --------------------------------------
|
// --------------------------------------
|
||||||
|
|
||||||
#newDoc = () => {
|
#newDoc = () => {
|
||||||
|
@@ -848,6 +848,7 @@ graph TD;A--x|text including URL space|B;`)
|
|||||||
);
|
);
|
||||||
const classDiagram2 = await mermaidAPI.getDiagramFromText(
|
const classDiagram2 = await mermaidAPI.getDiagramFromText(
|
||||||
`stateDiagram
|
`stateDiagram
|
||||||
|
direction TB
|
||||||
[*] --> Still
|
[*] --> Still
|
||||||
Still --> [*]
|
Still --> [*]
|
||||||
Still --> Moving
|
Still --> Moving
|
||||||
@@ -858,7 +859,7 @@ graph TD;A--x|text including URL space|B;`)
|
|||||||
expect(classDiagram1.db).not.toBe(classDiagram2.db);
|
expect(classDiagram1.db).not.toBe(classDiagram2.db);
|
||||||
assert(classDiagram1.db instanceof StateDb);
|
assert(classDiagram1.db instanceof StateDb);
|
||||||
assert(classDiagram2.db instanceof StateDb);
|
assert(classDiagram2.db instanceof StateDb);
|
||||||
expect(classDiagram2.db.getDirection()).not.toEqual(classDiagram2.db.getDirection());
|
expect(classDiagram1.db.getDirection()).not.toEqual(classDiagram2.db.getDirection());
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user