mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-08-21 01:06:43 +02:00
Fix for broken test
This commit is contained in:
@@ -32,8 +32,11 @@ section Order from website
|
|||||||
it('should render a user journey diagram when useMaxWidth is true (default)', () => {
|
it('should render a user journey diagram when useMaxWidth is true (default)', () => {
|
||||||
renderGraph(
|
renderGraph(
|
||||||
`journey
|
`journey
|
||||||
title Adding journey diagram functionality to mermaid
|
title E-Commerce
|
||||||
section Order from website
|
section Order from website
|
||||||
|
Add to cart: 5: Me
|
||||||
|
section Checkout from website
|
||||||
|
Add payment details: 5: Me
|
||||||
`,
|
`,
|
||||||
{ journey: { useMaxWidth: true } }
|
{ journey: { useMaxWidth: true } }
|
||||||
);
|
);
|
||||||
@@ -42,19 +45,22 @@ section Order from website
|
|||||||
expect(svg).to.have.attr('width', '100%');
|
expect(svg).to.have.attr('width', '100%');
|
||||||
expect(svg).to.have.attr('height');
|
expect(svg).to.have.attr('height');
|
||||||
const height = parseFloat(svg.attr('height'));
|
const height = parseFloat(svg.attr('height'));
|
||||||
expect(height).to.eq(20);
|
expect(height).to.eq(565);
|
||||||
const style = svg.attr('style');
|
const style = svg.attr('style');
|
||||||
expect(style).to.match(/^max-width: [\d.]+px;$/);
|
expect(style).to.match(/^max-width: [\d.]+px;$/);
|
||||||
const maxWidthValue = parseFloat(style.match(/[\d.]+/g).join(''));
|
const maxWidthValue = parseFloat(style.match(/[\d.]+/g).join(''));
|
||||||
expect(maxWidthValue).to.eq(400);
|
expect(maxWidthValue).to.eq(700);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should render a user journey diagram when useMaxWidth is false', () => {
|
it('should render a user journey diagram when useMaxWidth is false', () => {
|
||||||
renderGraph(
|
renderGraph(
|
||||||
`journey
|
`journey
|
||||||
title Adding journey diagram functionality to mermaid
|
title E-Commerce
|
||||||
section Order from website
|
section Order from website
|
||||||
|
Add to cart: 5: Me
|
||||||
|
section Checkout from website
|
||||||
|
Add payment details: 5: Me
|
||||||
`,
|
`,
|
||||||
{ journey: { useMaxWidth: false } }
|
{ journey: { useMaxWidth: false } }
|
||||||
);
|
);
|
||||||
@@ -62,8 +68,8 @@ section Order from website
|
|||||||
.should((svg) => {
|
.should((svg) => {
|
||||||
const height = parseFloat(svg.attr('height'));
|
const height = parseFloat(svg.attr('height'));
|
||||||
const width = parseFloat(svg.attr('width'));
|
const width = parseFloat(svg.attr('width'));
|
||||||
expect(height).to.eq(20);
|
expect(height).to.eq(565);
|
||||||
expect(width).to.eq(400);
|
expect(width).to.eq(700);
|
||||||
expect(svg).to.not.have.attr('style');
|
expect(svg).to.not.have.attr('style');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user