Skip to content

Commit

Permalink
Merge branch 'develop' into sidv/e2eCI
Browse files Browse the repository at this point in the history
* develop: (44 commits)
  Update docs
  Add `workflow_dispatch` to lint.yml
  chore: update docs folder
  lint
  fix typescript error
  fix(docs): build the docs
  fix(docs): remove duplicate section
  chore(deps): update all non-major dependencies
  Update docs/misc/integrations.md
  Add links to github atom add-ons
  remove links from atom.io; add note Atom has been archived
  set svg role to 'graphics-document document'
  common function for a11y; add to renderAsync; + renderAsync spec
  feat: add links to theme listing
  fix cspell
  fix cspell
  fix lint
  refactor theming doc
  remove typeof
  use camelCase
  ...
  • Loading branch information
sidharthv96 committed Dec 15, 2022
2 parents 579536a + d6fad1b commit 2777ed2
Show file tree
Hide file tree
Showing 58 changed files with 1,899 additions and 1,637 deletions.
1 change: 1 addition & 0 deletions .github/workflows/lint.yml
Expand Up @@ -7,6 +7,7 @@ on:
- opened
- synchronize
- ready_for_review
workflow_dispatch:

permissions:
contents: write
Expand Down
21 changes: 21 additions & 0 deletions __mocks__/c4Renderer.js
@@ -0,0 +1,21 @@
/**
* Mocked C4Context diagram renderer
*/

import { vi } from 'vitest';

export const drawPersonOrSystemArray = vi.fn();
export const drawBoundary = vi.fn();

export const setConf = vi.fn();

export const draw = vi.fn().mockImplementation(() => {
return '';
});

export default {
drawPersonOrSystemArray,
drawBoundary,
setConf,
draw,
};
16 changes: 16 additions & 0 deletions __mocks__/classRenderer-v2.js
@@ -0,0 +1,16 @@
/**
* Mocked class diagram v2 renderer
*/

import { vi } from 'vitest';

export const setConf = vi.fn();

export const draw = vi.fn().mockImplementation(() => {
return '';
});

export default {
setConf,
draw,
};
13 changes: 13 additions & 0 deletions __mocks__/classRenderer.js
@@ -0,0 +1,13 @@
/**
* Mocked class diagram renderer
*/

import { vi } from 'vitest';

export const draw = vi.fn().mockImplementation(() => {
return '';
});

export default {
draw,
};
71 changes: 3 additions & 68 deletions __mocks__/d3.ts
@@ -1,79 +1,14 @@
// @ts-nocheck TODO: Fix TS
import { vi } from 'vitest';

const NewD3 = function () {
/**
*
*/
function returnThis() {
return this;
}
return {
append: function () {
return NewD3();
},
lower: returnThis,
attr: returnThis,
style: returnThis,
text: returnThis,
0: {
0: {
getBBox: function () {
return {
height: 10,
width: 20,
};
},
},
},
};
};
import { MockedD3 } from '../packages/mermaid/src/tests/MockedD3';

export const select = function () {
return new NewD3();
return new MockedD3();
};

export const selectAll = function () {
return new NewD3();
return new MockedD3();
};

export const curveBasis = 'basis';
export const curveLinear = 'linear';
export const curveCardinal = 'cardinal';

export const MockD3 = (name, parent) => {
const children = [];
const elem = {
get __children() {
return children;
},
get __name() {
return name;
},
get __parent() {
return parent;
},
node() {
return {
getBBox() {
return {
x: 5,
y: 10,
height: 15,
width: 20,
};
},
};
},
};
elem.append = (name) => {
const mockElem = MockD3(name, elem);
children.push(mockElem);
return mockElem;
};
elem.lower = vi.fn(() => elem);
elem.attr = vi.fn(() => elem);
elem.text = vi.fn(() => elem);
elem.style = vi.fn(() => elem);
return elem;
};
16 changes: 16 additions & 0 deletions __mocks__/erRenderer.js
@@ -0,0 +1,16 @@
/**
* Mocked er diagram renderer
*/

import { vi } from 'vitest';

export const setConf = vi.fn();

export const draw = vi.fn().mockImplementation(() => {
return '';
});

export default {
setConf,
draw,
};
24 changes: 24 additions & 0 deletions __mocks__/flowRenderer-v2.js
@@ -0,0 +1,24 @@
/**
* Mocked flow (flowchart) diagram v2 renderer
*/

import { vi } from 'vitest';

export const setConf = vi.fn();
export const addVertices = vi.fn();
export const addEdges = vi.fn();
export const getClasses = vi.fn().mockImplementation(() => {
return {};
});

export const draw = vi.fn().mockImplementation(() => {
return '';
});

export default {
setConf,
addVertices,
addEdges,
getClasses,
draw,
};
16 changes: 16 additions & 0 deletions __mocks__/ganttRenderer.js
@@ -0,0 +1,16 @@
/**
* Mocked gantt diagram renderer
*/

import { vi } from 'vitest';

export const setConf = vi.fn();

export const draw = vi.fn().mockImplementation(() => {
return '';
});

export default {
setConf,
draw,
};
13 changes: 13 additions & 0 deletions __mocks__/gitGraphRenderer.js
@@ -0,0 +1,13 @@
/**
* Mocked git (graph) diagram renderer
*/

import { vi } from 'vitest';

export const draw = vi.fn().mockImplementation(() => {
return '';
});

export default {
draw,
};
15 changes: 15 additions & 0 deletions __mocks__/journeyRenderer.js
@@ -0,0 +1,15 @@
/**
* Mocked pie (picChart) diagram renderer
*/

import { vi } from 'vitest';
export const setConf = vi.fn();

export const draw = vi.fn().mockImplementation(() => {
return '';
});

export default {
setConf,
draw,
};
13 changes: 13 additions & 0 deletions __mocks__/pieRenderer.js
@@ -0,0 +1,13 @@
/**
* Mocked pie (picChart) diagram renderer
*/

import { vi } from 'vitest';

export const draw = vi.fn().mockImplementation(() => {
return '';
});

export default {
draw,
};
13 changes: 13 additions & 0 deletions __mocks__/requirementRenderer.js
@@ -0,0 +1,13 @@
/**
* Mocked requirement diagram renderer
*/

import { vi } from 'vitest';

export const draw = vi.fn().mockImplementation(() => {
return '';
});

export default {
draw,
};
23 changes: 23 additions & 0 deletions __mocks__/sequenceRenderer.js
@@ -0,0 +1,23 @@
/**
* Mocked sequence diagram renderer
*/

import { vi } from 'vitest';

export const bounds = vi.fn();
export const drawActors = vi.fn();
export const drawActorsPopup = vi.fn();

export const setConf = vi.fn();

export const draw = vi.fn().mockImplementation(() => {
return '';
});

export default {
bounds,
drawActors,
drawActorsPopup,
setConf,
draw,
};
22 changes: 22 additions & 0 deletions __mocks__/stateRenderer-v2.js
@@ -0,0 +1,22 @@
/**
* Mocked state diagram v2 renderer
*/

import { vi } from 'vitest';

export const setConf = vi.fn();
export const getClasses = vi.fn().mockImplementation(() => {
return {};
});
export const stateDomId = vi.fn().mockImplementation(() => {
return 'mocked-stateDiagram-stateDomId';
});
export const draw = vi.fn().mockImplementation(() => {
return '';
});

export default {
setConf,
getClasses,
draw,
};
3 changes: 3 additions & 0 deletions cSpell.json
Expand Up @@ -68,7 +68,10 @@
"pnpm",
"podlite",
"ranksep",
"rect",
"rects",
"redmine",
"roledescription",
"sandboxed",
"setupgraphviewbox",
"shiki",
Expand Down
32 changes: 0 additions & 32 deletions cypress/integration/rendering/gantt.spec.js
Expand Up @@ -316,38 +316,6 @@ describe('Gantt diagram', () => {
);
});

it('should render accessibility tags', function () {
const expectedTitle = 'Gantt Diagram';
const expectedAccDescription = 'Tasks for Q4';
renderGraph(
`
gantt
accTitle: ${expectedTitle}
accDescr: ${expectedAccDescription}
dateFormat YYYY-MM-DD
section Section
A task :a1, 2014-01-01, 30d
`,
{}
);
cy.get('svg').should((svg) => {
const el = svg.get(0);
const children = [...el.children];

const titleEl = children.find(function (node) {
return node.tagName === 'title';
});
const descriptionEl = children.find(function (node) {
return node.tagName === 'desc';
});

expect(titleEl).to.exist;
expect(titleEl.textContent).to.equal(expectedTitle);
expect(descriptionEl).to.exist;
expect(descriptionEl.textContent).to.equal(expectedAccDescription);
});
});

it('should render a gantt diagram with tick is 15 minutes', () => {
imgSnapshotTest(
`
Expand Down

0 comments on commit 2777ed2

Please sign in to comment.