mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-08-31 14:16:42 +02:00
adds test for journey
Co-authored-by: Pranav Mishra <mishrap@dickinson.edu>
This commit is contained in:
@@ -64,7 +64,7 @@ section Checkout from website
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should maintain consistent distance between widest legend label and diagram', () => {
|
it('should maintain sufficient space between legend labels and diagram elements', () => {
|
||||||
renderGraph(
|
renderGraph(
|
||||||
`journey
|
`journey
|
||||||
title Web hook life cycle
|
title Web hook life cycle
|
||||||
@@ -83,61 +83,64 @@ section Checkout from website
|
|||||||
{ journey: { useMaxWidth: true } }
|
{ journey: { useMaxWidth: true } }
|
||||||
);
|
);
|
||||||
|
|
||||||
let rightEdgeXInitial,
|
let LabelEndX, diagramStartX;
|
||||||
leftEdgeXInitial,
|
|
||||||
rightEdgeXFinal,
|
|
||||||
leftEdgeXFinal,
|
|
||||||
initialDifference,
|
|
||||||
finalDifference;
|
|
||||||
|
|
||||||
|
// Get right edge of the legend
|
||||||
cy.contains('tspan', 'admin Exjjjnjjjj qwerty').then((textBox) => {
|
cy.contains('tspan', 'admin Exjjjnjjjj qwerty').then((textBox) => {
|
||||||
const bbox = textBox[0].getBBox();
|
const bbox = textBox[0].getBBox();
|
||||||
const rightEdge = bbox.x + bbox.width;
|
LabelEndX = bbox.x + bbox.width;
|
||||||
console.warn(rightEdge);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
cy.get(':nth-child(14) > switch > foreignobject').then((rect) => {
|
// Get left edge of the diagram
|
||||||
console.warn(rect);
|
cy.contains('foreignobject', 'Make preBuilt').then((rect) => {
|
||||||
//const leftEdgeXInitial = rect.left;
|
diagramStartX = parseFloat(rect.attr('x'));
|
||||||
// cy.log(`Left edge x-coordinate: ${leftEdgeXInitial}`);
|
|
||||||
// initialDifference = leftEdgeXInitial - rightEdgeXInitial;
|
|
||||||
// cy.log(`Initial Difference: ${initialDifference}`);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// renderGraph(
|
// Assert right edge of the diagram is greater than or equal to the right edge of the label
|
||||||
// `journey
|
cy.then(() => {
|
||||||
// title Web hook life cycle
|
expect(diagramStartX).to.be.gte(LabelEndX);
|
||||||
// section Darkoob
|
});
|
||||||
// Make preBuilt:5: Darkoob user
|
});
|
||||||
// register slug : 5: Darkoob userf deliberately increasing the size of this label to check if distance between legend and diagram is maintained
|
|
||||||
// Map slug to a Prebuilt Job:5: Darkoob user
|
|
||||||
// section External Service
|
|
||||||
// set Darkoob slug as hook for an Event : 5 : admin Exjjjnjjjj qwerty
|
|
||||||
// listen to the events : 5 : External Service
|
|
||||||
// call darkoob endpoint : 5 : External Service
|
|
||||||
// section Darkoob
|
|
||||||
// check for inputs : 5 : DarkoobAPI
|
|
||||||
// run the prebuilt job : 5 : DarkoobAPI
|
|
||||||
// `,
|
|
||||||
// { journey: { useMaxWidth: true } }
|
|
||||||
// );
|
|
||||||
|
|
||||||
// cy.contains('tspan', 'Darkoob userf deliberately increasing the size of this label to check if distance between legend and diagram is maintained')
|
it('should maintain sufficient space between legend and diagram when legend labels are longer', () => {
|
||||||
// .invoke('getBBox')
|
cy.then(() => {
|
||||||
// .then((bbox) => {
|
renderGraph(
|
||||||
// rightEdgeXFinal = bbox.x + bbox.width;
|
`journey
|
||||||
// cy.log(`Right edge x-coordinate final: ${rightEdgeXFinal}`);
|
title Web hook life cycle
|
||||||
// });
|
section Darkoob
|
||||||
|
Make preBuilt:5: Darkoob user
|
||||||
|
register slug : 5: Darkoob userf deliberately increasing the size of this label to check if distance between legend and diagram is maintained
|
||||||
|
Map slug to a Prebuilt Job:5: Darkoob user
|
||||||
|
section External Service
|
||||||
|
set Darkoob slug as hook for an Event : 5 : admin Exjjjnjjjj qwerty
|
||||||
|
listen to the events : 5 : External Service
|
||||||
|
call darkoob endpoint : 5 : External Service
|
||||||
|
section Darkoob
|
||||||
|
check for inputs : 5 : DarkoobAPI
|
||||||
|
run the prebuilt job : 5 : DarkoobAPI
|
||||||
|
`,
|
||||||
|
{ journey: { useMaxWidth: true } }
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
// cy.contains('div.label', 'Make preBuilt')
|
let LabelEndX, diagramStartX;
|
||||||
// .invoke('getBoundingClientRect')
|
|
||||||
// .then((rect) => {
|
|
||||||
// leftEdgeXFinal = rect.left;
|
|
||||||
// cy.log(`Left edge x-coordinate final: ${leftEdgeXFinal}`);
|
|
||||||
// finalDifference = leftEdgeXFinal - rightEdgeXFinal;
|
|
||||||
// cy.log(`Final Difference: ${finalDifference}`);
|
|
||||||
// });
|
|
||||||
|
|
||||||
// expect(initialDifference).toEqual(finalDifference);
|
// Get right edge of the legend
|
||||||
|
cy.contains('tspan', 'Darkoob userf deliberately increasing the size of this label').then(
|
||||||
|
(textBox) => {
|
||||||
|
const bbox = textBox[0].getBBox();
|
||||||
|
LabelEndX = bbox.x + bbox.width;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
// Get left edge of the diagram
|
||||||
|
cy.contains('foreignobject', 'Make preBuilt').then((rect) => {
|
||||||
|
diagramStartX = parseFloat(rect.attr('x'));
|
||||||
|
});
|
||||||
|
|
||||||
|
// Assert right edge of the diagram is greater than or equal to the right edge of the label
|
||||||
|
cy.then(() => {
|
||||||
|
expect(diagramStartX).to.be.gte(LabelEndX);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user