#1542 Updated test

This commit is contained in:
Knut Sveidqvist 2020-07-18 13:52:51 +02:00
parent f7a6241ac0
commit e8af778962
4 changed files with 23 additions and 10 deletions

View File

@ -11,6 +11,7 @@ describe('Pie Chart', () => {
it('should render a pie diagram', () => {
imgSnapshotTest(
`
%%{init: { 'logLevel': 0, 'theme': '${theme}'} }%%
pie title Sports in Sweden
"Bandy" : 40
"Ice-Hockey" : 80
@ -23,6 +24,7 @@ describe('Pie Chart', () => {
it('should render a flowchart diagram', () => {
imgSnapshotTest(
`
%%{init: { 'logLevel': 0, 'theme': '${theme}'} }%%
graph TD
A[Christmas] -->|Get money| B(Go shopping)
B --> C{Let me think}
@ -45,6 +47,7 @@ describe('Pie Chart', () => {
it('should render a new flowchart diagram', () => {
imgSnapshotTest(
`
%%{init: { 'logLevel': 0, 'theme': '${theme}'} }%%
flowchart TD
A[Christmas] -->|Get money| B(Go shopping)
B --> C{Let me think}
@ -67,6 +70,7 @@ describe('Pie Chart', () => {
it('should render a sequence diagram', () => {
imgSnapshotTest(
`
%%{init: { 'logLevel': 0, 'theme': '${theme}'} }%%
sequenceDiagram
autonumber
par Action 1
@ -93,6 +97,7 @@ describe('Pie Chart', () => {
it('should render a class diagram', () => {
imgSnapshotTest(
`
%%{init: { 'logLevel': 0, 'theme': '${theme}'} }%%
classDiagram
Animal "*" <|-- "1" Duck
Animal "1" <|-- "10" Fish
@ -138,6 +143,7 @@ describe('Pie Chart', () => {
it('should render a state diagram', () => {
imgSnapshotTest(
`
%%{init: { 'logLevel': 0, 'theme': '${theme}'} }%%
stateDiagram
[*] --> Active
@ -169,6 +175,7 @@ stateDiagram
it('should render a state diagram (v2)', () => {
imgSnapshotTest(
`
%%{init: { 'logLevel': 0, 'theme': '${theme}'} }%%
stateDiagram-v2
[*] --> Active
@ -200,7 +207,7 @@ stateDiagram-v2
it('should render a er diagram', () => {
imgSnapshotTest(
`
erDiagram
erDiagram
CUSTOMER }|..|{ DELIVERY-ADDRESS : has
CUSTOMER ||--o{ ORDER : places
CUSTOMER ||--o{ INVOICE : "liable for"

View File

@ -42,7 +42,7 @@ graph TD
G
end
</div>
<div class="mermaid" style="width: 50%; height: 20%;">
<div class="mermaid2" style="width: 50%; height: 20%;">
%%{init: { 'logLevel': 1, 'theme': 'forest'} }%%
graph TD
A[Christmas] -->|Get money| B(Go shopping)
@ -59,7 +59,7 @@ graph TD
G
end
</div>
<div class="mermaid" style="width: 50%; height: 20%;">
<div class="mermaid2" style="width: 50%; height: 20%;">
%%{init: { 'logLevel': 1, 'theme': 'neutral'} }%%
graph TD
@ -77,7 +77,7 @@ graph TD
G
end
</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'} }%%
graph TD
@ -95,7 +95,7 @@ graph TD
G
end
</div>
<div class="mermaid" style="background: #3f3f3f; width: 50%; height: 20%;">
<div class="mermaid2" style="background: #3f3f3f; width: 50%; height: 20%;">
%%{init: { 'logLevel': 1} }%%
graph TD
@ -121,7 +121,7 @@ graph TD
// console.error('Mermaid error: ', err);
};
mermaid.initialize({
// theme: 'dark',
theme: 'forest',
// theme: 'dark',
// arrowMarkerAbsolute: true,
// themeCSS: '.edgePath .path {stroke: red;} .arrowheadPath {fill: red;}',

View File

@ -138,6 +138,11 @@ g.stateGroup line {
ry: 0;
}
#dependencyStart, #dependencyEnd {
fill: ${options.nodeBorder};
stroke: ${options.nodeBorder};
stroke-width: 1;
}
`;
export default getStyles;

View File

@ -519,7 +519,7 @@ function updateRendererConfigs(conf) {
}
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]) {
// Todo merge with user options
options.themeVariables = themes[options.theme];
@ -533,15 +533,16 @@ function reinitialize(options) {
}
function initialize(options) {
// console.log(`mermaidAPI.initialize: v${pkg.version}`);
console.log(`mermaidAPI.initialize: v${pkg.version} ${options}`);
// Set default options
if (options && options.theme && themes[options.theme]) {
// Todo merge with user options
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();