mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-08-23 02:06:45 +02:00
Merge pull request #5272 from Ronid1/feature/5245-sequence_diagrame_add_classes_to_actors_text
Feature/5245 sequence diagram add classes to actors text
This commit is contained in:
@@ -375,7 +375,7 @@ context('Sequence diagram', () => {
|
||||
{}
|
||||
);
|
||||
});
|
||||
it('should have actor-top and actor-bottom classes on top and bottom actor box and symbol', () => {
|
||||
it('should have actor-top and actor-bottom classes on top and bottom actor box and symbol and actor-box and actor-man classes for text tags', () => {
|
||||
imgSnapshotTest(
|
||||
`
|
||||
sequenceDiagram
|
||||
@@ -394,6 +394,9 @@ context('Sequence diagram', () => {
|
||||
cy.get('.actor-man').should('have.class', 'actor-bottom');
|
||||
cy.get('.actor.actor-bottom').should('not.have.class', 'actor-top');
|
||||
cy.get('.actor-man.actor-bottom').should('not.have.class', 'actor-top');
|
||||
|
||||
cy.get('text.actor-box').should('include.text', 'Alice');
|
||||
cy.get('text.actor-man').should('include.text', 'Bob');
|
||||
});
|
||||
it('should render long notes left of actor', () => {
|
||||
imgSnapshotTest(
|
||||
|
@@ -741,11 +741,13 @@ Styling of a sequence diagram is done by defining a number of css classes. Durin
|
||||
### Classes used
|
||||
|
||||
| Class | Description |
|
||||
| ------------ | -------------------------------------------------------------- |
|
||||
| -------------- | -------------------------------------------------------------- |
|
||||
| actor | Styles for the actor box. |
|
||||
| actor-top | Styles for the actor figure/ box at the top of the diagram. |
|
||||
| actor-bottom | Styles for the actor figure/ box at the bottom of the diagram. |
|
||||
| text.actor | Styles for text in the actor box. |
|
||||
| text.actor | Styles for text of all of the actors. |
|
||||
| text.actor-box | Styles for text of the actor box. |
|
||||
| text.actor-man | Styles for text of the actor figure. |
|
||||
| actor-line | The vertical line for an actor. |
|
||||
| messageLine0 | Styles for the solid message line. |
|
||||
| messageLine1 | Styles for the dotted message line. |
|
||||
|
@@ -8,6 +8,8 @@ import * as configApi from '../../config.js';
|
||||
export const ACTOR_TYPE_WIDTH = 18 * 2;
|
||||
const TOP_ACTOR_CLASS = 'actor-top';
|
||||
const BOTTOM_ACTOR_CLASS = 'actor-bottom';
|
||||
const ACTOR_BOX_CLASS = 'actor-box';
|
||||
const ACTOR_MAN_FIGURE_CLASS = 'actor-man';
|
||||
|
||||
export const drawRect = function (elem, rectData) {
|
||||
return svgDrawCommon.drawRect(elem, rectData);
|
||||
@@ -395,7 +397,7 @@ const drawActorTypeParticipant = async function (elem, actor, conf, isFooter) {
|
||||
rect.y,
|
||||
rect.width,
|
||||
rect.height,
|
||||
{ class: 'actor' },
|
||||
{ class: `actor ${ACTOR_BOX_CLASS}` },
|
||||
conf
|
||||
);
|
||||
|
||||
@@ -433,7 +435,7 @@ const drawActorTypeActor = async function (elem, actor, conf, isFooter) {
|
||||
actor.actorCnt = actorCnt;
|
||||
}
|
||||
const actElem = elem.append('g');
|
||||
let cssClass = 'actor-man';
|
||||
let cssClass = ACTOR_MAN_FIGURE_CLASS;
|
||||
if (isFooter) {
|
||||
cssClass += ` ${BOTTOM_ACTOR_CLASS}`;
|
||||
} else {
|
||||
@@ -497,7 +499,7 @@ const drawActorTypeActor = async function (elem, actor, conf, isFooter) {
|
||||
rect.y + 35,
|
||||
rect.width,
|
||||
rect.height,
|
||||
{ class: 'actor' },
|
||||
{ class: `actor ${ACTOR_MAN_FIGURE_CLASS}` },
|
||||
conf
|
||||
);
|
||||
|
||||
|
@@ -519,11 +519,13 @@ Styling of a sequence diagram is done by defining a number of css classes. Durin
|
||||
### Classes used
|
||||
|
||||
| Class | Description |
|
||||
| ------------ | -------------------------------------------------------------- |
|
||||
| -------------- | -------------------------------------------------------------- |
|
||||
| actor | Styles for the actor box. |
|
||||
| actor-top | Styles for the actor figure/ box at the top of the diagram. |
|
||||
| actor-bottom | Styles for the actor figure/ box at the bottom of the diagram. |
|
||||
| text.actor | Styles for text in the actor box. |
|
||||
| text.actor | Styles for text of all of the actors. |
|
||||
| text.actor-box | Styles for text of the actor box. |
|
||||
| text.actor-man | Styles for text of the actor figure. |
|
||||
| actor-line | The vertical line for an actor. |
|
||||
| messageLine0 | Styles for the solid message line. |
|
||||
| messageLine1 | Styles for the dotted message line. |
|
||||
|
Reference in New Issue
Block a user