add actor-bottom class

This commit is contained in:
Ronid1
2024-01-29 11:42:23 -08:00
parent 7e86d03dc9
commit f737c9f6f9
2 changed files with 15 additions and 3 deletions

View File

@@ -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(
`
sequenceDiagram
@@ -387,6 +387,13 @@ context('Sequence diagram', () => {
);
cy.get('.actor').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', () => {
imgSnapshotTest(

View File

@@ -6,6 +6,7 @@ import { sanitizeUrl } from '@braintree/sanitize-url';
export const ACTOR_TYPE_WIDTH = 18 * 2;
const TOP_ACTOR_CLASS = 'actor-top';
const BOTTOM_ACTOR_CLASS = 'actor-bottom';
export const drawRect = function (elem, rectData) {
return svgDrawCommon.drawRect(elem, rectData);
@@ -320,7 +321,9 @@ const drawActorTypeParticipant = function (elem, actor, conf, isFooter) {
} else {
rect.fill = '#eaeaea';
}
if (!isFooter) {
if (isFooter) {
cssclass += ` ${BOTTOM_ACTOR_CLASS}`;
} else {
cssclass += ` ${TOP_ACTOR_CLASS}`;
}
rect.x = actor.x;
@@ -388,7 +391,9 @@ const drawActorTypeActor = function (elem, actor, conf, isFooter) {
}
const actElem = elem.append('g');
let cssClass = 'actor-man';
if (!isFooter) {
if (isFooter) {
cssClass += ` ${BOTTOM_ACTOR_CLASS}`;
} else {
cssClass += ` ${TOP_ACTOR_CLASS}`;
}
actElem.attr('class', cssClass);