mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-13 20:39:38 +02:00
Remove hardcoded width in tests
This commit is contained in:
@@ -225,7 +225,7 @@ describe('Gantt diagram', () => {
|
|||||||
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.be.within(984 * 0.95, 984 * 1.05);
|
expect(maxWidthValue).to.be.within(cy.viewport.width * 0.95, cy.viewport.width * 1.05);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -269,7 +269,7 @@ describe('Gantt diagram', () => {
|
|||||||
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(cy.viewport.width * 0.95, cy.viewport.width * 1.05);
|
||||||
expect(svg).to.not.have.attr('style');
|
expect(svg).to.not.have.attr('style');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@@ -54,7 +54,7 @@ describe('Pie Chart', () => {
|
|||||||
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(984);
|
expect(maxWidthValue).to.be.within(cy.viewport.width * 0.95, cy.viewport.width * 1.05);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
it('should render a pie diagram when useMaxWidth is false', () => {
|
it('should render a pie diagram when useMaxWidth is false', () => {
|
||||||
@@ -71,7 +71,7 @@ describe('Pie Chart', () => {
|
|||||||
// 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.be.within(cy.viewport.width * 0.95, cy.viewport.width * 1.05);
|
||||||
expect(svg).to.not.have.attr('style');
|
expect(svg).to.not.have.attr('style');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user