fix: rendering test cases

on-behalf-of: @Mermaid-Chart <hello@mermaidchart.com>
This commit is contained in:
omkarht
2025-08-08 19:31:56 +05:30
parent 4bece53a3c
commit 716548548a
2 changed files with 300 additions and 285 deletions

View File

@@ -2,49 +2,50 @@ import { imgSnapshotTest, renderGraph } from '../../helpers/util.ts';
const looks = ['classic']; const looks = ['classic'];
const participantTypes = [ const participantTypes = [
'participant', { type: 'participant', display: 'participant' },
'actor', { type: 'actor', display: 'actor' },
'boundary', { type: 'boundary', display: 'boundary' },
'control', { type: 'control', display: 'control' },
'entity', { type: 'entity', display: 'entity' },
'database', { type: 'database', display: 'database' },
'collections', { type: 'collections', display: 'collections' },
'queue', { type: 'queue', display: 'queue' },
]; ];
const interactionTypes = [ const restrictedTypes = ['boundary', 'control', 'entity', 'database', 'collections', 'queue'];
'->>', // Solid arrow with arrowhead
'-->>', // Dotted arrow with arrowhead const interactionTypes = ['->>', '-->>', '->', '-->', '-x', '--x', '->>+', '-->>+'];
'->', // Solid arrow without arrowhead
'-->', // Dotted arrow without arrowhead
'-x', // Solid arrow with cross
'--x', // Dotted arrow with cross
'->>+', // Solid arrow with arrowhead (activate)
'-->>+', // Dotted arrow with arrowhead (activate)
];
const notePositions = ['left of', 'right of', 'over']; const notePositions = ['left of', 'right of', 'over'];
function getParticipantLine(name, type, alias) {
if (restrictedTypes.includes(type)) {
return ` participant ${name}@{ "type" : "${type}" }\n`;
} else if (alias) {
return ` participant ${name}@{ "type" : "${type}" } \n`;
} else {
return ` participant ${name}@{ "type" : "${type}" }\n`;
}
}
looks.forEach((look) => { looks.forEach((look) => {
describe(`Sequence Diagram Tests - ${look} look`, () => { describe(`Sequence Diagram Tests - ${look} look`, () => {
it('should render all participant types', () => { it('should render all participant types', () => {
let diagramCode = `sequenceDiagram\n`; let diagramCode = `sequenceDiagram\n`;
participantTypes.forEach((type, index) => { participantTypes.forEach((pt, index) => {
diagramCode += ` ${type} ${type}${index} as ${type} ${index}\n`; const name = `${pt.display}${index}`;
diagramCode += getParticipantLine(name, pt.type);
}); });
// Add some basic interactions
for (let i = 0; i < participantTypes.length - 1; i++) { for (let i = 0; i < participantTypes.length - 1; i++) {
diagramCode += ` ${participantTypes[i]}${i} ->> ${participantTypes[i + 1]}${i + 1}: Message ${i}\n`; diagramCode += ` ${participantTypes[i].display}${i} ->> ${participantTypes[i + 1].display}${i + 1}: Message ${i}\n`;
} }
imgSnapshotTest(diagramCode, { look, sequence: { diagramMarginX: 50, diagramMarginY: 10 } }); imgSnapshotTest(diagramCode, { look, sequence: { diagramMarginX: 50, diagramMarginY: 10 } });
}); });
it('should render all interaction types', () => { it('should render all interaction types', () => {
let diagramCode = `sequenceDiagram\n`; let diagramCode = `sequenceDiagram\n`;
// Create two participants diagramCode += getParticipantLine('A', 'actor');
// Add all interaction types diagramCode += getParticipantLine('B', 'boundary');
diagramCode += ` participant A\n`;
diagramCode += ` participant B\n`;
interactionTypes.forEach((interaction, index) => { interactionTypes.forEach((interaction, index) => {
diagramCode += ` A ${interaction} B: ${interaction} message ${index}\n`; diagramCode += ` A ${interaction} B: ${interaction} message ${index}\n`;
}); });
@@ -53,13 +54,14 @@ looks.forEach((look) => {
it('should render participant creation and destruction', () => { it('should render participant creation and destruction', () => {
let diagramCode = `sequenceDiagram\n`; let diagramCode = `sequenceDiagram\n`;
participantTypes.forEach((type, index) => { participantTypes.forEach((pt, index) => {
diagramCode += ` ${type} A\n`; const name = `${pt.display}${index}`;
diagramCode += ` ${type} B\n`; diagramCode += getParticipantLine('A', pt.type);
diagramCode += ` create ${type} ${type}${index}\n`; diagramCode += getParticipantLine('B', pt.type);
diagramCode += ` A ->> ${type}${index}: Hello ${type}\n`; diagramCode += ` create participant ${name}@{ "type" : "${pt.type}" }\n`;
diagramCode += ` A ->> ${name}: Hello ${pt.display}\n`;
if (index % 2 === 0) { if (index % 2 === 0) {
diagramCode += ` destroy ${type}${index}\n`; diagramCode += ` destroy ${name}\n`;
} }
}); });
imgSnapshotTest(diagramCode, { look }); imgSnapshotTest(diagramCode, { look });
@@ -67,8 +69,8 @@ looks.forEach((look) => {
it('should render notes in all positions', () => { it('should render notes in all positions', () => {
let diagramCode = `sequenceDiagram\n`; let diagramCode = `sequenceDiagram\n`;
diagramCode += ` participant A\n`; diagramCode += getParticipantLine('A', 'actor');
diagramCode += ` participant B\n`; diagramCode += getParticipantLine('B', 'boundary');
notePositions.forEach((position, index) => { notePositions.forEach((position, index) => {
diagramCode += ` Note ${position} A: Note ${position} ${index}\n`; diagramCode += ` Note ${position} A: Note ${position} ${index}\n`;
}); });
@@ -78,12 +80,12 @@ looks.forEach((look) => {
it('should render parallel interactions', () => { it('should render parallel interactions', () => {
let diagramCode = `sequenceDiagram\n`; let diagramCode = `sequenceDiagram\n`;
participantTypes.slice(0, 4).forEach((type, index) => { participantTypes.slice(0, 4).forEach((pt, index) => {
diagramCode += ` ${type} ${type}${index}\n`; diagramCode += getParticipantLine(`${pt.display}${index}`, pt.type);
}); });
diagramCode += ` par Parallel actions\n`; diagramCode += ` par Parallel actions\n`;
for (let i = 0; i < participantTypes.length - 1; i += 2) { for (let i = 0; i < 3; i += 2) {
diagramCode += ` ${participantTypes[i]}${i} ->> ${participantTypes[i + 1]}${i + 1}: Message ${i}\n`; diagramCode += ` ${participantTypes[i].display}${i} ->> ${participantTypes[i + 1].display}${i + 1}: Message ${i}\n`;
if (i < participantTypes.length - 2) { if (i < participantTypes.length - 2) {
diagramCode += ` and\n`; diagramCode += ` and\n`;
} }
@@ -94,8 +96,8 @@ looks.forEach((look) => {
it('should render alternative flows', () => { it('should render alternative flows', () => {
let diagramCode = `sequenceDiagram\n`; let diagramCode = `sequenceDiagram\n`;
diagramCode += ` participant A\n`; diagramCode += getParticipantLine('A', 'actor');
diagramCode += ` participant B\n`; diagramCode += getParticipantLine('B', 'boundary');
diagramCode += ` alt Successful case\n`; diagramCode += ` alt Successful case\n`;
diagramCode += ` A ->> B: Request\n`; diagramCode += ` A ->> B: Request\n`;
diagramCode += ` B -->> A: Success\n`; diagramCode += ` B -->> A: Success\n`;
@@ -108,12 +110,12 @@ looks.forEach((look) => {
it('should render loops', () => { it('should render loops', () => {
let diagramCode = `sequenceDiagram\n`; let diagramCode = `sequenceDiagram\n`;
participantTypes.slice(0, 3).forEach((type, index) => { participantTypes.slice(0, 3).forEach((pt, index) => {
diagramCode += ` ${type} ${type}${index}\n`; diagramCode += getParticipantLine(`${pt.display}${index}`, pt.type);
}); });
diagramCode += ` loop For each participant\n`; diagramCode += ` loop For each participant\n`;
for (let i = 0; i < 3; i++) { for (let i = 0; i < 3; i++) {
diagramCode += ` ${participantTypes[0]}0 ->> ${participantTypes[1]}1: Message ${i}\n`; diagramCode += ` ${participantTypes[0].display}0 ->> ${participantTypes[1].display}1: Message ${i}\n`;
} }
diagramCode += ` end\n`; diagramCode += ` end\n`;
imgSnapshotTest(diagramCode, { look }); imgSnapshotTest(diagramCode, { look });
@@ -122,27 +124,26 @@ looks.forEach((look) => {
it('should render boxes around groups', () => { it('should render boxes around groups', () => {
let diagramCode = `sequenceDiagram\n`; let diagramCode = `sequenceDiagram\n`;
diagramCode += ` box Group 1\n`; diagramCode += ` box Group 1\n`;
participantTypes.slice(0, 3).forEach((type, index) => { participantTypes.slice(0, 3).forEach((pt, index) => {
diagramCode += ` ${type} ${type}${index}\n`; diagramCode += ` ${getParticipantLine(`${pt.display}${index}`, pt.type)}`;
}); });
diagramCode += ` end\n`; diagramCode += ` end\n`;
diagramCode += ` box rgb(200,220,255) Group 2\n`; diagramCode += ` box rgb(200,220,255) Group 2\n`;
participantTypes.slice(3, 6).forEach((type, index) => { participantTypes.slice(3, 6).forEach((pt, index) => {
diagramCode += ` ${type} ${type}${index}\n`; diagramCode += ` ${getParticipantLine(`${pt.display}${index}`, pt.type)}`;
}); });
diagramCode += ` end\n`; diagramCode += ` end\n`;
// Add some interactions diagramCode += ` ${participantTypes[0].display}0 ->> ${participantTypes[3].display}0: Cross-group message\n`;
diagramCode += ` ${participantTypes[0]}0 ->> ${participantTypes[3]}0: Cross-group message\n`;
imgSnapshotTest(diagramCode, { look }); imgSnapshotTest(diagramCode, { look });
}); });
it('should render with different font settings', () => { it('should render with different font settings', () => {
let diagramCode = `sequenceDiagram\n`; let diagramCode = `sequenceDiagram\n`;
participantTypes.slice(0, 3).forEach((type, index) => { participantTypes.slice(0, 3).forEach((pt, index) => {
diagramCode += ` ${type} ${type}${index}\n`; diagramCode += getParticipantLine(`${pt.display}${index}`, pt.type);
}); });
diagramCode += ` ${participantTypes[0]}0 ->> ${participantTypes[1]}1: Regular message\n`; diagramCode += ` ${participantTypes[0].display}0 ->> ${participantTypes[1].display}1: Regular message\n`;
diagramCode += ` Note right of ${participantTypes[1]}1: Regular note\n`; diagramCode += ` Note right of ${participantTypes[1].display}1: Regular note\n`;
imgSnapshotTest(diagramCode, { imgSnapshotTest(diagramCode, {
look, look,
sequence: { sequence: {
@@ -166,15 +167,15 @@ describe('Sequence Diagram Special Cases', () => {
sequenceDiagram sequenceDiagram
box rgb(200,220,255) Authentication box rgb(200,220,255) Authentication
actor User actor User
boundary LoginUI participant LoginUI@{ "type": "boundary" }
control AuthService participant AuthService@{ "type": "control" }
database UserDB participant UserDB@{ "type": "database" }
end end
box rgb(200,255,220) Order Processing box rgb(200,255,220) Order Processing
entity Order participant Order@{ "type": "entity" }
queue OrderQueue participant OrderQueue@{ "type": "queue" }
collections AuditLogs participant AuditLogs@{ "type": "collections" }
end end
User ->> LoginUI: Enter credentials User ->> LoginUI: Enter credentials
@@ -231,14 +232,14 @@ describe('Sequence Diagram Special Cases', () => {
imgSnapshotTest( imgSnapshotTest(
` `
sequenceDiagram sequenceDiagram
actor User participant User@{ "type": "actor" }
participant AuthService as Authentication Service participant AuthService@{ "type": "control" }
boundary UI participant UI@{ "type": "boundary" }
control OrderController participant OrderController@{ "type": "control" }
entity Product participant Product@{ "type": "entity" }
database MongoDB participant MongoDB@{ "type": "database" }
collections Products participant Products@{ "type": "collections" }
queue OrderQueue participant OrderQueue@{ "type": "queue" }
User ->> UI: Login request User ->> UI: Login request
UI ->> AuthService: Validate credentials UI ->> AuthService: Validate credentials
AuthService -->> UI: Authentication token AuthService -->> UI: Authentication token
@@ -254,46 +255,63 @@ describe('Sequence Diagram Special Cases', () => {
}); });
it('should render participant creation and destruction with different types', () => { it('should render participant creation and destruction with different types', () => {
imgSnapshotTest( imgSnapshotTest(`
`
sequenceDiagram sequenceDiagram
actor Customer participant Alice@{ "type" : "boundary" }
participant Frontend Alice->>Bob: Hello Bob, how are you ?
boundary PaymentGateway Bob->>Alice: Fine, thank you. And you?
Customer ->> Frontend: Place order create participant Carl@{ "type" : "control" }
Frontend ->> OrderProcessor: Process order Alice->>Carl: Hi Carl!
create database OrderDB create actor D as Donald
OrderProcessor ->> OrderDB: Save order Carl->>D: Hi!
` destroy Carl
); Alice-xCarl: We are too many
destroy Bob
Bob->>Alice: I agree
`);
}); });
it('should handle complex interactions between different participant types', () => { it('should handle complex interactions between different participant types', () => {
imgSnapshotTest( imgSnapshotTest(
` `
sequenceDiagram sequenceDiagram
box rgba(200,220,255,0.5) System Components box rgb(200,220,255) Authentication
actor User participant User@{ "type": "actor" }
boundary WebUI participant LoginUI@{ "type": "boundary" }
control API participant AuthService@{ "type": "control" }
entity BusinessLogic participant UserDB@{ "type": "database" }
database MainDB
end
box rgba(200,255,220,0.5) External Services
queue MessageQueue
database AuditLogs
end end
User ->> WebUI: Submit request box rgb(200,255,220) Order Processing
WebUI ->> API: Process request participant Order@{ "type": "entity" }
API ->> BusinessLogic: Execute business rules participant OrderQueue@{ "type": "queue" }
BusinessLogic ->> MainDB: Query data participant AuditLogs@{ "type": "collections" }
MainDB -->> BusinessLogic: Return results end
BusinessLogic ->> MessageQueue: Publish event
MessageQueue -->> AuditLogs: Store audit trail User ->> LoginUI: Enter credentials
AuditLogs -->> API: Audit complete LoginUI ->> AuthService: Validate
API -->> WebUI: Return response AuthService ->> UserDB: Query user
WebUI -->> User: Show results UserDB -->> AuthService: User data
alt Valid credentials
AuthService -->> LoginUI: Success
LoginUI -->> User: Welcome
par Place order
User ->> Order: New order
Order ->> OrderQueue: Process
and
Order ->> AuditLogs: Record
end
loop Until confirmed
OrderQueue ->> Order: Update status
Order -->> User: Notification
end
else Invalid credentials
AuthService --x LoginUI: Failure
LoginUI --x User: Retry
end
`, `,
{ sequence: { useMaxWidth: false } } { sequence: { useMaxWidth: false } }
); );
@@ -303,13 +321,13 @@ describe('Sequence Diagram Special Cases', () => {
imgSnapshotTest( imgSnapshotTest(
` `
sequenceDiagram sequenceDiagram
actor Customer participant Customer@{ "type": "actor" }
participant Frontend participant Frontend@{ "type": "participant" }
boundary PaymentService participant PaymentService@{ "type": "boundary" }
control InventoryManager participant InventoryManager@{ "type": "control" }
entity Order participant Order@{ "type": "entity" }
database OrdersDB participant OrdersDB@{ "type": "database" }
queue NotificationQueue participant NotificationQueue@{ "type": "queue" }
Customer ->> Frontend: Place order Customer ->> Frontend: Place order
Frontend ->> Order: Create order Frontend ->> Order: Create order
@@ -327,18 +345,18 @@ describe('Sequence Diagram Special Cases', () => {
` `
); );
}); });
});
it('should render different participant types with notes and loops', () => { it('should render different participant types with notes and loops', () => {
imgSnapshotTest( imgSnapshotTest(
` `
sequenceDiagram sequenceDiagram
actor Admin actor Admin
participant Dashboard participant Dashboard
boundary AuthService participant AuthService@{ "type" : "boundary" }
control UserManager participant UserManager@{ "type" : "control" }
entity UserProfile participant UserProfile@{ "type" : "entity" }
database UserDB participant UserDB@{ "type" : "database" }
database Logs participant Logs@{ "type" : "database" }
Admin ->> Dashboard: Open user management Admin ->> Dashboard: Open user management
loop Authentication check loop Authentication check
@@ -364,11 +382,11 @@ describe('Sequence Diagram Special Cases', () => {
sequenceDiagram sequenceDiagram
actor Client actor Client
participant MobileApp participant MobileApp
boundary CloudService participant CloudService@{ "type" : "boundary" }
control DataProcessor participant DataProcessor@{ "type" : "control" }
entity Transaction participant Transaction@{ "type" : "entity" }
database TransactionsDB participant TransactionsDB@{ "type" : "database" }
queue EventBus participant EventBus@{ "type" : "queue" }
Client ->> MobileApp: Initiate transaction Client ->> MobileApp: Initiate transaction
MobileApp ->> CloudService: Authenticate MobileApp ->> CloudService: Authenticate
@@ -392,16 +410,13 @@ describe('Sequence Diagram Special Cases', () => {
imgSnapshotTest( imgSnapshotTest(
` `
sequenceDiagram sequenceDiagram
actor LongNameUser as User With A Very<br/>Long Name participant B@{ "type" : "boundary" }
participant FE as Frontend Service<br/>With Long Name participant C@{ "type" : "control" }
boundary B as Boundary With<br/>Multiline Name participant E@{ "type" : "entity" }
control C as Control With<br/>Multiline Name participant DB@{ "type" : "database" }
entity E as Entity With<br/>Multiline Name participant COL@{ "type" : "collections" }
database DB as Database With<br/>Multiline Name participant Q@{ "type" : "queue" }
collections COL as Collections With<br/>Multiline Name
queue Q as Queue With<br/>Multiline Name
LongNameUser ->> FE: This is a very long message that should wrap properly in the diagram
FE ->> B: Another long message<br/>with explicit<br/>line breaks FE ->> B: Another long message<br/>with explicit<br/>line breaks
B -->> FE: Response message that is also quite long and needs to wrap B -->> FE: Response message that is also quite long and needs to wrap
FE ->> C: Process data FE ->> C: Process data
@@ -416,12 +431,13 @@ describe('Sequence Diagram Special Cases', () => {
{ sequence: { wrap: true } } { sequence: { wrap: true } }
); );
}); });
describe('Sequence Diagram - New Participant Types with Long Notes and Messages', () => { describe('Sequence Diagram - New Participant Types with Long Notes and Messages', () => {
it('should render long notes left of boundary', () => { it('should render long notes left of boundary', () => {
imgSnapshotTest( imgSnapshotTest(
` `
sequenceDiagram sequenceDiagram
boundary Alice participant Alice@{ "type" : "boundary" }
actor Bob actor Bob
Alice->>Bob: Hola Alice->>Bob: Hola
Note left of Alice: Extremely utterly long line of longness which had previously overflown the actor box as it is much longer than what it should be Note left of Alice: Extremely utterly long line of longness which had previously overflown the actor box as it is much longer than what it should be
@@ -435,7 +451,7 @@ describe('Sequence Diagram Special Cases', () => {
imgSnapshotTest( imgSnapshotTest(
` `
sequenceDiagram sequenceDiagram
control Alice participant Alice@{ "type" : "control" }
actor Bob actor Bob
Alice->>Bob: Hola Alice->>Bob: Hola
Note left of Alice:wrap: Extremely utterly long line of longness which had previously overflown the actor box as it is much longer than what it should be Note left of Alice:wrap: Extremely utterly long line of longness which had previously overflown the actor box as it is much longer than what it should be
@@ -449,7 +465,7 @@ describe('Sequence Diagram Special Cases', () => {
imgSnapshotTest( imgSnapshotTest(
` `
sequenceDiagram sequenceDiagram
entity Alice participant Alice@{ "type" : "entity" }
actor Bob actor Bob
Alice->>Bob: Hola Alice->>Bob: Hola
Note right of Alice: Extremely utterly long line of longness which had previously overflown the actor box as it is much longer than what it should be Note right of Alice: Extremely utterly long line of longness which had previously overflown the actor box as it is much longer than what it should be
@@ -463,7 +479,7 @@ describe('Sequence Diagram Special Cases', () => {
imgSnapshotTest( imgSnapshotTest(
` `
sequenceDiagram sequenceDiagram
database Alice participant Alice@{ "type" : "database" }
actor Bob actor Bob
Alice->>Bob: Hola Alice->>Bob: Hola
Note right of Alice:wrap: Extremely utterly long line of longness which had previously overflown the actor box as it is much longer than what it should be Note right of Alice:wrap: Extremely utterly long line of longness which had previously overflown the actor box as it is much longer than what it should be
@@ -477,7 +493,7 @@ describe('Sequence Diagram Special Cases', () => {
imgSnapshotTest( imgSnapshotTest(
` `
sequenceDiagram sequenceDiagram
collections Alice participant Alice@{ "type" : "collections" }
actor Bob actor Bob
Alice->>Bob: Hola Alice->>Bob: Hola
Note over Alice: Extremely utterly long line of longness which had previously overflown the actor box as it is much longer than what it should be Note over Alice: Extremely utterly long line of longness which had previously overflown the actor box as it is much longer than what it should be
@@ -491,7 +507,7 @@ describe('Sequence Diagram Special Cases', () => {
imgSnapshotTest( imgSnapshotTest(
` `
sequenceDiagram sequenceDiagram
queue Alice participant Alice@{ "type" : "queue" }
actor Bob actor Bob
Alice->>Bob: Hola Alice->>Bob: Hola
Note over Alice:wrap: Extremely utterly long line of longness which had previously overflown the actor box as it is much longer than what it should be Note over Alice:wrap: Extremely utterly long line of longness which had previously overflown the actor box as it is much longer than what it should be
@@ -506,7 +522,7 @@ describe('Sequence Diagram Special Cases', () => {
` `
sequenceDiagram sequenceDiagram
actor Alice actor Alice
boundary Charlie participant Charlie@{ "type" : "boundary" }
note over Alice: Some note note over Alice: Some note
note over Charlie: Other note note over Charlie: Other note
`, `,
@@ -518,8 +534,8 @@ describe('Sequence Diagram Special Cases', () => {
imgSnapshotTest( imgSnapshotTest(
` `
sequenceDiagram sequenceDiagram
database Alice participant Alice@{ "type" : "database" }
collections Bob participant Bob@{ "type" : "collections" }
Alice->>Bob: Extremely utterly long line of longness which had previously overflown the actor box as it is much longer than what it should be Alice->>Bob: Extremely utterly long line of longness which had previously overflown the actor box as it is much longer than what it should be
Bob->>Alice: I'm short though Bob->>Alice: I'm short though
`, `,
@@ -531,8 +547,8 @@ describe('Sequence Diagram Special Cases', () => {
imgSnapshotTest( imgSnapshotTest(
` `
sequenceDiagram sequenceDiagram
control Alice participant Alice@{ "type" : "control" }
entity Bob participant Bob@{ "type" : "entity" }
Alice->>Bob:wrap: Extremely utterly long line of longness which had previously overflown the actor box as it is much longer than what it should be Alice->>Bob:wrap: Extremely utterly long line of longness which had previously overflown the actor box as it is much longer than what it should be
Bob->>Alice: I'm short though Bob->>Alice: I'm short though
`, `,
@@ -544,8 +560,8 @@ describe('Sequence Diagram Special Cases', () => {
imgSnapshotTest( imgSnapshotTest(
` `
sequenceDiagram sequenceDiagram
queue Alice participant Alice@{ "type" : "queue" }
boundary Bob participant Bob@{ "type" : "boundary" }
Alice->>Bob: I'm short Alice->>Bob: I'm short
Bob->>Alice: Extremely utterly long line of longness which had previously overflown the actor box as it is much longer than what it should be Bob->>Alice: Extremely utterly long line of longness which had previously overflown the actor box as it is much longer than what it should be
`, `,
@@ -558,7 +574,7 @@ describe('Sequence Diagram Special Cases', () => {
` `
sequenceDiagram sequenceDiagram
actor Alice actor Alice
database Bob participant Bob@{ "type" : "database" }
Alice->>Bob: I'm short Alice->>Bob: I'm short
Bob->>Alice:wrap: Extremely utterly long line of longness which had previously overflown the actor box as it is much longer than what it should be Bob->>Alice:wrap: Extremely utterly long line of longness which had previously overflown the actor box as it is much longer than what it should be
`, `,
@@ -566,7 +582,6 @@ describe('Sequence Diagram Special Cases', () => {
); );
}); });
}); });
});
describe('svg size', () => { describe('svg size', () => {
it('should render a sequence diagram when useMaxWidth is true (default)', () => { it('should render a sequence diagram when useMaxWidth is true (default)', () => {
@@ -574,8 +589,8 @@ describe('Sequence Diagram Special Cases', () => {
` `
sequenceDiagram sequenceDiagram
actor Alice actor Alice
boundary Bob participant Bob@{ "type" : "boundary" }
control John as John<br/>Second Line participant John@{ "type" : "control" }
Alice ->> Bob: Hello Bob, how are you? Alice ->> Bob: Hello Bob, how are you?
Bob-->>John: How about you John? Bob-->>John: How about you John?
Bob--x Alice: I am good thanks! Bob--x Alice: I am good thanks!
@@ -611,8 +626,8 @@ describe('Sequence Diagram Special Cases', () => {
` `
sequenceDiagram sequenceDiagram
actor Alice actor Alice
boundary Bob participant Bob@{ "type" : "boundary" }
control John as John<br/>Second Line participant John@{ "type" : "control" }
Alice ->> Bob: Hello Bob, how are you? Alice ->> Bob: Hello Bob, how are you?
Bob-->>John: How about you John? Bob-->>John: How about you John?
Bob--x Alice: I am good thanks! Bob--x Alice: I am good thanks!

View File

@@ -553,7 +553,7 @@ export class SequenceDB implements DiagramDB {
); );
} }
this.state.records.lastCreated = param.actor; this.state.records.lastCreated = param.actor;
this.addActor(param.actor, param.actor, param.description, param.draw); this.addActor(param.actor, param.actor, param.description, param.draw, param.config);
this.state.records.createdActors.set(param.actor, this.state.records.messages.length); this.state.records.createdActors.set(param.actor, this.state.records.messages.length);
break; break;
case 'destroyParticipant': case 'destroyParticipant':