mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-02-04 07:13:25 +08:00
Fix for broken test
This commit is contained in:
parent
047e15951a
commit
646f76d343
5
V10-BreakingChanges.md
Normal file
5
V10-BreakingChanges.md
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
# A collection of updates that change the behaviour
|
||||||
|
|
||||||
|
## Lazy loading and asynchronisity
|
||||||
|
|
||||||
|
- Invalid dates are rendered as syntax error instead of returning best guess or the current date
|
@ -92,7 +92,7 @@ describe('Gantt diagram', () => {
|
|||||||
{}
|
{}
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
it('should render a gantt chart for issue #1060', () => {
|
it('should FAIL redering a gantt chart for issue #1060 with invalid date', () => {
|
||||||
imgSnapshotTest(
|
imgSnapshotTest(
|
||||||
`
|
`
|
||||||
gantt
|
gantt
|
||||||
|
@ -56,7 +56,7 @@
|
|||||||
<body>
|
<body>
|
||||||
<div>Security check</div>
|
<div>Security check</div>
|
||||||
<pre id="diagram" class="mermaid">
|
<pre id="diagram" class="mermaid">
|
||||||
classDiagram
|
classDiagram
|
||||||
direction LR
|
direction LR
|
||||||
class Student {
|
class Student {
|
||||||
-idCard : IdCard
|
-idCard : IdCard
|
||||||
|
@ -126,7 +126,6 @@
|
|||||||
"jsdom": "^20.0.1",
|
"jsdom": "^20.0.1",
|
||||||
"lint-staged": "^13.0.3",
|
"lint-staged": "^13.0.3",
|
||||||
"markdown-it": "^13.0.1",
|
"markdown-it": "^13.0.1",
|
||||||
"moment": "^2.23.0",
|
|
||||||
"path-browserify": "^1.0.1",
|
"path-browserify": "^1.0.1",
|
||||||
"pnpm": "^7.13.2",
|
"pnpm": "^7.13.2",
|
||||||
"prettier": "^2.7.1",
|
"prettier": "^2.7.1",
|
||||||
|
@ -372,11 +372,11 @@ const buildLegacyDisplay = function (text) {
|
|||||||
|
|
||||||
const parameters = text.substring(methodStart + 1, methodEnd);
|
const parameters = text.substring(methodStart + 1, methodEnd);
|
||||||
const classifier = text.substring(methodEnd + 1, 1);
|
const classifier = text.substring(methodEnd + 1, 1);
|
||||||
cssStyle = parseClassifier(classifier);
|
cssStyle = parseClassifier(text.substring(methodEnd + 1, methodEnd + 2));
|
||||||
|
|
||||||
displayText = visibility + methodName + '(' + parseGenericTypes(parameters.trim()) + ')';
|
displayText = visibility + methodName + '(' + parseGenericTypes(parameters.trim()) + ')';
|
||||||
|
|
||||||
if (methodEnd < memberText.length) {
|
if (methodEnd < text.length) {
|
||||||
returnType = text.substring(methodEnd + 2).trim();
|
returnType = text.substring(methodEnd + 2).trim();
|
||||||
if (returnType !== '') {
|
if (returnType !== '') {
|
||||||
returnType = ' : ' + parseGenericTypes(returnType);
|
returnType = ' : ' + parseGenericTypes(returnType);
|
||||||
|
@ -217,10 +217,12 @@ const getStartDate = function (prevTime, dateFormat, str) {
|
|||||||
} else {
|
} else {
|
||||||
log.debug('Invalid date:' + str);
|
log.debug('Invalid date:' + str);
|
||||||
log.debug('With date format:' + dateFormat.trim());
|
log.debug('With date format:' + dateFormat.trim());
|
||||||
|
const d = new Date(str);
|
||||||
|
if (typeof d === 'undefined' || isNaN(d.getTime())) {
|
||||||
|
throw new Error('Invalid date:' + str);
|
||||||
|
}
|
||||||
|
return d;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Default date - now
|
|
||||||
return new Date();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
2
pnpm-lock.yaml
generated
2
pnpm-lock.yaml
generated
@ -56,7 +56,6 @@ importers:
|
|||||||
lint-staged: ^13.0.3
|
lint-staged: ^13.0.3
|
||||||
lodash: ^4.17.21
|
lodash: ^4.17.21
|
||||||
markdown-it: ^13.0.1
|
markdown-it: ^13.0.1
|
||||||
moment: ^2.23.0
|
|
||||||
moment-mini: ^2.24.0
|
moment-mini: ^2.24.0
|
||||||
non-layered-tidy-tree-layout: ^2.0.2
|
non-layered-tidy-tree-layout: ^2.0.2
|
||||||
path-browserify: ^1.0.1
|
path-browserify: ^1.0.1
|
||||||
@ -133,7 +132,6 @@ importers:
|
|||||||
jsdom: 20.0.1
|
jsdom: 20.0.1
|
||||||
lint-staged: 13.0.3
|
lint-staged: 13.0.3
|
||||||
markdown-it: 13.0.1
|
markdown-it: 13.0.1
|
||||||
moment: 2.29.4
|
|
||||||
path-browserify: 1.0.1
|
path-browserify: 1.0.1
|
||||||
pnpm: 7.13.2
|
pnpm: 7.13.2
|
||||||
prettier: 2.7.1
|
prettier: 2.7.1
|
||||||
|
Loading…
x
Reference in New Issue
Block a user