mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-11 03:19:42 +02:00
Lint fix
This commit is contained in:
@@ -1,4 +1,3 @@
|
|||||||
/* eslint-env jest */
|
|
||||||
import { imgSnapshotTest, renderGraph } from '../../helpers/util';
|
import { imgSnapshotTest, renderGraph } from '../../helpers/util';
|
||||||
|
|
||||||
describe('Flowchart v2', () => {
|
describe('Flowchart v2', () => {
|
||||||
@@ -91,17 +90,16 @@ describe('Flowchart v2', () => {
|
|||||||
`,
|
`,
|
||||||
{ flowchart: { useMaxWidth: true } }
|
{ flowchart: { useMaxWidth: true } }
|
||||||
);
|
);
|
||||||
cy.get('svg')
|
cy.get('svg').should((svg) => {
|
||||||
.should((svg) => {
|
|
||||||
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');
|
||||||
// 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%
|
||||||
const height = parseFloat(svg.attr('height'));
|
const height = parseFloat(svg.attr('height'));
|
||||||
expect(height).to.be.within(446 * .95, 446 * 1.05);
|
expect(height).to.be.within(446 * 0.95, 446 * 1.05);
|
||||||
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(290 * .95-1, 290 * 1.05);
|
expect(maxWidthValue).to.be.within(290 * 0.95 - 1, 290 * 1.05);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
it('8: should render a flowchart when useMaxWidth is false', () => {
|
it('8: should render a flowchart when useMaxWidth is false', () => {
|
||||||
@@ -115,13 +113,12 @@ describe('Flowchart v2', () => {
|
|||||||
`,
|
`,
|
||||||
{ flowchart: { useMaxWidth: false } }
|
{ flowchart: { useMaxWidth: false } }
|
||||||
);
|
);
|
||||||
cy.get('svg')
|
cy.get('svg').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'));
|
||||||
// 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(446 * .95, 446 * 1.05);
|
expect(height).to.be.within(446 * 0.95, 446 * 1.05);
|
||||||
expect(width).to.be.within(290 * .95-1, 290 * 1.05);
|
expect(width).to.be.within(290 * 0.95 - 1, 290 * 1.05);
|
||||||
expect(svg).to.not.have.attr('style');
|
expect(svg).to.not.have.attr('style');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -262,7 +259,6 @@ _one --> b
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
it('56: handle nested subgraphs with outgoing links 3', () => {
|
it('56: handle nested subgraphs with outgoing links 3', () => {
|
||||||
imgSnapshotTest(
|
imgSnapshotTest(
|
||||||
`flowchart TB
|
`flowchart TB
|
||||||
@@ -292,7 +288,6 @@ end
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
it('57: handle nested subgraphs with outgoing links 2', () => {
|
it('57: handle nested subgraphs with outgoing links 2', () => {
|
||||||
imgSnapshotTest(
|
imgSnapshotTest(
|
||||||
`flowchart TB
|
`flowchart TB
|
||||||
@@ -652,6 +647,6 @@ flowchart RL
|
|||||||
index.js --> module-utl.js
|
index.js --> module-utl.js
|
||||||
`,
|
`,
|
||||||
{ htmlLabels: true, flowchart: { htmlLabels: true }, securityLevel: 'loose' }
|
{ htmlLabels: true, flowchart: { htmlLabels: true }, securityLevel: 'loose' }
|
||||||
)
|
);
|
||||||
})
|
});
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user