mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-08-15 06:19:24 +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';
|
||||
#END_NODE = this.#START_NODE;
|
||||
#END_TYPE = 'end';
|
||||
|
||||
#COLOR_KEYWORD = 'color';
|
||||
#FILL_KEYWORD = 'fill';
|
||||
#BG_FILL = 'bgFill';
|
||||
#STYLECLASS_SEP = ',';
|
||||
|
||||
constructor() {
|
||||
this.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a new list of classes.
|
||||
* In the future, this can be replaced with a class common to all diagrams.
|
||||
@@ -54,10 +57,6 @@ export class StateDb {
|
||||
#rootDoc = [];
|
||||
#classes = this.#newClassesList(); // style classes defined by a classDef
|
||||
|
||||
constructor() {
|
||||
this.clear();
|
||||
}
|
||||
|
||||
// --------------------------------------
|
||||
|
||||
#newDoc = () => {
|
||||
|
@@ -848,6 +848,7 @@ graph TD;A--x|text including URL space|B;`)
|
||||
);
|
||||
const classDiagram2 = await mermaidAPI.getDiagramFromText(
|
||||
`stateDiagram
|
||||
direction TB
|
||||
[*] --> Still
|
||||
Still --> [*]
|
||||
Still --> Moving
|
||||
@@ -858,7 +859,7 @@ graph TD;A--x|text including URL space|B;`)
|
||||
expect(classDiagram1.db).not.toBe(classDiagram2.db);
|
||||
assert(classDiagram1.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