mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-10-02 21:59:39 +02:00
add actor-bottom class
This commit is contained in:
@@ -375,7 +375,7 @@ context('Sequence diagram', () => {
|
|||||||
{}
|
{}
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
it('should have actor-top class on top actor box and symbol', () => {
|
it('should have actor-top and actor-bottom classes on top and bottom actor box and symbol', () => {
|
||||||
imgSnapshotTest(
|
imgSnapshotTest(
|
||||||
`
|
`
|
||||||
sequenceDiagram
|
sequenceDiagram
|
||||||
@@ -387,6 +387,13 @@ context('Sequence diagram', () => {
|
|||||||
);
|
);
|
||||||
cy.get('.actor').should('have.class', 'actor-top');
|
cy.get('.actor').should('have.class', 'actor-top');
|
||||||
cy.get('.actor-man').should('have.class', 'actor-top');
|
cy.get('.actor-man').should('have.class', 'actor-top');
|
||||||
|
cy.get('.actor.actor-top').should('not.have.class', 'actor-bottom');
|
||||||
|
cy.get('.actor-man.actor-top').should('not.have.class', 'actor-bottom');
|
||||||
|
|
||||||
|
cy.get('.actor').should('have.class', 'actor-bottom');
|
||||||
|
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');
|
||||||
});
|
});
|
||||||
it('should render long notes left of actor', () => {
|
it('should render long notes left of actor', () => {
|
||||||
imgSnapshotTest(
|
imgSnapshotTest(
|
||||||
|
@@ -6,6 +6,7 @@ import { sanitizeUrl } from '@braintree/sanitize-url';
|
|||||||
|
|
||||||
export const ACTOR_TYPE_WIDTH = 18 * 2;
|
export const ACTOR_TYPE_WIDTH = 18 * 2;
|
||||||
const TOP_ACTOR_CLASS = 'actor-top';
|
const TOP_ACTOR_CLASS = 'actor-top';
|
||||||
|
const BOTTOM_ACTOR_CLASS = 'actor-bottom';
|
||||||
|
|
||||||
export const drawRect = function (elem, rectData) {
|
export const drawRect = function (elem, rectData) {
|
||||||
return svgDrawCommon.drawRect(elem, rectData);
|
return svgDrawCommon.drawRect(elem, rectData);
|
||||||
@@ -320,7 +321,9 @@ const drawActorTypeParticipant = function (elem, actor, conf, isFooter) {
|
|||||||
} else {
|
} else {
|
||||||
rect.fill = '#eaeaea';
|
rect.fill = '#eaeaea';
|
||||||
}
|
}
|
||||||
if (!isFooter) {
|
if (isFooter) {
|
||||||
|
cssclass += ` ${BOTTOM_ACTOR_CLASS}`;
|
||||||
|
} else {
|
||||||
cssclass += ` ${TOP_ACTOR_CLASS}`;
|
cssclass += ` ${TOP_ACTOR_CLASS}`;
|
||||||
}
|
}
|
||||||
rect.x = actor.x;
|
rect.x = actor.x;
|
||||||
@@ -388,7 +391,9 @@ const drawActorTypeActor = function (elem, actor, conf, isFooter) {
|
|||||||
}
|
}
|
||||||
const actElem = elem.append('g');
|
const actElem = elem.append('g');
|
||||||
let cssClass = 'actor-man';
|
let cssClass = 'actor-man';
|
||||||
if (!isFooter) {
|
if (isFooter) {
|
||||||
|
cssClass += ` ${BOTTOM_ACTOR_CLASS}`;
|
||||||
|
} else {
|
||||||
cssClass += ` ${TOP_ACTOR_CLASS}`;
|
cssClass += ` ${TOP_ACTOR_CLASS}`;
|
||||||
}
|
}
|
||||||
actElem.attr('class', cssClass);
|
actElem.attr('class', cssClass);
|
||||||
|
Reference in New Issue
Block a user