-
-
Notifications
You must be signed in to change notification settings - Fork 6.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #24 from mermaid-js/develop
merge from mermaid-js:develop
- Loading branch information
Showing
61 changed files
with
10,086 additions
and
318,083 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
141 changes: 141 additions & 0 deletions
141
cypress/integration/rendering/conf-and-directives.spec.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.