Skip to content

Commit

Permalink
Merge branch 'develop' into sidv/typescript
Browse files Browse the repository at this point in the history
* develop:
  chore(deps-dev): bump @commitlint/cli from 17.0.3 to 17.1.1 (#3376)
  chore(deps-dev): bump eslint from 8.22.0 to 8.23.0 (#3378)
  chore(deps): bump dompurify from 2.3.10 to 2.4.0 (#3375)
  chore(deps-dev): bump @commitlint/config-conventional (#3370)
  chore(deps-dev): bump @babel/core from 7.18.10 to 7.18.13 (#3373)
  chore(deps-dev): bump eslint-plugin-jest from 26.8.7 to 27.0.1 (#3372)
  chore(deps-dev): bump jest-environment-jsdom from 28.1.3 to 29.0.1 (#3369)
  chore(deps-dev): bump babel-jest from 28.1.3 to 29.0.1 (#3368)
  Updating docs to latest mermaid version
  build: add eslint --cache file
  Adjusting size and test
  Updated viewBox settings
  Border
  feat(git): allow custom merge commit ids
  Document line curve options
  Added 'ms' duration
  Fix font weight for messages in sequence diagrams
  Added lollipop feature for updated codebase
  • Loading branch information
sidharthv96 committed Aug 31, 2022
2 parents a3dfc4c + 5b63260 commit 9b319a5
Show file tree
Hide file tree
Showing 36 changed files with 718 additions and 335 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,7 @@ Gemfile.lock
/.vs

cypress/screenshots/
cypress/snapshots/
cypress/snapshots/

# eslint --cache file
.eslintcache
18 changes: 9 additions & 9 deletions cypress/integration/rendering/erDiagram.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ describe('Entity Relationship Diagram', () => {
);
cy.get('svg').should((svg) => {
expect(svg).to.have.attr('width', '100%');
expect(svg).to.have.attr('height', '465');
// expect(svg).to.have.attr('height', '465');
const style = svg.attr('style');
expect(style).to.match(/^max-width: [\d.]+px;$/);
const maxWidthValue = parseFloat(style.match(/[\d.]+/g).join(''));
Expand All @@ -134,7 +134,7 @@ describe('Entity Relationship Diagram', () => {
const width = parseFloat(svg.attr('width'));
// use within because the absolute value can be slightly different depending on the environment ±5%
expect(width).to.be.within(140 * 0.95, 140 * 1.05);
expect(svg).to.have.attr('height', '465');
// expect(svg).to.have.attr('height', '465');
expect(svg).to.not.have.attr('style');
});
});
Expand Down Expand Up @@ -186,7 +186,7 @@ describe('Entity Relationship Diagram', () => {
renderGraph(
`
erDiagram
PRIVATE_FINANCIAL_INSTITUTION {
PRIVATE_FINANCIAL_INSTITUTION {
string name
int turnover
}
Expand All @@ -206,9 +206,9 @@ describe('Entity Relationship Diagram', () => {
string name PK
}
AUTHOR_WITH_LONG_ENTITY_NAME }|..|{ BOOK : writes
BOOK {
BOOK {
float price
string author FK
string author FK
string title PK
}
`,
Expand All @@ -225,8 +225,8 @@ describe('Entity Relationship Diagram', () => {
string name "comment"
}
AUTHOR_WITH_LONG_ENTITY_NAME }|..|{ BOOK : writes
BOOK {
string author
BOOK {
string author
string title "author comment"
float price "price comment"
}
Expand All @@ -244,11 +244,11 @@ describe('Entity Relationship Diagram', () => {
string name PK "comment"
}
AUTHOR_WITH_LONG_ENTITY_NAME }|..|{ BOOK : writes
BOOK {
BOOK {
string description
float price "price comment"
string title PK "title comment"
string author FK
string author FK
}
`,
{ logLevel: 1 }
Expand Down
25 changes: 18 additions & 7 deletions cypress/integration/rendering/flowchart-v2.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ describe('Flowchart v2', () => {
P3 --> P6
P1.5 --> P5
`,
{ flowchart: { diagramPadding: 0 } }
{}
);
});

Expand All @@ -60,7 +60,7 @@ describe('Flowchart v2', () => {
C <-...-> E4
C ======> E5
`,
{ flowchart: { diagramPadding: 0 } }
{}
);
});
it('5: should render escaped without html labels', () => {
Expand Down Expand Up @@ -92,10 +92,10 @@ describe('Flowchart v2', () => {
);
cy.get('svg').should((svg) => {
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%
const height = parseFloat(svg.attr('height'));
expect(height).to.be.within(446 * 0.95, 446 * 1.05);
// const height = parseFloat(svg.attr('height'));
// expect(height).to.be.within(446 * 0.95, 446 * 1.05);
const style = svg.attr('style');
expect(style).to.match(/^max-width: [\d.]+px;$/);
const maxWidthValue = parseFloat(style.match(/[\d.]+/g).join(''));
Expand All @@ -114,10 +114,10 @@ describe('Flowchart v2', () => {
{ flowchart: { useMaxWidth: false } }
);
cy.get('svg').should((svg) => {
const height = parseFloat(svg.attr('height'));
// const height = parseFloat(svg.attr('height'));
const width = parseFloat(svg.attr('width'));
// use within because the absolute value can be slightly different depending on the environment ±5%
expect(height).to.be.within(446 * 0.95, 446 * 1.05);
// expect(height).to.be.within(446 * 0.95, 446 * 1.05);
expect(width).to.be.within(290 * 0.95 - 1, 290 * 1.05);
expect(svg).to.not.have.attr('style');
});
Expand Down Expand Up @@ -652,4 +652,15 @@ flowchart RL
{ htmlLabels: true, flowchart: { htmlLabels: true }, securityLevel: 'loose' }
);
});
it('2824: Clipping of edges', () => {
imgSnapshotTest(
`
flowchart TD
A --> B
A --> C
B --> C
`,
{ htmlLabels: true, flowchart: { htmlLabels: true }, securityLevel: 'loose' }
);
});
});
10 changes: 5 additions & 5 deletions cypress/integration/rendering/flowchart.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -744,10 +744,10 @@ describe('Graph', () => {
);
cy.get('svg').should((svg) => {
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%
const height = parseFloat(svg.attr('height'));
expect(height).to.be.within(446 * 0.95, 446 * 1.05);
// const height = parseFloat(svg.attr('height'));
// expect(height).to.be.within(446 * 0.95, 446 * 1.05);
const style = svg.attr('style');
expect(style).to.match(/^max-width: [\d.]+px;$/);
const maxWidthValue = parseFloat(style.match(/[\d.]+/g).join(''));
Expand All @@ -766,10 +766,10 @@ describe('Graph', () => {
{ flowchart: { useMaxWidth: false } }
);
cy.get('svg').should((svg) => {
const height = parseFloat(svg.attr('height'));
// const height = parseFloat(svg.attr('height'));
const width = parseFloat(svg.attr('width'));
// use within because the absolute value can be slightly different depending on the environment ±5%
expect(height).to.be.within(446 * 0.95, 446 * 1.05);
// expect(height).to.be.within(446 * 0.95, 446 * 1.05);
expect(width).to.be.within(300 * 0.95, 300 * 1.05);
expect(svg).to.not.have.attr('style');
});
Expand Down
28 changes: 23 additions & 5 deletions cypress/integration/rendering/gantt.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,24 @@ describe('Gantt diagram', () => {
);
});

it('should handle milliseconds', () => {
imgSnapshotTest(
`
gantt
title A Gantt Diagram
dateFormat x
axisFormat %L
section Section
A task :a1, 0, 30ms
Another task :after a1, 20ms
section Another
Another another task :b1, 20, 12ms
Another another another task :after b1, 24ms
`,
{}
);
});

it('should render a gantt diagram when useMaxWidth is true (default)', () => {
renderGraph(
`
Expand Down Expand Up @@ -200,10 +218,10 @@ describe('Gantt diagram', () => {
);
cy.get('svg').should((svg) => {
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%
const height = parseFloat(svg.attr('height'));
expect(height).to.be.within(484 * 0.95, 484 * 1.05);
// const height = parseFloat(svg.attr('height'));
// expect(height).to.be.within(484 * 0.95, 484 * 1.05);
const style = svg.attr('style');
expect(style).to.match(/^max-width: [\d.]+px;$/);
const maxWidthValue = parseFloat(style.match(/[\d.]+/g).join(''));
Expand Down Expand Up @@ -247,10 +265,10 @@ describe('Gantt diagram', () => {
{ gantt: { useMaxWidth: false } }
);
cy.get('svg').should((svg) => {
const height = parseFloat(svg.attr('height'));
// const height = parseFloat(svg.attr('height'));
const width = parseFloat(svg.attr('width'));
// 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(svg).to.not.have.attr('style');
});
Expand Down
4 changes: 2 additions & 2 deletions cypress/integration/rendering/gitGraph.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ describe('Git Graph diagram', () => {
{}
);
});
it('7: should render a simple gitgraph with three branches and merge commit', () => {
it('7: should render a simple gitgraph with three branches and tagged merge commit', () => {
imgSnapshotTest(
`gitGraph
commit id: "1"
Expand All @@ -93,7 +93,7 @@ describe('Git Graph diagram', () => {
checkout nice_feature
commit id: "7"
checkout main
merge nice_feature
merge nice_feature id: "12345" tag: "my merge commit"
checkout very_nice_feature
commit id: "8"
checkout main
Expand Down
4 changes: 2 additions & 2 deletions cypress/integration/rendering/journey.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ section Checkout from website
cy.get('svg').should((svg) => {
expect(svg).to.have.attr('width', '100%');
expect(svg).to.have.attr('height');
const height = parseFloat(svg.attr('height'));
expect(height).to.eq(565);
// const height = parseFloat(svg.attr('height'));
// expect(height).to.eq(565);
const style = svg.attr('style');
expect(style).to.match(/^max-width: [\d.]+px;$/);
const maxWidthValue = parseFloat(style.match(/[\d.]+/g).join(''));
Expand Down
10 changes: 5 additions & 5 deletions cypress/integration/rendering/pie.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ describe('Pie Chart', () => {
);
cy.get('svg').should((svg) => {
expect(svg).to.have.attr('width', '100%');
expect(svg).to.have.attr('height');
const height = parseFloat(svg.attr('height'));
expect(height).to.eq(450);
// expect(svg).to.have.attr('height');
// const height = parseFloat(svg.attr('height'));
// expect(height).to.eq(450);
const style = svg.attr('style');
expect(style).to.match(/^max-width: [\d.]+px;$/);
const maxWidthValue = parseFloat(style.match(/[\d.]+/g).join(''));
Expand All @@ -68,9 +68,9 @@ describe('Pie Chart', () => {
{ pie: { useMaxWidth: false } }
);
cy.get('svg').should((svg) => {
const height = parseFloat(svg.attr('height'));
// const height = parseFloat(svg.attr('height'));
const width = parseFloat(svg.attr('width'));
expect(height).to.eq(450);
// expect(height).to.eq(450);
expect(width).to.eq(984);
expect(svg).to.not.have.attr('style');
});
Expand Down
10 changes: 5 additions & 5 deletions cypress/integration/rendering/sequencediagram.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -734,9 +734,9 @@ context('Sequence diagram', () => {
);
cy.get('svg').should((svg) => {
expect(svg).to.have.attr('width', '100%');
expect(svg).to.have.attr('height');
const height = parseFloat(svg.attr('height'));
expect(height).to.be.within(920, 971);
// expect(svg).to.have.attr('height');
// const height = parseFloat(svg.attr('height'));
// expect(height).to.be.within(920, 971);
const style = svg.attr('style');
expect(style).to.match(/^max-width: [\d.]+px;$/);
const maxWidthValue = parseFloat(style.match(/[\d.]+/g).join(''));
Expand Down Expand Up @@ -773,9 +773,9 @@ context('Sequence diagram', () => {
{ sequence: { useMaxWidth: false } }
);
cy.get('svg').should((svg) => {
const height = parseFloat(svg.attr('height'));
// const height = parseFloat(svg.attr('height'));
const width = parseFloat(svg.attr('width'));
expect(height).to.be.within(920, 971);
// expect(height).to.be.within(920, 971);
// use within because the absolute value can be slightly different depending on the environment ±5%
expect(width).to.be.within(820 * 0.95, 820 * 1.05);
expect(svg).to.not.have.attr('style');
Expand Down
14 changes: 7 additions & 7 deletions cypress/integration/rendering/stateDiagram-v2.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -480,14 +480,14 @@ stateDiagram-v2
);
cy.get('svg').should((svg) => {
expect(svg).to.have.attr('width', '100%');
expect(svg).to.have.attr('height');
const height = parseFloat(svg.attr('height'));
expect(height).to.be.within(177, 178);
// expect(svg).to.have.attr('height');
// const height = parseFloat(svg.attr('height'));
// expect(height).to.be.within(177, 178);
const style = svg.attr('style');
expect(style).to.match(/^max-width: [\d.]+px;$/);
const maxWidthValue = parseFloat(style.match(/[\d.]+/g).join(''));
// 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', () => {
Expand All @@ -501,11 +501,11 @@ stateDiagram-v2
{ state: { useMaxWidth: false } }
);
cy.get('svg').should((svg) => {
const height = parseFloat(svg.attr('height'));
// const height = parseFloat(svg.attr('height'));
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%
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');
});
});
Expand Down
14 changes: 7 additions & 7 deletions cypress/integration/rendering/stateDiagram.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -357,16 +357,16 @@ describe('State diagram', () => {
);
cy.get('svg').should((svg) => {
expect(svg).to.have.attr('width', '100%');
expect(svg).to.have.attr('height');
const height = parseFloat(svg.attr('height'));
expect(height).to.be.within(176, 178);
// expect(svg).to.have.attr('height');
// const height = parseFloat(svg.attr('height'));
// expect(height).to.be.within(176, 178);
const style = svg.attr('style');
expect(style).to.match(/^max-width: [\d.]+px;$/);
const maxWidthValue = parseFloat(style.match(/[\d.]+/g).join(''));
// use within because the absolute value can be slightly different depending on the environment ±5%
// Todo investigate difference
// 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', () => {
Expand All @@ -379,13 +379,13 @@ describe('State diagram', () => {
{ state: { useMaxWidth: false } }
);
cy.get('svg').should((svg) => {
const height = parseFloat(svg.attr('height'));
// const height = parseFloat(svg.attr('height'));
const width = parseFloat(svg.attr('width'));
expect(height).to.be.within(176, 178);
// expect(height).to.be.within(176, 178);
// use within because the absolute value can be slightly different depending on the environment ±5%
// Todo investigate difference
// 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');
});
Expand Down
Loading

0 comments on commit 9b319a5

Please sign in to comment.