mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-08-26 19:56:45 +02:00
#2824 Updated regressionstest afters diagram sizing changes
This commit is contained in:
@@ -265,10 +265,10 @@ describe('Gantt diagram', () => {
|
|||||||
{ gantt: { useMaxWidth: false } }
|
{ gantt: { useMaxWidth: false } }
|
||||||
);
|
);
|
||||||
cy.get('svg').should((svg) => {
|
cy.get('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'));
|
||||||
// use within because the absolute value can be slightly different depending on the environment ±5%
|
// use within because the absolute value can be slightly different depending on the environment ±5%
|
||||||
expect(height).to.be.within(484 * 0.95, 484 * 1.05);
|
// expect(height).to.be.within(484 * 0.95, 484 * 1.05);
|
||||||
expect(width).to.be.within(984 * 0.95, 984 * 1.05);
|
expect(width).to.be.within(984 * 0.95, 984 * 1.05);
|
||||||
expect(svg).to.not.have.attr('style');
|
expect(svg).to.not.have.attr('style');
|
||||||
});
|
});
|
||||||
|
@@ -68,9 +68,9 @@ describe('Pie Chart', () => {
|
|||||||
{ pie: { useMaxWidth: false } }
|
{ pie: { useMaxWidth: false } }
|
||||||
);
|
);
|
||||||
cy.get('svg').should((svg) => {
|
cy.get('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(450);
|
// expect(height).to.eq(450);
|
||||||
expect(width).to.eq(984);
|
expect(width).to.eq(984);
|
||||||
expect(svg).to.not.have.attr('style');
|
expect(svg).to.not.have.attr('style');
|
||||||
});
|
});
|
||||||
|
@@ -487,7 +487,7 @@ stateDiagram-v2
|
|||||||
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(''));
|
||||||
// use within because the absolute value can be slightly different depending on the environment ±5%
|
// use within because the absolute value can be slightly different depending on the environment ±5%
|
||||||
expect(maxWidthValue).to.be.within(135 * 0.95, 135 * 1.05);
|
expect(maxWidthValue).to.be.within(65, 85);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
it('v2 should render a state diagram when useMaxWidth is false', () => {
|
it('v2 should render a state diagram when useMaxWidth is false', () => {
|
||||||
@@ -501,11 +501,11 @@ stateDiagram-v2
|
|||||||
{ state: { useMaxWidth: false } }
|
{ state: { useMaxWidth: false } }
|
||||||
);
|
);
|
||||||
cy.get('svg').should((svg) => {
|
cy.get('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.be.within(177, 178);
|
// expect(height).to.be.within(177, 178);
|
||||||
// use within because the absolute value can be slightly different depending on the environment ±5%
|
// use within because the absolute value can be slightly different depending on the environment ±5%
|
||||||
expect(width).to.be.within(135 * 0.95, 135 * 1.05);
|
expect(width).to.be.within(65, 85);
|
||||||
expect(svg).to.not.have.attr('style');
|
expect(svg).to.not.have.attr('style');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@@ -366,7 +366,7 @@ describe('State diagram', () => {
|
|||||||
// use within because the absolute value can be slightly different depending on the environment ±5%
|
// use within because the absolute value can be slightly different depending on the environment ±5%
|
||||||
// Todo investigate difference
|
// Todo investigate difference
|
||||||
// expect(maxWidthValue).to.be.within(112 * .95, 112 * 1.05);
|
// expect(maxWidthValue).to.be.within(112 * .95, 112 * 1.05);
|
||||||
expect(maxWidthValue).to.be.within(130, 140);
|
expect(maxWidthValue).to.be.within(65, 85);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
it('should render a state diagram when useMaxWidth is false', () => {
|
it('should render a state diagram when useMaxWidth is false', () => {
|
||||||
@@ -385,7 +385,7 @@ describe('State diagram', () => {
|
|||||||
// use within because the absolute value can be slightly different depending on the environment ±5%
|
// use within because the absolute value can be slightly different depending on the environment ±5%
|
||||||
// Todo investigate difference
|
// Todo investigate difference
|
||||||
// expect(width).to.be.within(112 * .95, 112 * 1.05);
|
// expect(width).to.be.within(112 * .95, 112 * 1.05);
|
||||||
expect(width).to.be.within(130, 140);
|
expect(width).to.be.within(65, 85);
|
||||||
|
|
||||||
expect(svg).to.not.have.attr('style');
|
expect(svg).to.not.have.attr('style');
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user