mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-01-14 06:43:25 +08:00
fix: autonumber bug
This commit is contained in:
parent
3342f884ce
commit
4f5cab7f4c
@ -139,6 +139,7 @@ export const autoWrap = () => wrapEnabled;
|
|||||||
export const clear = function () {
|
export const clear = function () {
|
||||||
actors = {};
|
actors = {};
|
||||||
messages = [];
|
messages = [];
|
||||||
|
sequenceNumbersEnabled = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const parseMessage = function (str) {
|
export const parseMessage = function (str) {
|
||||||
|
@ -1619,4 +1619,24 @@ participant Alice
|
|||||||
models.lastActor().y + models.lastActor().height + mermaid.sequence.boxMargin
|
models.lastActor().y + models.lastActor().height + mermaid.sequence.boxMargin
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
it('it should hide sequence numbers when autonumber is removed when autonumber is enabled', function () {
|
||||||
|
const str1 = `
|
||||||
|
sequenceDiagram
|
||||||
|
autonumber
|
||||||
|
Alice->Bob:Hello Bob, how are you?
|
||||||
|
Note right of Bob: Bob thinks
|
||||||
|
Bob-->Alice: I am good thanks!`;
|
||||||
|
|
||||||
|
mermaidAPI.parse(str1);
|
||||||
|
expect(parser.yy.showSequenceNumbers()).toBe(true);
|
||||||
|
|
||||||
|
const str2 = `
|
||||||
|
sequenceDiagram
|
||||||
|
Alice->Bob:Hello Bob, how are you?
|
||||||
|
Note right of Bob: Bob thinks
|
||||||
|
Bob-->Alice: I am good thanks!`;
|
||||||
|
|
||||||
|
mermaidAPI.parse(str2);
|
||||||
|
expect(parser.yy.showSequenceNumbers()).toBe(false);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
1
src/mermaidAPI.js
Executable file → Normal file
1
src/mermaidAPI.js
Executable file → Normal file
@ -94,6 +94,7 @@ function parse(text) {
|
|||||||
parser.parser.yy = flowDb;
|
parser.parser.yy = flowDb;
|
||||||
break;
|
break;
|
||||||
case 'sequence':
|
case 'sequence':
|
||||||
|
sequenceDb.clear();
|
||||||
parser = sequenceParser;
|
parser = sequenceParser;
|
||||||
parser.parser.yy = sequenceDb;
|
parser.parser.yy = sequenceDb;
|
||||||
break;
|
break;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user