mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-22 08:50:13 +02:00
Merge branch 'mermaid-js-develop' into develop
This commit is contained in:
@@ -10,6 +10,7 @@ function addConf(conf, key, value) {
|
||||
}
|
||||
return conf;
|
||||
}
|
||||
|
||||
describe('when parsing a sequenceDiagram', function() {
|
||||
beforeEach(function() {
|
||||
parser.yy = sequenceDb;
|
||||
@@ -1190,7 +1191,6 @@ sequenceDiagram
|
||||
Alice->>Bob: Hello Bob, how are you? If you are not available right now, I can leave you a message. Please get back to me as soon as you can!
|
||||
Note left of Alice: Bob thinks
|
||||
Bob->>Alice: Fine!`;
|
||||
|
||||
parser.parse(str);
|
||||
renderer.draw(str, 'tst');
|
||||
|
||||
@@ -1214,7 +1214,6 @@ sequenceDiagram
|
||||
Alice->>Bob: Hello Bob, how are you? If you are not available right now, I can leave you a message. Please get back to me as soon as you can!
|
||||
Note left of Alice: Bob thinks
|
||||
Bob->>Alice: Fine!`;
|
||||
|
||||
parser.parse(str);
|
||||
// renderer.setConf(mermaidAPI.getConfig().sequence);
|
||||
renderer.draw(str, 'tst');
|
||||
@@ -1242,7 +1241,6 @@ Alice->Bob: Hello Bob, how are you?
|
||||
loop Cheers
|
||||
Bob->Alice: Fine!
|
||||
end`;
|
||||
|
||||
parser.parse(str);
|
||||
renderer.draw(str, 'tst');
|
||||
|
||||
@@ -1274,38 +1272,6 @@ end`;
|
||||
});
|
||||
});
|
||||
|
||||
describe('issue fixes', function() {
|
||||
beforeEach(() => {
|
||||
parser.yy = sequenceDb;
|
||||
parser.yy.clear();
|
||||
mermaidAPI.reset();
|
||||
mermaidAPI.initialize({ logLevel: 0, theme: 'dark' });
|
||||
renderer.bounds.init();
|
||||
});
|
||||
it('should fix issue 1480', function() {
|
||||
const str = `
|
||||
sequenceDiagram
|
||||
participant Event as Very long name goes here
|
||||
participant API as Some API
|
||||
participant API2 as A different API
|
||||
participant Client as Another very long name goes here
|
||||
|
||||
activate Event
|
||||
Event ->> Event: Something important happens
|
||||
Note over Event,Client: Some explanation goes here
|
||||
activate Client
|
||||
Event --x Client: Publish event
|
||||
deactivate Event
|
||||
|
||||
deactivate Client`;
|
||||
parser.parse(str);
|
||||
renderer.draw(str, 'tst');
|
||||
const bounds = renderer.bounds.getBounds();
|
||||
const actors = parser.yy.getActors();
|
||||
const messages = parser.yy.getMessages();
|
||||
expect(bounds).toBeTruthy();
|
||||
})
|
||||
});
|
||||
|
||||
describe('when rendering a sequenceDiagram with actor mirror activated', function() {
|
||||
let conf;
|
||||
|
@@ -460,7 +460,7 @@ export const drawActors = function(diagram, actors, actorKeys, verticalPos) {
|
||||
// Add some rendering data to the object
|
||||
actor.width = actor.width ? actor.width : conf.width;
|
||||
actor.height = conf.height;
|
||||
actor.margin = conf.actorMargin;
|
||||
actor.margin = actor.margin || conf.actorMargin;
|
||||
|
||||
actor.x = prevWidth + prevMargin;
|
||||
actor.y = verticalPos;
|
||||
@@ -565,7 +565,6 @@ export const draw = function(text, id) {
|
||||
drawActors(diagram, actors, actorKeys, 0);
|
||||
const loopWidths = calculateLoopMargins(messages, actors);
|
||||
|
||||
logger.debug('actors:', actors);
|
||||
// The arrow head definition is attached to the svg once
|
||||
svgDraw.insertArrowHead(diagram);
|
||||
svgDraw.insertArrowCrossHead(diagram);
|
||||
@@ -966,6 +965,7 @@ const getMaxMessageWidthPerActor = function(actors, messages) {
|
||||
}
|
||||
});
|
||||
|
||||
logger.debug('MaxMessages:', maxMessageWidthPerActor);
|
||||
return maxMessageWidthPerActor;
|
||||
};
|
||||
|
||||
@@ -1077,7 +1077,6 @@ const calculateLoopMargins = function(messages, actors) {
|
||||
});
|
||||
}
|
||||
});
|
||||
logger.debug('LoopWidths:', { loops, actors });
|
||||
return loops;
|
||||
};
|
||||
|
||||
|
@@ -148,7 +148,7 @@ let actorCnt = -1;
|
||||
* Draws an actor in the diagram with the attaced line
|
||||
* @param elem - The diagram we'll draw to.
|
||||
* @param actor - The actor to draw.
|
||||
* @param conf - utils.drawText implementation discriminator object
|
||||
* @param conf - drawText implementation discriminator object
|
||||
*/
|
||||
export const drawActor = function(elem, actor, conf) {
|
||||
const center = actor.x + actor.width / 2;
|
||||
|
Reference in New Issue
Block a user