mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-01-14 06:43:25 +08:00
#1542 Updated test
This commit is contained in:
parent
f7a6241ac0
commit
e8af778962
@ -11,6 +11,7 @@ describe('Pie Chart', () => {
|
|||||||
it('should render a pie diagram', () => {
|
it('should render a pie diagram', () => {
|
||||||
imgSnapshotTest(
|
imgSnapshotTest(
|
||||||
`
|
`
|
||||||
|
%%{init: { 'logLevel': 0, 'theme': '${theme}'} }%%
|
||||||
pie title Sports in Sweden
|
pie title Sports in Sweden
|
||||||
"Bandy" : 40
|
"Bandy" : 40
|
||||||
"Ice-Hockey" : 80
|
"Ice-Hockey" : 80
|
||||||
@ -23,6 +24,7 @@ describe('Pie Chart', () => {
|
|||||||
it('should render a flowchart diagram', () => {
|
it('should render a flowchart diagram', () => {
|
||||||
imgSnapshotTest(
|
imgSnapshotTest(
|
||||||
`
|
`
|
||||||
|
%%{init: { 'logLevel': 0, 'theme': '${theme}'} }%%
|
||||||
graph TD
|
graph TD
|
||||||
A[Christmas] -->|Get money| B(Go shopping)
|
A[Christmas] -->|Get money| B(Go shopping)
|
||||||
B --> C{Let me think}
|
B --> C{Let me think}
|
||||||
@ -45,6 +47,7 @@ describe('Pie Chart', () => {
|
|||||||
it('should render a new flowchart diagram', () => {
|
it('should render a new flowchart diagram', () => {
|
||||||
imgSnapshotTest(
|
imgSnapshotTest(
|
||||||
`
|
`
|
||||||
|
%%{init: { 'logLevel': 0, 'theme': '${theme}'} }%%
|
||||||
flowchart TD
|
flowchart TD
|
||||||
A[Christmas] -->|Get money| B(Go shopping)
|
A[Christmas] -->|Get money| B(Go shopping)
|
||||||
B --> C{Let me think}
|
B --> C{Let me think}
|
||||||
@ -67,6 +70,7 @@ describe('Pie Chart', () => {
|
|||||||
it('should render a sequence diagram', () => {
|
it('should render a sequence diagram', () => {
|
||||||
imgSnapshotTest(
|
imgSnapshotTest(
|
||||||
`
|
`
|
||||||
|
%%{init: { 'logLevel': 0, 'theme': '${theme}'} }%%
|
||||||
sequenceDiagram
|
sequenceDiagram
|
||||||
autonumber
|
autonumber
|
||||||
par Action 1
|
par Action 1
|
||||||
@ -93,6 +97,7 @@ describe('Pie Chart', () => {
|
|||||||
it('should render a class diagram', () => {
|
it('should render a class diagram', () => {
|
||||||
imgSnapshotTest(
|
imgSnapshotTest(
|
||||||
`
|
`
|
||||||
|
%%{init: { 'logLevel': 0, 'theme': '${theme}'} }%%
|
||||||
classDiagram
|
classDiagram
|
||||||
Animal "*" <|-- "1" Duck
|
Animal "*" <|-- "1" Duck
|
||||||
Animal "1" <|-- "10" Fish
|
Animal "1" <|-- "10" Fish
|
||||||
@ -138,6 +143,7 @@ describe('Pie Chart', () => {
|
|||||||
it('should render a state diagram', () => {
|
it('should render a state diagram', () => {
|
||||||
imgSnapshotTest(
|
imgSnapshotTest(
|
||||||
`
|
`
|
||||||
|
%%{init: { 'logLevel': 0, 'theme': '${theme}'} }%%
|
||||||
stateDiagram
|
stateDiagram
|
||||||
[*] --> Active
|
[*] --> Active
|
||||||
|
|
||||||
@ -169,6 +175,7 @@ stateDiagram
|
|||||||
it('should render a state diagram (v2)', () => {
|
it('should render a state diagram (v2)', () => {
|
||||||
imgSnapshotTest(
|
imgSnapshotTest(
|
||||||
`
|
`
|
||||||
|
%%{init: { 'logLevel': 0, 'theme': '${theme}'} }%%
|
||||||
stateDiagram-v2
|
stateDiagram-v2
|
||||||
[*] --> Active
|
[*] --> Active
|
||||||
|
|
||||||
@ -200,7 +207,7 @@ stateDiagram-v2
|
|||||||
it('should render a er diagram', () => {
|
it('should render a er diagram', () => {
|
||||||
imgSnapshotTest(
|
imgSnapshotTest(
|
||||||
`
|
`
|
||||||
erDiagram
|
erDiagram
|
||||||
CUSTOMER }|..|{ DELIVERY-ADDRESS : has
|
CUSTOMER }|..|{ DELIVERY-ADDRESS : has
|
||||||
CUSTOMER ||--o{ ORDER : places
|
CUSTOMER ||--o{ ORDER : places
|
||||||
CUSTOMER ||--o{ INVOICE : "liable for"
|
CUSTOMER ||--o{ INVOICE : "liable for"
|
||||||
|
@ -42,7 +42,7 @@ graph TD
|
|||||||
G
|
G
|
||||||
end
|
end
|
||||||
</div>
|
</div>
|
||||||
<div class="mermaid" style="width: 50%; height: 20%;">
|
<div class="mermaid2" style="width: 50%; height: 20%;">
|
||||||
%%{init: { 'logLevel': 1, 'theme': 'forest'} }%%
|
%%{init: { 'logLevel': 1, 'theme': 'forest'} }%%
|
||||||
graph TD
|
graph TD
|
||||||
A[Christmas] -->|Get money| B(Go shopping)
|
A[Christmas] -->|Get money| B(Go shopping)
|
||||||
@ -59,7 +59,7 @@ graph TD
|
|||||||
G
|
G
|
||||||
end
|
end
|
||||||
</div>
|
</div>
|
||||||
<div class="mermaid" style="width: 50%; height: 20%;">
|
<div class="mermaid2" style="width: 50%; height: 20%;">
|
||||||
%%{init: { 'logLevel': 1, 'theme': 'neutral'} }%%
|
%%{init: { 'logLevel': 1, 'theme': 'neutral'} }%%
|
||||||
|
|
||||||
graph TD
|
graph TD
|
||||||
@ -77,7 +77,7 @@ graph TD
|
|||||||
G
|
G
|
||||||
end
|
end
|
||||||
</div>
|
</div>
|
||||||
<div class="mermaid" style="background: #3f3f3f; width: 50%; height: 20%;">
|
<div class="mermaid2" style="background: #3f3f3f; width: 50%; height: 20%;">
|
||||||
%%{init: { 'logLevel': 1, 'theme': 'dark'} }%%
|
%%{init: { 'logLevel': 1, 'theme': 'dark'} }%%
|
||||||
|
|
||||||
graph TD
|
graph TD
|
||||||
@ -95,7 +95,7 @@ graph TD
|
|||||||
G
|
G
|
||||||
end
|
end
|
||||||
</div>
|
</div>
|
||||||
<div class="mermaid" style="background: #3f3f3f; width: 50%; height: 20%;">
|
<div class="mermaid2" style="background: #3f3f3f; width: 50%; height: 20%;">
|
||||||
%%{init: { 'logLevel': 1} }%%
|
%%{init: { 'logLevel': 1} }%%
|
||||||
|
|
||||||
graph TD
|
graph TD
|
||||||
@ -121,7 +121,7 @@ graph TD
|
|||||||
// console.error('Mermaid error: ', err);
|
// console.error('Mermaid error: ', err);
|
||||||
};
|
};
|
||||||
mermaid.initialize({
|
mermaid.initialize({
|
||||||
// theme: 'dark',
|
theme: 'forest',
|
||||||
// theme: 'dark',
|
// theme: 'dark',
|
||||||
// arrowMarkerAbsolute: true,
|
// arrowMarkerAbsolute: true,
|
||||||
// themeCSS: '.edgePath .path {stroke: red;} .arrowheadPath {fill: red;}',
|
// themeCSS: '.edgePath .path {stroke: red;} .arrowheadPath {fill: red;}',
|
||||||
|
@ -138,6 +138,11 @@ g.stateGroup line {
|
|||||||
ry: 0;
|
ry: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#dependencyStart, #dependencyEnd {
|
||||||
|
fill: ${options.nodeBorder};
|
||||||
|
stroke: ${options.nodeBorder};
|
||||||
|
stroke-width: 1;
|
||||||
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
export default getStyles;
|
export default getStyles;
|
||||||
|
@ -519,7 +519,7 @@ function updateRendererConfigs(conf) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function reinitialize(options) {
|
function reinitialize(options) {
|
||||||
console.log(`mermaidAPI.reinitialize: v${pkg.version}`, options);
|
console.warn(`mermaidAPI.reinitialize: v${pkg.version}`, options);
|
||||||
if (options.theme && themes[options.theme]) {
|
if (options.theme && themes[options.theme]) {
|
||||||
// Todo merge with user options
|
// Todo merge with user options
|
||||||
options.themeVariables = themes[options.theme];
|
options.themeVariables = themes[options.theme];
|
||||||
@ -533,15 +533,16 @@ function reinitialize(options) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function initialize(options) {
|
function initialize(options) {
|
||||||
// console.log(`mermaidAPI.initialize: v${pkg.version}`);
|
console.log(`mermaidAPI.initialize: v${pkg.version} ${options}`);
|
||||||
// Set default options
|
// Set default options
|
||||||
|
|
||||||
if (options && options.theme && themes[options.theme]) {
|
if (options && options.theme && themes[options.theme]) {
|
||||||
// Todo merge with user options
|
// Todo merge with user options
|
||||||
options.themeVariables = themes[options.theme];
|
options.themeVariables = themes[options.theme];
|
||||||
} else {
|
|
||||||
if (options) options.themeVariables = themes.default;
|
|
||||||
}
|
}
|
||||||
|
// else {
|
||||||
|
// if (options) options.themeVariables = themes.default;
|
||||||
|
// }
|
||||||
|
|
||||||
const config = typeof options === 'object' ? setSiteConfig(options) : getSiteConfig();
|
const config = typeof options === 'object' ? setSiteConfig(options) : getSiteConfig();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user