mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-22 16:59:48 +02:00
Merge branch 'develop' of github.com:mermaid-js/mermaid into develop
This commit is contained in:
13
.github/dependabot.yml
vendored
Normal file
13
.github/dependabot.yml
vendored
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
version: 2
|
||||||
|
|
||||||
|
updates:
|
||||||
|
- package-ecosystem: npm
|
||||||
|
directory: /
|
||||||
|
target-branch: develop
|
||||||
|
schedule:
|
||||||
|
interval: daily
|
||||||
|
- package-ecosystem: github-actions
|
||||||
|
directory: /
|
||||||
|
target-branch: develop
|
||||||
|
schedule:
|
||||||
|
interval: daily
|
1
.github/pr-labeler.yml
vendored
1
.github/pr-labeler.yml
vendored
@@ -1,3 +1,4 @@
|
|||||||
'Type: Bug / Error': 'bug/*'
|
'Type: Bug / Error': 'bug/*'
|
||||||
'Type: Enhancement': 'feature/*'
|
'Type: Enhancement': 'feature/*'
|
||||||
'Type: Other': 'other/*'
|
'Type: Other': 'other/*'
|
||||||
|
'Type: Dependabot': 'dependabot/*'
|
||||||
|
@@ -74,7 +74,7 @@ To start working with the e2e tests:
|
|||||||
|
|
||||||
The rendering tests are very straightforward to create. There is a function `imgSnapshotTest`, which takes a diagram in text form and the mermaid options, and it renders that diagram in Cypress.
|
The rendering tests are very straightforward to create. There is a function `imgSnapshotTest`, which takes a diagram in text form and the mermaid options, and it renders that diagram in Cypress.
|
||||||
|
|
||||||
When running in CI it will take a snapshot of the rendered diagram and compare it with the snapshot from last build and flag for review it if it differs.
|
When running in CI it will take a snapshot of the rendered diagram and compare it with the snapshot from last build and flag it for review if it differs.
|
||||||
|
|
||||||
This is what a rendering test looks like:
|
This is what a rendering test looks like:
|
||||||
|
|
||||||
|
@@ -78,7 +78,7 @@ const init = function() {
|
|||||||
mermaidAPI.updateSiteConfig({ gantt: mermaid.ganttConfig });
|
mermaidAPI.updateSiteConfig({ gantt: mermaid.ganttConfig });
|
||||||
}
|
}
|
||||||
|
|
||||||
const idGeneratior = utils.initIdGeneratior(conf.deterministicIds, conf.deterministicIDSeed);
|
const idGeneratior = new utils.initIdGeneratior(conf.deterministicIds, conf.deterministicIDSeed);
|
||||||
|
|
||||||
let txt;
|
let txt;
|
||||||
|
|
||||||
|
22
src/utils.js
22
src/utils.js
@@ -793,17 +793,19 @@ export const configureSvgSize = function(svgElem, height, width, useMaxWidth) {
|
|||||||
d3Attrs(svgElem, attrs);
|
d3Attrs(svgElem, attrs);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const initIdGeneratior = function(deterministic, seed) {
|
export const initIdGeneratior = class iterator {
|
||||||
if (!deterministic) return { next: () => Date.now() };
|
constructor(deterministic, seed) {
|
||||||
class iterator {
|
this.deterministic = deterministic;
|
||||||
constructor() {
|
this.seed = seed;
|
||||||
return (this.count = seed ? seed.length : 0);
|
|
||||||
}
|
this.count = seed ? seed.length : 0;
|
||||||
next() {
|
}
|
||||||
return this.count++;
|
|
||||||
}
|
next() {
|
||||||
|
if (!this.deterministic) return Date.now();
|
||||||
|
|
||||||
|
return this.count++;
|
||||||
}
|
}
|
||||||
return new iterator();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
@@ -256,7 +256,7 @@ describe('when calculating SVG size', function() {
|
|||||||
|
|
||||||
describe('when initializing the id generator', function () {
|
describe('when initializing the id generator', function () {
|
||||||
it('should return a random number generator based on Date', function (done) {
|
it('should return a random number generator based on Date', function (done) {
|
||||||
const idGenerator = utils.initIdGeneratior(false)
|
const idGenerator = new utils.initIdGeneratior(false)
|
||||||
expect(typeof idGenerator.next).toEqual('function')
|
expect(typeof idGenerator.next).toEqual('function')
|
||||||
const lastId = idGenerator.next()
|
const lastId = idGenerator.next()
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
@@ -266,7 +266,7 @@ describe('when initializing the id generator', function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should return a non random number generator', function () {
|
it('should return a non random number generator', function () {
|
||||||
const idGenerator = utils.initIdGeneratior(true)
|
const idGenerator = new utils.initIdGeneratior(true)
|
||||||
expect(typeof idGenerator.next).toEqual('function')
|
expect(typeof idGenerator.next).toEqual('function')
|
||||||
const start = 0
|
const start = 0
|
||||||
const lastId = idGenerator.next()
|
const lastId = idGenerator.next()
|
||||||
@@ -275,7 +275,7 @@ describe('when initializing the id generator', function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should return a non random number generator based on seed', function () {
|
it('should return a non random number generator based on seed', function () {
|
||||||
const idGenerator = utils.initIdGeneratior(true, 'thisIsASeed')
|
const idGenerator = new utils.initIdGeneratior(true, 'thisIsASeed')
|
||||||
expect(typeof idGenerator.next).toEqual('function')
|
expect(typeof idGenerator.next).toEqual('function')
|
||||||
const start = 11
|
const start = 11
|
||||||
const lastId = idGenerator.next()
|
const lastId = idGenerator.next()
|
||||||
|
Reference in New Issue
Block a user