removed eslint-ignore statements

This commit is contained in:
devcer
2022-10-17 09:33:01 +05:30
7 changed files with 36 additions and 43 deletions

View File

@@ -1,3 +1,4 @@
/* eslint-disable @cspell/spellchecker */
// eslint-disable-next-line @typescript-eslint/no-var-requires // eslint-disable-next-line @typescript-eslint/no-var-requires
const { defineConfig } = require('cypress'); const { defineConfig } = require('cypress');

View File

@@ -53,7 +53,12 @@
"bbox", "bbox",
"techn", "techn",
"cytoscape", "cytoscape",
"ts-nocheck" "Lucida",
"Bilkent",
"cpettitt",
"antiscript",
"ts-nocheck",
"setupGraphViewbox"
], ],
"patterns": [ "patterns": [
{ {

View File

@@ -21,7 +21,7 @@ describe('Git Graph diagram', () => {
// // Call Open on eyes to initialize a test session // // Call Open on eyes to initialize a test session
// cy.eyesOpen({ // cy.eyesOpen({
// appName: 'Demo App', // appName: 'Demo App',
// testName: 'Ultrafast grid demo', // testName: 'UltraFast grid demo',
// }); // });
// // check the login page with fluent api, see more info here // // check the login page with fluent api, see more info here

View File

@@ -119,13 +119,11 @@ const config: Partial<MermaidConfig> = {
/** /**
* This option controls if the generated ids of nodes in the SVG are generated randomly or based * This option controls if the generated ids of nodes in the SVG are generated randomly or based
* on a seed. If set to false, the IDs are generated based on the current date and thus are not * on a seed. If set to false, the IDs are generated based on the current date and thus are not
// eslint-disable-next-line @cspell/spellchecker * deterministic. This is the default behavior.
* deterministic. This is the default behaviour.
* *
* **Notes**: * **Notes**:
* *
// eslint-disable-next-line @cspell/spellchecker * This matters if your files are checked into source control e.g. git and should not change unless
* This matters if your files are checked into sourcecontrol e.g. git and should not change unless
* content is changed. * content is changed.
* *
* Default value: false * Default value: false
@@ -635,9 +633,9 @@ const config: Partial<MermaidConfig> = {
numberSectionStyles: 4, numberSectionStyles: 4,
/** /**
* | Parameter | Description | Type | Required | Values | * | Parameter | Description | Type | Required | Values |
* | ---------- | --------------------------- | ---- | -------- | ---------------- | * | ---------- | ---------------------------- | ---- | -------- | ---------------- |
* | axisFormat | Datetime format of the axis | 3 | Required | Date in yy-mm-dd | * | axisFormat | Date/time format of the axis | 3 | Required | Date in yy-mm-dd |
* *
* **Notes:** * **Notes:**
* *

View File

@@ -65,17 +65,6 @@ describe('when parsing a gantt diagram it', function () {
expect(parserFnConstructor(str)).not.toThrow(); expect(parserFnConstructor(str)).not.toThrow();
}); });
/**
* Beslutsflöde inligt nedan. Obs bla bla bla
*
* graph TD
* A[Hard pledge] -- text on link -->B(Round edge)
* B --> C{to do or not to do}
* C -->|Too| D[Result one]
* C -->|Doo| E[Result two]
*
* Params bapa - a unique bapap
*/
it('should handle a task definition', function () { it('should handle a task definition', function () {
const str = const str =
'gantt\n' + 'gantt\n' +

View File

@@ -130,7 +130,7 @@ Note right of Bob: Bob thinks
Bob-->Alice: I am good thanks!`; Bob-->Alice: I am good thanks!`;
mermaidAPI.parse(str); mermaidAPI.parse(str);
diagram.renderer.draw(str, 'tst', '1.2.3', diagram); // needs to be rendered for the correct value of visibility autonumbers diagram.renderer.draw(str, 'tst', '1.2.3', diagram); // needs to be rendered for the correct value of visibility auto numbers
expect(diagram.db.showSequenceNumbers()).toBe(false); expect(diagram.db.showSequenceNumbers()).toBe(false);
}); });
it('should show sequence numbers when autonumber is enabled', function () { it('should show sequence numbers when autonumber is enabled', function () {
@@ -142,7 +142,7 @@ Note right of Bob: Bob thinks
Bob-->Alice: I am good thanks!`; Bob-->Alice: I am good thanks!`;
mermaidAPI.parse(str); mermaidAPI.parse(str);
diagram.renderer.draw(str, 'tst', '1.2.3', diagram); // needs to be rendered for the correct value of visibility autonumbers diagram.renderer.draw(str, 'tst', '1.2.3', diagram); // needs to be rendered for the correct value of visibility auto numbers
expect(diagram.db.showSequenceNumbers()).toBe(true); expect(diagram.db.showSequenceNumbers()).toBe(true);
}); });
it('should handle a sequenceDiagram definition with a title:', function () { it('should handle a sequenceDiagram definition with a title:', function () {
@@ -1871,7 +1871,7 @@ Note right of Bob: Bob thinks
Bob-->Alice: I am good thanks!`; Bob-->Alice: I am good thanks!`;
mermaidAPI.parse(str1, diagram); mermaidAPI.parse(str1, diagram);
diagram.renderer.draw(str1, 'tst', '1.2.3', diagram); // needs to be rendered for the correct value of visibility autonumbers diagram.renderer.draw(str1, 'tst', '1.2.3', diagram); // needs to be rendered for the correct value of visibility auto numbers
expect(diagram.db.showSequenceNumbers()).toBe(true); expect(diagram.db.showSequenceNumbers()).toBe(true);
const str2 = ` const str2 = `

View File

@@ -292,15 +292,15 @@ const boundMessage = function (diagram, msgModel) {
bounds.bumpVerticalPos(lineHeight); bounds.bumpVerticalPos(lineHeight);
let lineStarty; let lineStartY;
let totalOffset = textDims.height - 10; let totalOffset = textDims.height - 10;
const textWidth = textDims.width; const textWidth = textDims.width;
if (startx === stopx) { if (startx === stopx) {
lineStarty = bounds.getVerticalPos() + totalOffset; lineStartY = bounds.getVerticalPos() + totalOffset;
if (!conf.rightAngles) { if (!conf.rightAngles) {
totalOffset += conf.boxMargin; totalOffset += conf.boxMargin;
lineStarty = bounds.getVerticalPos() + totalOffset; lineStartY = bounds.getVerticalPos() + totalOffset;
} }
totalOffset += 30; totalOffset += 30;
const dx = Math.max(textWidth / 2, conf.width / 2); const dx = Math.max(textWidth / 2, conf.width / 2);
@@ -312,15 +312,15 @@ const boundMessage = function (diagram, msgModel) {
); );
} else { } else {
totalOffset += conf.boxMargin; totalOffset += conf.boxMargin;
lineStarty = bounds.getVerticalPos() + totalOffset; lineStartY = bounds.getVerticalPos() + totalOffset;
bounds.insert(startx, lineStarty - 10, stopx, lineStarty); bounds.insert(startx, lineStartY - 10, stopx, lineStartY);
} }
bounds.bumpVerticalPos(totalOffset); bounds.bumpVerticalPos(totalOffset);
msgModel.height += totalOffset; msgModel.height += totalOffset;
msgModel.stopy = msgModel.starty + msgModel.height; msgModel.stopy = msgModel.starty + msgModel.height;
bounds.insert(msgModel.fromBounds, msgModel.starty, msgModel.toBounds, msgModel.stopy); bounds.insert(msgModel.fromBounds, msgModel.starty, msgModel.toBounds, msgModel.stopy);
return lineStarty; return lineStartY;
}; };
/** /**
@@ -328,10 +328,10 @@ const boundMessage = function (diagram, msgModel) {
* *
* @param {any} diagram - The parent of the message element * @param {any} diagram - The parent of the message element
* @param {any} msgModel - The model containing fields describing a message * @param {any} msgModel - The model containing fields describing a message
* @param {number} lineStarty - The Y coordinate at which the message line starts * @param {number} lineStartY - The Y coordinate at which the message line starts
* @param diagObj * @param diagObj
*/ */
const drawMessage = function (diagram, msgModel, lineStarty, diagObj) { const drawMessage = function (diagram, msgModel, lineStartY, diagObj) {
const { startx, stopx, starty, message, type, sequenceIndex, sequenceVisible } = msgModel; const { startx, stopx, starty, message, type, sequenceIndex, sequenceVisible } = msgModel;
const textDims = utils.calculateTextDimensions(message, messageFont(conf)); const textDims = utils.calculateTextDimensions(message, messageFont(conf));
const textObj = svgDraw.getTextObj(); const textObj = svgDraw.getTextObj();
@@ -360,8 +360,8 @@ const drawMessage = function (diagram, msgModel, lineStarty, diagObj) {
.append('path') .append('path')
.attr( .attr(
'd', 'd',
`M ${startx},${lineStarty} H ${startx + Math.max(conf.width / 2, textWidth / 2)} V ${ `M ${startx},${lineStartY} H ${startx + Math.max(conf.width / 2, textWidth / 2)} V ${
lineStarty + 25 lineStartY + 25
} H ${startx}` } H ${startx}`
); );
} else { } else {
@@ -372,27 +372,27 @@ const drawMessage = function (diagram, msgModel, lineStarty, diagObj) {
'M ' + 'M ' +
startx + startx +
',' + ',' +
lineStarty + lineStartY +
' C ' + ' C ' +
(startx + 60) + (startx + 60) +
',' + ',' +
(lineStarty - 10) + (lineStartY - 10) +
' ' + ' ' +
(startx + 60) + (startx + 60) +
',' + ',' +
(lineStarty + 30) + (lineStartY + 30) +
' ' + ' ' +
startx + startx +
',' + ',' +
(lineStarty + 20) (lineStartY + 20)
); );
} }
} else { } else {
line = diagram.append('line'); line = diagram.append('line');
line.attr('x1', startx); line.attr('x1', startx);
line.attr('y1', lineStarty); line.attr('y1', lineStartY);
line.attr('x2', stopx); line.attr('x2', stopx);
line.attr('y2', lineStarty); line.attr('y2', lineStartY);
} }
// Make an SVG Container // Make an SVG Container
// Draw the line // Draw the line
@@ -440,7 +440,7 @@ const drawMessage = function (diagram, msgModel, lineStarty, diagObj) {
diagram diagram
.append('text') .append('text')
.attr('x', startx) .attr('x', startx)
.attr('y', lineStarty + 4) .attr('y', lineStartY + 4)
.attr('font-family', 'sans-serif') .attr('font-family', 'sans-serif')
.attr('font-size', '12px') .attr('font-size', '12px')
.attr('text-anchor', 'middle') .attr('text-anchor', 'middle')
@@ -811,8 +811,8 @@ export const draw = function (_text, id, _version, diagObj) {
msgModel.starty = bounds.getVerticalPos(); msgModel.starty = bounds.getVerticalPos();
msgModel.sequenceIndex = sequenceIndex; msgModel.sequenceIndex = sequenceIndex;
msgModel.sequenceVisible = diagObj.db.showSequenceNumbers(); msgModel.sequenceVisible = diagObj.db.showSequenceNumbers();
const lineStarty = boundMessage(diagram, msgModel); const lineStartY = boundMessage(diagram, msgModel);
messagesToDraw.push({ messageModel: msgModel, lineStarty: lineStarty }); messagesToDraw.push({ messageModel: msgModel, lineStartY: lineStartY });
bounds.models.addMessage(msgModel); bounds.models.addMessage(msgModel);
} catch (e) { } catch (e) {
log.error('error while drawing message', e); log.error('error while drawing message', e);
@@ -836,7 +836,7 @@ export const draw = function (_text, id, _version, diagObj) {
} }
}); });
messagesToDraw.forEach((e) => drawMessage(diagram, e.messageModel, e.lineStarty, diagObj)); messagesToDraw.forEach((e) => drawMessage(diagram, e.messageModel, e.lineStartY, diagObj));
if (conf.mirrorActors) { if (conf.mirrorActors) {
// Draw actors below diagram // Draw actors below diagram