Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

merge from mermaid-js:develop #24

Merged
merged 25 commits into from
Aug 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
d04d8c3
#1460 Add link target option to flowchart click
GDFaber Jul 28, 2020
71e4ada
Trigger tests once more
GDFaber Jul 28, 2020
cf70678
Merge branch 'develop' into feature/1460_add_link_target_to_flowchart…
knsv Jul 28, 2020
9fd9a7b
Update 8.6.0_docs.md
NeilCuzon Jul 28, 2020
db03b5b
Update theming.md
NeilCuzon Jul 29, 2020
2ecda17
Update theming.md
NeilCuzon Jul 29, 2020
e651511
Update theming.md
NeilCuzon Jul 29, 2020
8f9d132
Update theming.md
NeilCuzon Jul 29, 2020
e4e2439
Update theming.md
NeilCuzon Jul 29, 2020
d215d31
Merge pull request #1585 from GDFaber/feature/1460_add_link_target_to…
knsv Jul 29, 2020
a4bf85b
#1542 Making sure config and directives works for overriding theme va…
knsv Jul 29, 2020
ecea0f9
#1542 Handling of config
knsv Jul 29, 2020
b17475f
#1366 Flowchart documentation: Fix code example for styling nodes
GDFaber Jul 29, 2020
4e3bdf0
Merge pull request #1587 from GDFaber/documentation/fix_flowchart_sty…
GDFaber Jul 29, 2020
f1836c2
#1542 Fix for secirity config
knsv Jul 30, 2020
a5b01c3
#1542 Adding gantt to showcases
knsv Jul 30, 2020
36e421e
Merge pull request #1586 from mermaid-js/1542_take_two
knsv Jul 30, 2020
084e3df
Bump elliptic from 6.5.2 to 6.5.3
dependabot[bot] Jul 30, 2020
116c616
Merge pull request #1591 from mermaid-js/dependabot/npm_and_yarn/elli…
knsv Jul 30, 2020
dd86671
Removed console statements
knsv Jul 30, 2020
dbe6b9d
#1590 Themes tweaked
knsv Jul 30, 2020
5565aab
#1590 Theme base tweaked for custom theming
knsv Jul 30, 2020
f87c56a
Merge pull request #1593 from mermaid-js/1590_theme_finalizations
knsv Jul 30, 2020
dccb23b
Update theming.md
NeilCuzon Jul 30, 2020
e9e9b13
Added themeVariable references and som adjustments in base theme calc…
knsv Jul 31, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"es6": true,
"node": true
},
"parser": "babel-eslint",
"parserOptions": {
"ecmaFeatures": {
"experimentalObjectRestSpread": true,
Expand Down
141 changes: 141 additions & 0 deletions cypress/integration/rendering/conf-and-directives.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
/* eslint-env jest */
import { imgSnapshotTest } from '../../helpers/util.js';

describe('Configuration and directives - nodes should be light blue', () => {
it('No config - use default', () => {
imgSnapshotTest(
`
graph TD
A(Default) --> B[/Another/]
A --> C[End]
subgraph section
B
C
end
`,
{}
);
cy.get('svg');
});
it('Settigns from intitialize - nodes should be green', () => {
imgSnapshotTest(
`
graph TD
A(Forest) --> B[/Another/]
A --> C[End]
subgraph section
B
C
end `,
{theme:'forest'}
);
cy.get('svg');
});
it('Settings from initialize overriding themeVariable - nodes shold be red', () => {
imgSnapshotTest(
`
%%{init: { 'theme': 'base', 'themeVariables':{ 'primaryColor': '#ff0000'}}}%%
graph TD
A(Start) --> B[/Another/]
A[/Another/] --> C[End]
subgraph section
B
C
end
`,
{theme:'base', themeVariables:{ primaryColor: '#ff0000'}, logLevel: 0}
);
cy.get('svg');
});
it('Settings from directive - nodes should be grey', () => {
imgSnapshotTest(
`
%%{init: { 'logLevel': 0, 'theme': 'neutral'} }%%
graph TD
A(Start) --> B[/Another/]
A[/Another/] --> C[End]
subgraph section
B
C
end
`,
{}
);
cy.get('svg');
});

it('Settings from directive overriding theme variable - nodes should be red', () => {
imgSnapshotTest(
`
%%{init: {'theme': 'base', 'themeVariables':{ 'primaryColor': '#ff0000'}}}%%
graph TD
A(Start) --> B[/Another/]
A[/Another/] --> C[End]
subgraph section
B
C
end
`,
{}
);
cy.get('svg');
});
it('Settings from initialize and directive - nodes should be grey', () => {
imgSnapshotTest(
`
%%{init: { 'logLevel': 0, 'theme': 'neutral'} }%%
graph TD
A(Start) --> B[/Another/]
A[/Another/] --> C[End]
subgraph section
B
C
end
`,
{theme:'forest'}
);
cy.get('svg');
});
it('Theme from initialize, directive overriding theme variable - nodes should be red', () => {
imgSnapshotTest(
`
%%{init: {'theme': 'base', 'themeVariables':{ 'primaryColor': '#ff0000'}}}%%
graph TD
A(Start) --> B[/Another/]
A[/Another/] --> C[End]
subgraph section
B
C
end
`,
{theme:'base'}
);
cy.get('svg');
});
it('Theme variable from initialize, theme from directive - nodes should be red', () => {
imgSnapshotTest(
`
%%{init: { 'logLevel': 0, 'theme': 'base'} }%%
graph TD
A(Start) --> B[/Another/]
A[/Another/] --> C[End]
subgraph section
B
C
end
`,
{themeVariables:{primaryColor: '#ff0000'}}
);
cy.get('svg');
});
describe('when rendering several diagrams', () => {
it('diagrams should not taint later diagrams', () => {
const url = 'http://localhost:9000/theme-directives.html';
cy.visit(url);
cy.get('svg');
cy.percySnapshot();
});
});
});
24 changes: 13 additions & 11 deletions cypress/integration/rendering/flowchart.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -529,17 +529,19 @@ describe('Flowchart', () => {
imgSnapshotTest(
`graph TB
TITLE["Link Click Events<br>(click the nodes below)"]
A[link test]
B[anchor test]
C[mailto test]
D[other protocol test]
E[script test]
TITLE --> A & B & C & D & E
click A "https://mermaid-js.github.io/mermaid/#/" "link test"
click B "#link-clicked" "anchor test"
click C "mailto:user@user.user" "mailto test"
click D "notes://do-your-thing/id" "other protocol test"
click E "javascript:alert('test')" "script test"
A["link test (open in same tab)"]
B["link test (open in new tab)"]
C[anchor test]
D[mailto test]
E[other protocol test]
F[script test]
TITLE --> A & B & C & D & E & F
click A "https://mermaid-js.github.io/mermaid/#/" "link test (open in same tab)"
click B "https://mermaid-js.github.io/mermaid/#/" "link test (open in new tab)" _blank
click C "#link-clicked"
click D "mailto:user@user.user" "mailto test"
click E "notes://do-your-thing/id" "other protocol test"
click F "javascript:alert('test')" "script test"
`,
{ securityLevel: 'loose' }
);
Expand Down
33 changes: 26 additions & 7 deletions cypress/platform/current.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ <h1>info below</h1>
c1 --apa apa apa--> b1
two --> c2
</div>
<div class="mermaid" style="width: 50%; height: 200px;">
<div class="mermaid2" style="width: 50%; height: 200px;">
sequenceDiagram
Alice->>Bob:Extremely utterly long line of longness which had preivously overflown the actor box as it is much longer than what it should be
Bob->>Alice: I'm short though
</div>
<div class="mermaid" style="width: 50%; height: 200px;">
<div class="mermaid2" style="width: 50%; height: 200px;">
%%{init: {'securityLevel': 'loose'}}%%
graph TD
A[Christmas] -->|Get money| B(Go shopping)
Expand Down Expand Up @@ -74,12 +74,30 @@ <h1>info below</h1>
A --> D: asd123
</div>
</div>
%%{init: {'theme': 'base', 'themeVariables':{ 'primaryColor': '#ff0000'}}}%%
<div class="mermaid" style="width: 50%; height: 20%;">
%%{init: {'theme': 'dark'}}%%

classDiagram
Customer "1" --> "*" Ticket
Student "1" --> "1..*" Course
Galaxy --> "many" Star : Contains
flowchart TB
subgraph apa
a --> A %% comment
a --> a{apa} %% comment
end
</div>
<div class="mermaid2" style="width: 50%; height: 20%;">
graph TD
A(Start) --> B[/Another/]
A[/Another/] --> C[End]
subgraph section
B
C
end
</div>
<div class="mermaid2" style="width: 50%; height: 20%;">
sequenceDiagram
Alice->Bob: Hello Bob, how are you?
Note over Alice,Bob: Looks
Note over Bob,Alice: Looks back
</div>

<script src="./mermaid.js"></script>
Expand All @@ -88,7 +106,8 @@ <h1>info below</h1>
// console.error('Mermaid error: ', err);
};
mermaid.initialize({
// theme: 'dark',
theme: 'forest',
// themeVariables:{primaryColor: '#ff0000'},
// arrowMarkerAbsolute: true,
// themeCSS: '.edgePath .path {stroke: red;} .arrowheadPath {fill: red;}',
logLevel: 0,
Expand Down
30 changes: 27 additions & 3 deletions cypress/platform/showcase_base.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
body {
/* background: rgb(221, 208, 208); */
background: #f4f4f4;
/* background: #0c0c0c; */
font-family: 'Arial';
height: 100%;
width: 100%;
Expand Down Expand Up @@ -93,6 +92,31 @@ <h1>Showcases of diagrams</h1>
John-->Alice: Great!
end
</div>
<div class="mermaid width height" >
%%{init: {'securityLevel': 'loose', 'theme':'base'}}%%

classDiagram
Animal "1" <|-- Duck
Animal <|-- Fish
Animal <--o Zebra
Animal : +int age
Animal : +String gender
Animal: +isMammal()
Animal: +mate()
class Duck{
+String beakColor
+swim()
+quack()
}
class Fish{
-int sizeInFeet
-canEat()
}
class Zebra{
+bool is_wild
+run()
}
</div>
<div class="mermaid width height">
gantt
dateFormat :YYYY-MM-DD
Expand Down Expand Up @@ -152,7 +176,7 @@ <h1>Showcases of diagrams</h1>

</div>
<div class="mermaid width height2">
%%{init2: {'securityLevel': 'loose', 'theme':'base'}}%%
%%{init: {'securityLevel': 'loose', 'theme':'base'}}%%
stateDiagram-v2
[*] --> Active

Expand Down Expand Up @@ -209,7 +233,7 @@ <h1>Showcases of diagrams</h1>
};
mermaid.initialize({
theme: 'base',
themeVariables: { primaryColor: '#ff0000'},
// themeVariables:
// arrowMarkerAbsolute: true,
// themeCSS: '.edgePath .path {stroke: red;} .arrowheadPath {fill: red;}',
logLevel: 0,
Expand Down
Loading