Compare commits

...

433 Commits

Author SHA1 Message Date
Knut Sveidqvist
7da80812e0 Release 8.13.5 2021-12-08 07:53:37 +01:00
Knut Sveidqvist
831110029c Merge branch 'HEAD' into 2541 2021-12-07 22:56:01 +01:00
Knut Sveidqvist
89ce930de2 Adding integration test 2021-12-07 22:55:28 +01:00
Knut Sveidqvist
f69f770043 dep fix 2021-12-07 22:09:38 +01:00
Knut Sveidqvist
a97b2cc4da #2541 Sanitizing the label string in class diagrams 2021-12-07 21:55:33 +01:00
Knut Sveidqvist
25b70d8058 Merge remote-tracking branch 'origin/develop' into develop 2021-12-07 21:48:56 +01:00
Knut Sveidqvist
bd106e4aec Merge pull request #2522 from mermaid-js/eslint-husky
setup lint-staged and husky
2021-12-07 09:36:57 +01:00
Lukas Klingsbo
b7abaf1e47 Change "Help wanted!" to "Good first issue!" shield (#2533) 2021-12-05 13:10:41 -08:00
dependabot[bot]
4fea702347 Bump webpack-dev-server from 4.5.0 to 4.6.0 (#2515)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-12-04 15:30:42 -08:00
Knut Sveidqvist
e6cf1f2602 Merge pull request #2389 from maiermic/feature/1893_data_flow_diagrams
Feature/1893 data flow diagrams
2021-12-01 18:48:09 +01:00
Knut Sveidqvist
9a729257f2 Merge branch 'maiermic-feature/1893_data_flow_diagrams' into develop 2021-12-01 18:14:10 +01:00
Knut Sveidqvist
492ecb1099 merge 2021-12-01 18:12:05 +01:00
Yash-Singh1
ab17af274d chore: install husky hooks on install 2021-11-30 17:08:10 -08:00
Yash-Singh1
59e0a8e1b5 Merge branch 'develop' of github.com:mermaid-js/mermaid into eslint-husky 2021-11-30 17:05:10 -08:00
Yash-Singh1
c232bee95f chore: resolve conflicts by rebuilding 2021-11-30 17:02:58 -08:00
Matthieu MOREL
837eeb6d01 test are already executed on push and pull request 2021-11-30 23:18:48 +01:00
Knut Sveidqvist
3426aa8b2a Lint fix 2021-11-30 20:41:57 +01:00
Knut Sveidqvist
3526e35012 Fix for node with wrong type 2021-11-30 20:28:51 +01:00
Knut Sveidqvist
a018789026 Merge remote-tracking branch 'origin/develop' into develop 2021-11-30 19:24:10 +01:00
Knut Sveidqvist
d9e598aa7f testcommit 2021-11-30 19:12:39 +01:00
Matthieu MOREL
27027d003b setup lint-staged and husky
Co-Authored-By: Yash Singh <saiansh2525@gmail.com>
2021-11-30 08:49:37 +01:00
dependabot[bot]
89eea0536d Bump eslint-plugin-jest from 25.2.4 to 25.3.0 (#2519)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-11-29 20:18:52 -08:00
dependabot[bot]
4679daafcf Bump eslint from 8.2.0 to 8.3.0 (#2518)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-11-29 18:02:07 -08:00
dependabot[bot]
a0c6160e55 Bump prettier from 2.4.1 to 2.5.0 (#2520)
Bumps [prettier](https://github.com/prettier/prettier) from 2.4.1 to 2.5.0.
- [Release notes](https://github.com/prettier/prettier/releases)
- [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prettier/prettier/compare/2.4.1...2.5.0)

---
updated-dependencies:
- dependency-name: prettier
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-11-29 12:24:29 -08:00
Knut Sveidqvist
f887420818 Merge pull request #2521 from pbendersky/bug/1342-spaces-in-state-name
Changed logic to render states with spaces in names to fix regressions.
2021-11-29 17:55:56 +01:00
Pablo Bendersky
31851b2e30 Fixed eslint error 2021-11-29 13:02:38 -03:00
Pablo Bendersky
08702565f7 Changed logic to render states with spaces in names to fix regressions. 2021-11-29 11:57:59 -03:00
Knut Sveidqvist
5d99ac7d8d Merge pull request #2502 from mermaid-js/prLabelerValidator
Pr labeler config validator
2021-11-29 07:57:17 +01:00
Knut Sveidqvist
d19be0b940 Merge pull request #2501 from pbendersky/bug/1342-spaces-in-state-name
Fixes rendering of state names with spaces
2021-11-29 07:56:35 +01:00
Knut Sveidqvist
b7115b804c Merge pull request #2500 from mmorel-35/develop
Enable eslint-plugin-jest, eslint-plugin-cypress and wider scan
2021-11-29 07:55:08 +01:00
Michael Maier
28bb07d415 fix: check if node.prop is defined 2021-11-28 15:35:56 +01:00
Michael Maier
c2db1d4d44 add missing semicolon 2021-11-28 12:44:22 +01:00
Michael Maier
b6d3ac8e32 warn if unknown node property is given 2021-11-28 12:38:51 +01:00
Michael Maier
9e8c03cb49 Merge branch 'develop' into feature/1893_data_flow_diagrams 2021-11-28 12:26:39 +01:00
Michael Maier
5fff8403a8 add borders example 2021-11-28 12:24:24 +01:00
Michael Maier
86810e04bd Revert "add shape datastore (for nodes of data flow diagram)"
This reverts commit cd427ab8ba.
2021-11-28 12:17:05 +01:00
Michael Maier
ee3680eb6d update syntax of data flow diagram example 2021-11-28 12:17:04 +01:00
Michael Maier
984a5084b0 render node property borders of rect node 2021-11-28 12:13:48 +01:00
Michael Maier
853d62c8d1 add props of vertex to node 2021-11-28 12:12:39 +01:00
Michael Maier
0550e4a899 add props to vertex 2021-11-28 12:11:50 +01:00
Michael Maier
dec6b6d8b5 replace 'datastore' brackets with 'vertex with props' bracket 2021-11-28 12:09:54 +01:00
Yash-Singh1
0b1b3538bc Merge branch 'develop' of github.com:mermaid-js/mermaid into develop 2021-11-26 13:43:58 -08:00
Yash-Singh1
31c29b4c02 Merge branch 'develop' of github.com:mermaid-js/mermaid into prLabelerValidator 2021-11-25 14:31:32 -08:00
dependabot[bot]
17a23a1103 Bump webpack from 5.64.1 to 5.64.2 (#2505)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-11-25 13:11:34 -08:00
dependabot[bot]
6b4107b231 Bump eslint from 8.2.0 to 8.3.0 (#2506)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-11-25 13:10:38 -08:00
dependabot[bot]
0a50b835b1 Bump @babel/preset-env from 7.16.0 to 7.16.4 (#2504)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Yash-Singh1 <saiansh2525@gmail.com>
2021-11-25 13:09:38 -08:00
Yash Singh
89ed7d9b72 Don't lock issues on close (#2503) 2021-11-25 12:48:57 -08:00
Yash Singh
6e5180bd1c fix: async highlight and escape html in docs (#2512) 2021-11-25 12:43:16 -08:00
Yash-Singh1
efcc3b7d37 Use 0.0.3 2021-11-20 18:20:05 -08:00
Yash-Singh1
8a08efdfbb Checkout repo 2021-11-20 15:48:50 -08:00
Yash Singh
a4f26f27bc Attempt to use branch name 2021-11-20 15:47:14 -08:00
Yash-Singh1
226f90dbcb Setup pr labeler config validator 2021-11-19 21:25:58 -08:00
Pablo Bendersky
7ce383078d Fixed state nodes with spaces being rendered as rectWithTitle instead of rect 2021-11-19 13:40:39 -03:00
Matthieu MOREL
d84be0d792 Enable eslint-plugin-jest, eslint-plugin-cypress and wider scan 2021-11-18 23:57:16 +01:00
dependabot[bot]
4089ee8786 Bump @babel/eslint-parser from 7.16.0 to 7.16.3 (#2488)
Bumps [@babel/eslint-parser](https://github.com/babel/babel/tree/HEAD/eslint/babel-eslint-parser) from 7.16.0 to 7.16.3.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.16.3/eslint/babel-eslint-parser)

---
updated-dependencies:
- dependency-name: "@babel/eslint-parser"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-11-18 19:08:02 +01:00
dependabot[bot]
5487ac9542 Bump cypress from 8.7.0 to 9.0.0 (#2486)
Bumps [cypress](https://github.com/cypress-io/cypress) from 8.7.0 to 9.0.0.
- [Release notes](https://github.com/cypress-io/cypress/releases)
- [Changelog](https://github.com/cypress-io/cypress/blob/develop/.releaserc.base.js)
- [Commits](https://github.com/cypress-io/cypress/compare/v8.7.0...v9.0.0)

---
updated-dependencies:
- dependency-name: cypress
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-11-18 18:58:03 +01:00
dependabot[bot]
f303909ad6 Bump webpack-dev-server from 4.4.0 to 4.5.0 (#2489)
Bumps [webpack-dev-server](https://github.com/webpack/webpack-dev-server) from 4.4.0 to 4.5.0.
- [Release notes](https://github.com/webpack/webpack-dev-server/releases)
- [Changelog](https://github.com/webpack/webpack-dev-server/blob/master/CHANGELOG.md)
- [Commits](https://github.com/webpack/webpack-dev-server/compare/v4.4.0...v4.5.0)

---
updated-dependencies:
- dependency-name: webpack-dev-server
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-11-18 18:53:03 +01:00
dependabot[bot]
be412ba78c Bump concurrently from 6.3.0 to 6.4.0 (#2490)
Bumps [concurrently](https://github.com/open-cli-tools/concurrently) from 6.3.0 to 6.4.0.
- [Release notes](https://github.com/open-cli-tools/concurrently/releases)
- [Commits](https://github.com/open-cli-tools/concurrently/compare/v6.3.0...v6.4.0)

---
updated-dependencies:
- dependency-name: concurrently
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-11-18 18:41:13 +01:00
dependabot[bot]
a1ae00070c Bump webpack from 5.62.1 to 5.64.1 (#2498)
Bumps [webpack](https://github.com/webpack/webpack) from 5.62.1 to 5.64.1.
- [Release notes](https://github.com/webpack/webpack/releases)
- [Commits](https://github.com/webpack/webpack/compare/v5.62.1...v5.64.1)

---
updated-dependencies:
- dependency-name: webpack
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-11-18 18:37:42 +01:00
Knut Sveidqvist
bb299685cd Merge branch 'mmorel-35-eslint-fix' into develop 2021-11-18 18:07:27 +01:00
Knut Sveidqvist
9d1f32cc0a Merge branch 'eslint-fix' of https://github.com/mmorel-35/mermaid into mmorel-35-eslint-fix 2021-11-18 18:05:15 +01:00
Knut Sveidqvist
6318eee07e Merge remote-tracking branch 'origin/develop' into develop 2021-11-18 17:44:40 +01:00
Knut Sveidqvist
bc64fc7efb Merge branch 'master' into develop 2021-11-18 17:44:17 +01:00
Knut Sveidqvist
650bcef3d1 Merge branch 'release/8.13.4' 2021-11-18 17:11:17 +01:00
Knut Sveidqvist
95df8fa128 Version 8.13.4 bundles 2021-11-18 17:10:36 +01:00
dependabot[bot]
bb62704433 Bump terser-webpack-plugin from 5.2.4 to 5.2.5 (#2491)
Bumps [terser-webpack-plugin](https://github.com/webpack-contrib/terser-webpack-plugin) from 5.2.4 to 5.2.5.
- [Release notes](https://github.com/webpack-contrib/terser-webpack-plugin/releases)
- [Changelog](https://github.com/webpack-contrib/terser-webpack-plugin/blob/master/CHANGELOG.md)
- [Commits](https://github.com/webpack-contrib/terser-webpack-plugin/compare/v5.2.4...v5.2.5)

---
updated-dependencies:
- dependency-name: terser-webpack-plugin
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-11-17 15:45:40 -08:00
Knut Sveidqvist
09cc0d02f4 Version bump to 8.13.4 2021-11-17 23:12:37 +01:00
Knut Sveidqvist
98f575e098 Merge pull request #2497 from mermaid-js/2496_place
2496 Securityf fix
2021-11-17 22:53:41 +01:00
Knut Sveidqvist
72d2045104 #2496 Unbreaking state diagrams 2021-11-17 22:30:30 +01:00
Knut Sveidqvist
3feff08d42 #2496 A more delicate fix for issue 2021-11-17 21:31:52 +01:00
Knut Sveidqvist
fcbd8a5081 #2496 Fix for issue 2021-11-17 20:08:39 +01:00
MOREL Matthieu
5b8a4a0b7a fix conf table display 2021-11-15 09:58:47 +01:00
The Alchemist
00f228b959 removed duplicate 'Browser Extensions' header (#2482) 2021-11-14 12:53:15 +01:00
Yash-Singh1
e68ec31a8f Fix lint warnings 2021-11-11 10:37:50 -08:00
Yash-Singh1
d6782bced8 Merge branch 'eslint-fix' of github.com:mmorel-35/mermaid into eslint-fix 2021-11-11 10:34:06 -08:00
Yash-Singh1
2368ba4914 Merge github.com:mermaid-js/mermaid into eslint-fix 2021-11-11 10:31:08 -08:00
Knut Sveidqvist
857f6c892c Merge pull request #2449 from Yash-Singh1/develop
Use monaco-mermaid for syntax highlighting and many syntax highlighting improvements
2021-11-11 19:09:19 +01:00
Knut Sveidqvist
0db5f9fea7 Merge branch 'develop' into develop 2021-11-11 19:09:12 +01:00
Knut Sveidqvist
1fe31dac7d Merge pull request #2464 from Yash-Singh1/jsdoc
Add jsdoc
2021-11-11 19:05:21 +01:00
Knut Sveidqvist
ce675b011d Merge pull request #2470 from kahgoh/develop
Add missing code listing in sequence diagram docs
2021-11-11 18:58:42 +01:00
Knut Sveidqvist
775461407e Merge pull request #2468 from jaybuidl/patch-1
Update gantt.md
2021-11-11 18:58:24 +01:00
Knut Sveidqvist
6305455554 Merge pull request #2476 from bartek/docs/fix_editor_link
Remove references to non-existent Markdown file
2021-11-11 18:58:04 +01:00
Knut Sveidqvist
c964461cb5 Merge pull request #2478 from zephyraft/develop
Add chrome extension to integrations.md
2021-11-11 18:57:37 +01:00
zephyr
42b2e582c5 Add chrome extension to integrations.md 2021-11-11 15:40:55 +08:00
Matthieu MOREL
12f58c967e Update .eslintrc.json 2021-11-11 07:37:14 +01:00
Yash-Singh1
d140a9df8f Switch from mermaid-code -> mmd 2021-11-10 18:04:40 -08:00
Bartek Ciszkowski
53a539e84b Remove reference to non-existant Markdown file
The two links, were linking to Live-Editor.md, which did not exist at time of this commit. Instead, have the link point to the live editor.
2021-11-10 21:13:32 -04:00
Matthieu MOREL
57671b2b78 enable prettier-plugin-jsdoc 2021-11-10 08:41:52 +01:00
Matthieu MOREL
4d103c14f7 enable eslint fix and eslint-plugin-jsdoc 2021-11-09 11:01:49 +01:00
Kah Goh
6f4fb48fad Add missing code listing in sequence diagram docs 2021-11-08 21:56:22 +08:00
Jean-Baptiste Cebe
92f036222e Update gantt.md 2021-11-08 10:52:13 +00:00
dependabot[bot]
c29c8bd33c Bump eslint from 8.1.0 to 8.2.0 (#2466)
Bumps [eslint](https://github.com/eslint/eslint) from 8.1.0 to 8.2.0.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/compare/v8.1.0...v8.2.0)

---
updated-dependencies:
- dependency-name: eslint
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-11-08 08:33:40 +01:00
dependabot[bot]
ec834363b4 Bump webpack from 5.61.0 to 5.62.1 (#2465)
Bumps [webpack](https://github.com/webpack/webpack) from 5.61.0 to 5.62.1.
- [Release notes](https://github.com/webpack/webpack/releases)
- [Commits](https://github.com/webpack/webpack/compare/v5.61.0...v5.62.1)

---
updated-dependencies:
- dependency-name: webpack
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-11-08 08:21:24 +01:00
Yash-Singh1
d69c3b8856 Revert loader change 2021-11-06 19:59:17 -07:00
Yash-Singh1
0fb25ee749 Merge github.com:mermaid-js/mermaid into jsdoc 2021-11-06 19:48:34 -07:00
Yash-Singh1
d2d8c9bc8e Add jsdoc and refactor a bit of code 2021-11-06 19:36:06 -07:00
Knut Sveidqvist
829642a2cb Revert "Merge branch 'develop'"
This reverts commit 69ecb02375.
2021-11-04 21:27:11 +01:00
Knut Sveidqvist
a2e6180143 Merge branch 'master' into develop 2021-11-04 21:24:26 +01:00
Knut Sveidqvist
69ecb02375 Merge branch 'develop'
Conflicts:
	dist/mermaid.core.js
	dist/mermaid.core.js.map
	dist/mermaid.esm.min.mjs
	dist/mermaid.js
	dist/mermaid.js.map
	dist/mermaid.min.js
	dist/mermaid.min.js.map
2021-11-04 21:23:29 +01:00
Yash-Singh1
2ae442accc Support for mermaid-example 2021-11-03 15:26:59 -07:00
Knut Sveidqvist
caeeca7722 Merge pull request #2448 from efim/develop
Add GNU Emacs to integrations documentation
2021-11-03 19:49:31 +01:00
Yash-Singh1
dac542682d More code fence syntax highlighting 2021-11-01 19:43:54 -07:00
Yash-Singh1
ab3e076c91 Use theme properly and another syntax highlight change 2021-11-01 19:33:01 -07:00
Yash-Singh1
d2b7a3ec28 Add syntax highlight to some erdiagrams 2021-11-01 18:02:49 -07:00
Yash-Singh1
c015d97957 Multiple pages through async before page load 2021-11-01 18:00:39 -07:00
dependabot[bot]
4ec12ba9d5 Bump @babel/preset-env from 7.15.8 to 7.16.0 (#2451)
Bumps [@babel/preset-env](https://github.com/babel/babel/tree/HEAD/packages/babel-preset-env) from 7.15.8 to 7.16.0.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.16.0/packages/babel-preset-env)

---
updated-dependencies:
- dependency-name: "@babel/preset-env"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-11-01 09:43:23 +01:00
dependabot[bot]
2d4f31dff5 Bump @babel/eslint-parser from 7.15.8 to 7.16.0 (#2454)
Bumps [@babel/eslint-parser](https://github.com/babel/babel/tree/HEAD/eslint/babel-eslint-parser) from 7.15.8 to 7.16.0.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.16.0/eslint/babel-eslint-parser)

---
updated-dependencies:
- dependency-name: "@babel/eslint-parser"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-11-01 09:28:12 +01:00
dependabot[bot]
95a4f96da7 Bump @babel/core from 7.15.8 to 7.16.0 (#2453)
Bumps [@babel/core](https://github.com/babel/babel/tree/HEAD/packages/babel-core) from 7.15.8 to 7.16.0.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.16.0/packages/babel-core)

---
updated-dependencies:
- dependency-name: "@babel/core"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-11-01 09:27:42 +01:00
dependabot[bot]
4f3130908f Bump webpack from 5.60.0 to 5.61.0 (#2452)
Bumps [webpack](https://github.com/webpack/webpack) from 5.60.0 to 5.61.0.
- [Release notes](https://github.com/webpack/webpack/releases)
- [Commits](https://github.com/webpack/webpack/compare/v5.60.0...v5.61.0)

---
updated-dependencies:
- dependency-name: webpack
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-11-01 09:18:11 +01:00
dependabot[bot]
b874322f2f Bump @babel/register from 7.15.3 to 7.16.0 (#2455)
Bumps [@babel/register](https://github.com/babel/babel/tree/HEAD/packages/babel-register) from 7.15.3 to 7.16.0.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.16.0/packages/babel-register)

---
updated-dependencies:
- dependency-name: "@babel/register"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-11-01 09:15:33 +01:00
Yash-Singh1
fdfb5d8270 Use the mermaid theme 2021-10-31 15:14:11 -07:00
Yash-Singh1
1b7e690ec1 Use monaco-mermaid for syntax highlighting and many syntax highlighting improvements 2021-10-31 14:45:41 -07:00
efim
5cc7ba52bb Add GNU Emacs to integrations documentation 2021-10-30 20:48:06 +03:00
dependabot[bot]
66d4d9d5b8 Bump webpack-dev-server from 4.3.1 to 4.4.0 (#2446)
Bumps [webpack-dev-server](https://github.com/webpack/webpack-dev-server) from 4.3.1 to 4.4.0.
- [Release notes](https://github.com/webpack/webpack-dev-server/releases)
- [Changelog](https://github.com/webpack/webpack-dev-server/blob/master/CHANGELOG.md)
- [Commits](https://github.com/webpack/webpack-dev-server/compare/v4.3.1...v4.4.0)

---
updated-dependencies:
- dependency-name: webpack-dev-server
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-10-28 22:17:29 +02:00
dependabot[bot]
8579442d77 Bump cypress from 8.6.0 to 8.7.0 (#2445)
Bumps [cypress](https://github.com/cypress-io/cypress) from 8.6.0 to 8.7.0.
- [Release notes](https://github.com/cypress-io/cypress/releases)
- [Changelog](https://github.com/cypress-io/cypress/blob/develop/.releaserc.base.js)
- [Commits](https://github.com/cypress-io/cypress/compare/v8.6.0...v8.7.0)

---
updated-dependencies:
- dependency-name: cypress
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-10-28 22:07:09 +02:00
Knut Sveidqvist
d23ff27e1a Merge pull request #2431 from alwinw/bug/2430_doc_typos
Corrected typos in documentation
2021-10-28 17:20:41 +02:00
Knut Sveidqvist
932fabbd42 Merge pull request #2440 from mermaid-js/chore/dependabot
chore(*) : define date and hour for dependencies updates
2021-10-28 17:20:18 +02:00
Matthieu MOREL
4d6792141d chore(*) : define date and hour for dependencies updates 2021-10-26 07:34:23 +02:00
dependabot[bot]
8930a80fdd Bump husky from 7.0.2 to 7.0.4 (#2439)
Bumps [husky](https://github.com/typicode/husky) from 7.0.2 to 7.0.4.
- [Release notes](https://github.com/typicode/husky/releases)
- [Commits](https://github.com/typicode/husky/compare/v7.0.2...v7.0.4)

---
updated-dependencies:
- dependency-name: husky
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-10-25 23:20:20 +02:00
dependabot[bot]
b46db461a2 Bump eslint from 8.0.1 to 8.1.0 (#2438)
Bumps [eslint](https://github.com/eslint/eslint) from 8.0.1 to 8.1.0.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/compare/v8.0.1...v8.1.0)

---
updated-dependencies:
- dependency-name: eslint
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-10-25 23:07:09 +02:00
dependabot[bot]
0be2084b18 Bump babel-jest from 27.3.0 to 27.3.1 (#2437)
Bumps [babel-jest](https://github.com/facebook/jest/tree/HEAD/packages/babel-jest) from 27.3.0 to 27.3.1.
- [Release notes](https://github.com/facebook/jest/releases)
- [Changelog](https://github.com/facebook/jest/blob/main/CHANGELOG.md)
- [Commits](https://github.com/facebook/jest/commits/v27.3.1/packages/babel-jest)

---
updated-dependencies:
- dependency-name: babel-jest
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-10-25 22:52:12 +02:00
dependabot[bot]
5f43f44db0 Bump jest from 27.3.0 to 27.3.1 (#2436)
Bumps [jest](https://github.com/facebook/jest) from 27.3.0 to 27.3.1.
- [Release notes](https://github.com/facebook/jest/releases)
- [Changelog](https://github.com/facebook/jest/blob/main/CHANGELOG.md)
- [Commits](https://github.com/facebook/jest/compare/v27.3.0...v27.3.1)

---
updated-dependencies:
- dependency-name: jest
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-10-25 22:41:08 +02:00
dependabot[bot]
3c996ee4a0 Bump @percy/cli from 1.0.0-beta.69 to 1.0.0-beta.70 (#2435)
Bumps [@percy/cli](https://github.com/percy/cli/tree/HEAD/packages/cli) from 1.0.0-beta.69 to 1.0.0-beta.70.
- [Release notes](https://github.com/percy/cli/releases)
- [Commits](https://github.com/percy/cli/commits/v1.0.0-beta.70/packages/cli)

---
updated-dependencies:
- dependency-name: "@percy/cli"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-10-25 22:39:08 +02:00
dependabot[bot]
fa184320e9 Bump babel-loader from 8.2.2 to 8.2.3 (#2434)
Bumps [babel-loader](https://github.com/babel/babel-loader) from 8.2.2 to 8.2.3.
- [Release notes](https://github.com/babel/babel-loader/releases)
- [Changelog](https://github.com/babel/babel-loader/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel-loader/compare/v8.2.2...v8.2.3)

---
updated-dependencies:
- dependency-name: babel-loader
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-10-25 22:38:43 +02:00
dependabot[bot]
780b3eb95a Bump webpack from 5.58.2 to 5.60.0 (#2433)
Bumps [webpack](https://github.com/webpack/webpack) from 5.58.2 to 5.60.0.
- [Release notes](https://github.com/webpack/webpack/releases)
- [Commits](https://github.com/webpack/webpack/compare/v5.58.2...v5.60.0)

---
updated-dependencies:
- dependency-name: webpack
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-10-25 22:38:05 +02:00
AlwinW
8b35745928 Corrected typos in documentation 2021-10-23 22:57:24 +11:00
Knut Sveidqvist
f8c01acd18 Merge pull request #2427 from mermaid-js/2425_Unicode_handling_for_html_labels
#2425 Unicode handling for HTML labels
2021-10-21 19:58:19 +02:00
Ashish Jain
250c9beff9 #2425 Added new test case 2021-10-21 19:45:15 +02:00
Ashish Jain
24d18eb42a #2425 Unicode handling for HTML labels 2021-10-21 19:37:48 +02:00
Ashish Jain
d144128bf0 Merge pull request #2419 from Zer0n0mask/patch-1
Update gantt.md with milestones info
2021-10-21 18:06:19 +02:00
Ashish Jain
2a87ec2dc2 Merge pull request #2420 from Zer0n0mask/patch-2
Update entityRelationshipDiagram.md
2021-10-21 18:05:50 +02:00
Ashish Jain
d6a4047a52 Merge pull request #2423 from qdechochen/develop
feat: added includes; added excludes date background
2021-10-21 18:05:09 +02:00
Echo Chen
d63b26efc2 feat: added includes; added excludes date background 2021-10-20 18:39:35 +08:00
Tshepang Lekhonkhobe
1ba990be6e Fix typo in n00b-overview (#2418) 2021-10-19 07:06:07 +02:00
dependabot[bot]
7b5e6e95c8 Bump eslint from 8.0.0 to 8.0.1 (#2415)
Bumps [eslint](https://github.com/eslint/eslint) from 8.0.0 to 8.0.1.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/compare/v8.0.0...v8.0.1)

---
updated-dependencies:
- dependency-name: eslint
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-10-19 07:02:40 +02:00
dependabot[bot]
3a77f91ba4 Bump jest from 27.2.5 to 27.3.0 (#2421)
Bumps [jest](https://github.com/facebook/jest) from 27.2.5 to 27.3.0.
- [Release notes](https://github.com/facebook/jest/releases)
- [Changelog](https://github.com/facebook/jest/blob/main/CHANGELOG.md)
- [Commits](https://github.com/facebook/jest/compare/v27.2.5...v27.3.0)

---
updated-dependencies:
- dependency-name: jest
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-10-19 07:01:52 +02:00
dependabot[bot]
84338524c5 Bump webpack-cli from 4.9.0 to 4.9.1 (#2417)
Bumps [webpack-cli](https://github.com/webpack/webpack-cli) from 4.9.0 to 4.9.1.
- [Release notes](https://github.com/webpack/webpack-cli/releases)
- [Changelog](https://github.com/webpack/webpack-cli/blob/master/CHANGELOG.md)
- [Commits](https://github.com/webpack/webpack-cli/compare/webpack-cli@4.9.0...webpack-cli@4.9.1)

---
updated-dependencies:
- dependency-name: webpack-cli
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-10-19 06:35:26 +02:00
dependabot[bot]
e5966f97b3 Bump @percy/cli from 1.0.0-beta.68 to 1.0.0-beta.69 (#2416)
Bumps [@percy/cli](https://github.com/percy/cli/tree/HEAD/packages/cli) from 1.0.0-beta.68 to 1.0.0-beta.69.
- [Release notes](https://github.com/percy/cli/releases)
- [Commits](https://github.com/percy/cli/commits/v1.0.0-beta.69/packages/cli)

---
updated-dependencies:
- dependency-name: "@percy/cli"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-10-19 06:33:58 +02:00
dependabot[bot]
4a0b074967 Bump babel-jest from 27.2.5 to 27.3.0 (#2414)
Bumps [babel-jest](https://github.com/facebook/jest/tree/HEAD/packages/babel-jest) from 27.2.5 to 27.3.0.
- [Release notes](https://github.com/facebook/jest/releases)
- [Changelog](https://github.com/facebook/jest/blob/main/CHANGELOG.md)
- [Commits](https://github.com/facebook/jest/commits/v27.3.0/packages/babel-jest)

---
updated-dependencies:
- dependency-name: babel-jest
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-10-19 06:30:59 +02:00
dependabot[bot]
4d2d99f227 Bump webpack from 5.58.1 to 5.58.2 (#2413)
Bumps [webpack](https://github.com/webpack/webpack) from 5.58.1 to 5.58.2.
- [Release notes](https://github.com/webpack/webpack/releases)
- [Commits](https://github.com/webpack/webpack/compare/v5.58.1...v5.58.2)

---
updated-dependencies:
- dependency-name: webpack
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-10-19 06:30:00 +02:00
Zer0n0mask
23d23251c7 Update entityRelationshipDiagram.md
Just a piece of code that was there but didn't appear as code but just as the resulting graph.
2021-10-18 21:39:05 -03:00
Zer0n0mask
4d477d7e96 Update gantt.md with milestones info
Included a brief explanation about the use of milestones regarding their time location and the code location of the tag with an example.
2021-10-18 21:05:52 -03:00
Knut Sveidqvist
bf378b76f4 Merge branch 'release/8.13.3' 2021-10-14 21:20:57 +02:00
Knut Sveidqvist
0d7d5ddc5f Release 8.13.3 2021-10-14 21:19:28 +02:00
Knut Sveidqvist
ebe8b8d89f Allowing & and = in links 2021-10-14 21:08:42 +02:00
Ashish Jain
4a50995906 Sequence Diagram: Removed eval from popup handling 2021-10-14 21:02:18 +02:00
Ashish Jain
bb3597614a Merge pull request #2387 from lexmin0412/docs/remove-duplicate-content
docs: remove duplicate content
2021-10-14 18:33:15 +02:00
Tshepang Lekhonkhobe
4620a7eeba adding missing word (#2409) 2021-10-14 11:53:35 +02:00
dependabot[bot]
96236187b5 Bump @babel/preset-env from 7.15.6 to 7.15.8 (#2406)
Bumps [@babel/preset-env](https://github.com/babel/babel/tree/HEAD/packages/babel-preset-env) from 7.15.6 to 7.15.8.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.15.8/packages/babel-preset-env)

---
updated-dependencies:
- dependency-name: "@babel/preset-env"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-10-12 06:47:15 +02:00
dependabot[bot]
d325f4b496 Bump eslint from 7.32.0 to 8.0.0 (#2405)
Bumps [eslint](https://github.com/eslint/eslint) from 7.32.0 to 8.0.0.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/master/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/compare/v7.32.0...v8.0.0)

---
updated-dependencies:
- dependency-name: eslint
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-10-12 06:46:48 +02:00
dependabot[bot]
236fd6b231 Bump jest from 27.2.4 to 27.2.5 (#2404)
Bumps [jest](https://github.com/facebook/jest) from 27.2.4 to 27.2.5.
- [Release notes](https://github.com/facebook/jest/releases)
- [Changelog](https://github.com/facebook/jest/blob/main/CHANGELOG.md)
- [Commits](https://github.com/facebook/jest/compare/v27.2.4...v27.2.5)

---
updated-dependencies:
- dependency-name: jest
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-10-11 22:35:27 +02:00
dependabot[bot]
9b32e0b222 Bump webpack from 5.58.0 to 5.58.1 (#2399)
Bumps [webpack](https://github.com/webpack/webpack) from 5.58.0 to 5.58.1.
- [Release notes](https://github.com/webpack/webpack/releases)
- [Commits](https://github.com/webpack/webpack/compare/v5.58.0...v5.58.1)

---
updated-dependencies:
- dependency-name: webpack
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-10-11 22:32:21 +02:00
dependabot[bot]
2c1e8a2a73 Bump babel-jest from 27.2.4 to 27.2.5 (#2403)
Bumps [babel-jest](https://github.com/facebook/jest/tree/HEAD/packages/babel-jest) from 27.2.4 to 27.2.5.
- [Release notes](https://github.com/facebook/jest/releases)
- [Changelog](https://github.com/facebook/jest/blob/main/CHANGELOG.md)
- [Commits](https://github.com/facebook/jest/commits/v27.2.5/packages/babel-jest)

---
updated-dependencies:
- dependency-name: babel-jest
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-10-11 22:23:51 +02:00
dependabot[bot]
aa0e84c3c3 Bump @babel/core from 7.15.5 to 7.15.8 (#2402)
Bumps [@babel/core](https://github.com/babel/babel/tree/HEAD/packages/babel-core) from 7.15.5 to 7.15.8.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.15.8/packages/babel-core)

---
updated-dependencies:
- dependency-name: "@babel/core"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-10-11 22:23:37 +02:00
dependabot[bot]
7d876ea9f2 Bump andymckay/labeler from 1.0.3 to 1.0.4 (#2401)
Bumps [andymckay/labeler](https://github.com/andymckay/labeler) from 1.0.3 to 1.0.4.
- [Release notes](https://github.com/andymckay/labeler/releases)
- [Commits](https://github.com/andymckay/labeler/compare/1.0.3...1.0.4)

---
updated-dependencies:
- dependency-name: andymckay/labeler
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-10-11 22:16:29 +02:00
dependabot[bot]
ea4a49d50e Bump webpack-cli from 4.8.0 to 4.9.0 (#2397)
Bumps [webpack-cli](https://github.com/webpack/webpack-cli) from 4.8.0 to 4.9.0.
- [Release notes](https://github.com/webpack/webpack-cli/releases)
- [Changelog](https://github.com/webpack/webpack-cli/blob/master/CHANGELOG.md)
- [Commits](https://github.com/webpack/webpack-cli/compare/webpack-cli@4.8.0...webpack-cli@4.9.0)

---
updated-dependencies:
- dependency-name: webpack-cli
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-10-11 22:11:49 +02:00
dependabot[bot]
eb5b6966e5 Bump cypress from 8.5.0 to 8.6.0 (#2400)
Bumps [cypress](https://github.com/cypress-io/cypress) from 8.5.0 to 8.6.0.
- [Release notes](https://github.com/cypress-io/cypress/releases)
- [Changelog](https://github.com/cypress-io/cypress/blob/develop/.releaserc.base.js)
- [Commits](https://github.com/cypress-io/cypress/compare/v8.5.0...v8.6.0)

---
updated-dependencies:
- dependency-name: cypress
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-10-11 22:11:34 +02:00
dependabot[bot]
00e716e064 Bump concurrently from 6.2.2 to 6.3.0 (#2398)
Bumps [concurrently](https://github.com/open-cli-tools/concurrently) from 6.2.2 to 6.3.0.
- [Release notes](https://github.com/open-cli-tools/concurrently/releases)
- [Commits](https://github.com/open-cli-tools/concurrently/compare/v6.2.2...v6.3.0)

---
updated-dependencies:
- dependency-name: concurrently
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-10-11 22:11:19 +02:00
dependabot[bot]
cd885e952c Bump @babel/eslint-parser from 7.15.7 to 7.15.8 (#2396)
Bumps [@babel/eslint-parser](https://github.com/babel/babel/tree/HEAD/eslint/babel-eslint-parser) from 7.15.7 to 7.15.8.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.15.8/eslint/babel-eslint-parser)

---
updated-dependencies:
- dependency-name: "@babel/eslint-parser"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-10-11 22:10:28 +02:00
Michael Maier
e2cd2a72aa add example of data flow diagram
See https://github.com/mermaid-js/mermaid/issues/1893
2021-10-09 16:22:17 +02:00
Michael Maier
cd427ab8ba add shape datastore (for nodes of data flow diagram)
See https://github.com/mermaid-js/mermaid/issues/1893
2021-10-09 16:21:57 +02:00
Michael Maier
cefafba062 add brackets [| and |] for datastore nodes of data flow diagrams
See https://github.com/mermaid-js/mermaid/issues/1893
2021-10-09 16:19:42 +02:00
张乐
ddcaf1850f docs: remove duplicate content 2021-10-08 10:46:01 +08:00
Ashish Jain
18ecf479b1 Sequence Diagram Popup : Work _in_progress 2021-10-07 21:52:16 +02:00
Ashish Jain
a06f6f9604 Add sanitize to properties and link in Sequence Diagram 2021-10-07 21:48:44 +02:00
Ashish Jain
35de6d4cbc Merge pull request #2386 from mermaid-js/dependabot/npm_and_yarn/develop/webpack-5.58.0
Bump webpack from 5.55.1 to 5.58.0
2021-10-07 19:48:07 +02:00
Ashish Jain
2bcd66e714 Merge pull request #2380 from mermaid-js/dependabot/npm_and_yarn/develop/webpack-dev-server-4.3.1
Bump webpack-dev-server from 4.3.0 to 4.3.1
2021-10-07 19:47:32 +02:00
dependabot[bot]
4c7ac3fdb6 Bump webpack from 5.55.1 to 5.58.0
Bumps [webpack](https://github.com/webpack/webpack) from 5.55.1 to 5.58.0.
- [Release notes](https://github.com/webpack/webpack/releases)
- [Commits](https://github.com/webpack/webpack/compare/v5.55.1...v5.58.0)

---
updated-dependencies:
- dependency-name: webpack
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-10-07 17:35:51 +00:00
Ashish Jain
cf3ded482f Merge pull request #2376 from Yash-Singh1/patch-1
Document two-way relations and fix relationship docs for class diagrams
2021-10-07 19:30:11 +02:00
Ashish Jain
dcca4896f0 Merge pull request #2375 from OlegAxenow/bug/2374_console_in_sanitizeText
Comment console.log in sanitizeText
2021-10-07 19:28:10 +02:00
Ashish Jain
d267f84030 Merge pull request #2372 from sidharthv96/fix/2371
Add esm build. Fixes #2371
2021-10-07 19:27:06 +02:00
Ashish Jain
b2f93b49ba Merge pull request #2373 from lexmin0412/docs/chinese-readme
docs: add Chinese README
2021-10-07 19:24:56 +02:00
Ashish Jain
1c00608b27 Merge pull request #2369 from mmorel-35/jison
group jison loader and transformer
2021-10-07 19:10:11 +02:00
dependabot[bot]
e3c1354ce0 Bump webpack-dev-server from 4.3.0 to 4.3.1
Bumps [webpack-dev-server](https://github.com/webpack/webpack-dev-server) from 4.3.0 to 4.3.1.
- [Release notes](https://github.com/webpack/webpack-dev-server/releases)
- [Changelog](https://github.com/webpack/webpack-dev-server/blob/master/CHANGELOG.md)
- [Commits](https://github.com/webpack/webpack-dev-server/compare/v4.3.0...v4.3.1)

---
updated-dependencies:
- dependency-name: webpack-dev-server
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-10-04 20:03:27 +00:00
Yash Singh
93a1961762 Add another relation type 2021-10-03 15:11:57 -07:00
Yash Singh
c04fdd250c Document two-way relations and fix relationship docs for class diagrams 2021-10-03 15:10:15 -07:00
Oleg Aksenov
626fbe6de8 Update src/diagrams/common/common.js
Co-authored-by: Matthieu MOREL <mmorel-35@users.noreply.github.com>
2021-10-03 18:56:37 +03:00
Oleg Aksenov
b22422f4b8 Comment console.log in sanitizeText
This is to avoid console window be flooded with 'security level' messages
2021-10-03 18:08:53 +03:00
lexmin0412
b0b85e12a6 docs: add Chinese README 2021-10-03 00:02:40 +08:00
Sidharth Vinod
b500a312b6 Add export map, use mjs extension 2021-10-01 19:19:32 +05:30
Sidharth Vinod
cac354caa9 fix: Unify build configs 2021-10-01 02:26:42 +05:30
Sidharth Vinod
1c8c635e48 Add esm build. Fixes #2371 2021-10-01 01:49:17 +05:30
Matthieu MOREL
9c48703fb1 group jison loader and transformer 2021-09-30 00:07:57 +02:00
dependabot[bot]
d040883286 Bump eslint-plugin-prettier from 3.4.1 to 4.0.0 (#2368)
Bumps [eslint-plugin-prettier](https://github.com/prettier/eslint-plugin-prettier) from 3.4.1 to 4.0.0.
- [Release notes](https://github.com/prettier/eslint-plugin-prettier/releases)
- [Changelog](https://github.com/prettier/eslint-plugin-prettier/blob/master/CHANGELOG.md)
- [Commits](https://github.com/prettier/eslint-plugin-prettier/commits/v4.0.0)

---
updated-dependencies:
- dependency-name: eslint-plugin-prettier
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-09-29 22:17:55 +02:00
dependabot[bot]
b2c059d56b Bump dompurify from 2.3.1 to 2.3.3 (#2367)
Bumps [dompurify](https://github.com/cure53/DOMPurify) from 2.3.1 to 2.3.3.
- [Release notes](https://github.com/cure53/DOMPurify/releases)
- [Commits](https://github.com/cure53/DOMPurify/compare/2.3.1...2.3.3)

---
updated-dependencies:
- dependency-name: dompurify
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-09-29 22:16:37 +02:00
dependabot[bot]
15b9a25aa4 Bump webpack from 5.53.0 to 5.55.1 (#2366)
Bumps [webpack](https://github.com/webpack/webpack) from 5.53.0 to 5.55.1.
- [Release notes](https://github.com/webpack/webpack/releases)
- [Commits](https://github.com/webpack/webpack/compare/v5.53.0...v5.55.1)

---
updated-dependencies:
- dependency-name: webpack
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-09-29 22:05:03 +02:00
dependabot[bot]
e01855ca9c Bump babel-jest from 27.2.1 to 27.2.4 (#2362)
Bumps [babel-jest](https://github.com/facebook/jest/tree/HEAD/packages/babel-jest) from 27.2.1 to 27.2.4.
- [Release notes](https://github.com/facebook/jest/releases)
- [Changelog](https://github.com/facebook/jest/blob/main/CHANGELOG.md)
- [Commits](https://github.com/facebook/jest/commits/v27.2.4/packages/babel-jest)

---
updated-dependencies:
- dependency-name: babel-jest
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-09-29 21:45:42 +02:00
dependabot[bot]
618ee6d95f Bump cypress from 8.1.0 to 8.5.0 (#2365)
Bumps [cypress](https://github.com/cypress-io/cypress) from 8.1.0 to 8.5.0.
- [Release notes](https://github.com/cypress-io/cypress/releases)
- [Changelog](https://github.com/cypress-io/cypress/blob/develop/.releaserc.base.js)
- [Commits](https://github.com/cypress-io/cypress/compare/v8.1.0...v8.5.0)

---
updated-dependencies:
- dependency-name: cypress
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-09-29 21:43:23 +02:00
dependabot[bot]
8f82d86e7c Bump jest from 27.2.1 to 27.2.4 (#2363)
Bumps [jest](https://github.com/facebook/jest) from 27.2.1 to 27.2.4.
- [Release notes](https://github.com/facebook/jest/releases)
- [Changelog](https://github.com/facebook/jest/blob/main/CHANGELOG.md)
- [Commits](https://github.com/facebook/jest/compare/v27.2.1...v27.2.4)

---
updated-dependencies:
- dependency-name: jest
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-09-29 21:33:21 +02:00
dependabot[bot]
b3525deeab Bump js-base64 from 3.7.1 to 3.7.2 (#2349)
Bumps [js-base64](https://github.com/dankogai/js-base64) from 3.7.1 to 3.7.2.
- [Release notes](https://github.com/dankogai/js-base64/releases)
- [Commits](https://github.com/dankogai/js-base64/compare/3.7.1...3.7.2)

---
updated-dependencies:
- dependency-name: js-base64
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-09-29 21:19:45 +02:00
dependabot[bot]
7d81fd3c3c Bump terser-webpack-plugin from 4.2.3 to 5.2.4 (#2364)
Bumps [terser-webpack-plugin](https://github.com/webpack-contrib/terser-webpack-plugin) from 4.2.3 to 5.2.4.
- [Release notes](https://github.com/webpack-contrib/terser-webpack-plugin/releases)
- [Changelog](https://github.com/webpack-contrib/terser-webpack-plugin/blob/master/CHANGELOG.md)
- [Commits](https://github.com/webpack-contrib/terser-webpack-plugin/compare/v4.2.3...v5.2.4)

---
updated-dependencies:
- dependency-name: terser-webpack-plugin
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-09-29 21:14:15 +02:00
Knut Sveidqvist
d48af035d8 Merge pull request #2351 from mermaid-js/dependabot/npm_and_yarn/develop/webpack-dev-server-4.3.0
Bump webpack-dev-server from 4.2.1 to 4.3.0
2021-09-29 20:43:48 +02:00
dependabot[bot]
ebba764c85 Bump webpack-dev-server from 4.2.1 to 4.3.0
Bumps [webpack-dev-server](https://github.com/webpack/webpack-dev-server) from 4.2.1 to 4.3.0.
- [Release notes](https://github.com/webpack/webpack-dev-server/releases)
- [Changelog](https://github.com/webpack/webpack-dev-server/blob/master/CHANGELOG.md)
- [Commits](https://github.com/webpack/webpack-dev-server/compare/v4.2.1...v4.3.0)

---
updated-dependencies:
- dependency-name: webpack-dev-server
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-09-29 18:43:28 +00:00
Knut Sveidqvist
a5c4d0783d Updated lockfile 2021-09-29 20:38:58 +02:00
Knut Sveidqvist
3772afb40c Merge pull request #2324 from mermaid-js/dependabot/npm_and_yarn/develop/webpack-5.53.0
Bump webpack from 4.46.0 to 5.53.0
2021-09-29 20:34:37 +02:00
Ashish Jain
19343e890e Freshly built dist files 2021-09-29 20:30:47 +02:00
Ashish Jain
5661b43168 Merge branch 'release/8.13.2' into develop 2021-09-29 20:28:38 +02:00
Ashish Jain
aa666d1829 Merge branch 'release/8.13.2' into develop 2021-09-29 20:22:57 +02:00
Knut Sveidqvist
2758d64778 Release 8.13.2 2021-09-29 20:22:45 +02:00
Ashish Jain
5d5808880f Merge branch 'release/8.13.1' into develop 2021-09-29 20:22:09 +02:00
Knut Sveidqvist
8ee3155f2a Fix for broken test 2021-09-29 20:20:44 +02:00
Ashish Jain
62cc720607 Merge pull request #2353 from anugs/patch-1
Update n00b-syntaxReference.md
2021-09-29 20:14:53 +02:00
Ashish Jain
900d7e0974 Merge pull request #2354 from mermaid-js/sidharthv96-patch-1
Update n00b-gettingStarted.md
2021-09-29 20:14:15 +02:00
Ashish Jain
7102c1205e Merge pull request #2355 from Yash-Singh1/patch-1
Fix confusing docs
2021-09-29 20:13:18 +02:00
Ashish Jain
ec05e2333a Merge pull request #2356 from mermaid-js/chore/cleanup
cleanup : remove unused files
2021-09-29 20:12:24 +02:00
Ashish Jain
8540a2757e Merge pull request #2357 from gerardnico/patch-1
Doc change: Added a full integration with mermaid for Dokuwiki
2021-09-29 20:11:23 +02:00
Ashish Jain
ce1a8d8f6a Merge pull request #2358 from lexmin0412/docs/fix-tutorials-doc
fix getting spelling errors
2021-09-29 20:10:40 +02:00
Ashish Jain
637ae09192 Merge pull request #2359 from anugs/patch-3
Update README.md
2021-09-29 20:09:57 +02:00
Ashish Jain
4f59e2d28b Merge pull request #2360 from anugs/patch-4
Update n00b-gettingStarted.md
2021-09-29 20:08:49 +02:00
Ashish Jain
cb2294d6f2 Merge branch '2292_Class_Diagram_curly_brace_space_issue' into release/8.13.2 2021-09-29 20:06:32 +02:00
Knut Sveidqvist
95e6efc218 Merge branch 'release/8.13.1' 2021-09-29 20:05:52 +02:00
Knut Sveidqvist
029042393c Release 8.13.1 2021-09-29 20:05:05 +02:00
Knut Sveidqvist
7ad509cc7a Correct handling of the note object foir state diagrams when sanitizing it 2021-09-29 19:48:27 +02:00
anugs
f6cd4547ab Update n00b-gettingStarted.md 2021-09-29 22:18:46 +05:30
Knut Sveidqvist
dd088bc603 test commit 2021-09-29 18:48:09 +02:00
Knut Sveidqvist
c5d091d445 Handling of svg labels for state diagrams 2021-09-29 18:29:39 +02:00
Ashish Jain
38ef061175 Reverting PR #2312 2021-09-29 18:22:35 +02:00
anugs
715d0aced3 Update README.md 2021-09-29 21:18:45 +05:30
Ashish Jain
55eebd9309 2292 Fix for broken class diagram on space after the '{' curly brace 2021-09-29 17:13:14 +02:00
lexmin0412
cce8821a83 fix getting spelling errors 2021-09-29 19:02:34 +08:00
Knut Sveidqvist
d45765dab5 Lint fixes + fix for unit tests 2021-09-29 09:35:14 +02:00
Nickeau
54a4aafd06 Added a full integration with mermaid for Dokuwiki 2021-09-29 09:21:06 +02:00
Knut Sveidqvist
e4e8a00acc Test fix + empty relation 2021-09-29 08:57:54 +02:00
Knut Sveidqvist
db8517a7f9 Adding xss tests 2021-09-29 08:52:12 +02:00
Knut Sveidqvist
35d8f33542 Merge branch 'master'
Conflicts:
	cypress/platform/xss7.html
2021-09-29 08:51:54 +02:00
Knut Sveidqvist
75b79e1b23 State diagram sanitization 2021-09-29 08:45:07 +02:00
Matthieu MOREL
66df007ea8 Delete .travis.yml 2021-09-29 07:43:25 +02:00
Matthieu MOREL
9da885b2f8 Delete .percy.old.yml 2021-09-29 07:43:04 +02:00
Matthieu MOREL
efa063d8d0 Delete dist_dev directory 2021-09-29 07:42:51 +02:00
Yash Singh
fcd4cc17d3 Fix confusing docs 2021-09-28 17:06:48 -07:00
Sidharth Vinod
550cf9b102 Update n00b-gettingStarted.md
Fix Spacing Bug
Update live editor links
2021-09-28 14:56:13 +05:30
anugs
69639bb61c Update n00b-syntaxReference.md 2021-09-28 12:01:20 +05:30
Knut Sveidqvist
4839e6a8b3 merge 2021-09-23 19:42:51 +02:00
Knut Sveidqvist
477c4f1c88 Merge pull request #2340 from lgasp/patch-1
Add a milestone to docs
2021-09-23 19:33:57 +02:00
Knut Sveidqvist
b62d0d974f Merge pull request #2312 from cm-wada-yusuke/bug/2160-fixed-height-useMaxWith
configureSvgSize should make height 100% when useMaxWidth is true.
2021-09-23 19:32:43 +02:00
Ashish Jain
5a433d9bf8 Fix for broken diagram in index.html 2021-09-23 19:29:24 +02:00
Knut Sveidqvist
f91920ab90 Link to new version of mermaid 2021-09-23 19:01:53 +02:00
Knut Sveidqvist
83d3b31a1a Merge branch 'release/8.13.0' 2021-09-23 18:59:51 +02:00
Knut Sveidqvist
97268b9876 Switched banner 2021-09-23 18:53:59 +02:00
Knut Sveidqvist
b2fb9f421a Merge branch 'master' of github.com:mermaid-js/mermaid 2021-09-23 18:52:57 +02:00
Knut Sveidqvist
6b0105cc3b Switch banner in README file 2021-09-23 18:52:08 +02:00
Knut Sveidqvist
0b2d0ce34f Merge branch 'release/8.13.0' into develop 2021-09-23 18:43:37 +02:00
Knut Sveidqvist
5c4ee44787 Switching book banner 2021-09-23 18:41:49 +02:00
Ashish Jain
165a10ac37 Fix for broken classDiagram-v2.spec.js test case 2021-09-23 18:36:45 +02:00
Knut Sveidqvist
b8f68325ef Version 8.13.0 2021-09-23 18:27:25 +02:00
lgasp
2f2eb67b5f Add a milestone to docs
Added:
* milestone example
* milestone section with short explanation
2021-09-21 13:29:59 +02:00
dependabot[bot]
5b1f574167 Bump webpack from 4.46.0 to 5.53.0
Bumps [webpack](https://github.com/webpack/webpack) from 4.46.0 to 5.53.0.
- [Release notes](https://github.com/webpack/webpack/releases)
- [Commits](https://github.com/webpack/webpack/compare/v4.46.0...v5.53.0)

---
updated-dependencies:
- dependency-name: webpack
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-09-21 10:25:25 +02:00
dependabot[bot]
a990718b71 Bump dompurify from 2.3.1 to 2.3.3 (#2336)
Bumps [dompurify](https://github.com/cure53/DOMPurify) from 2.3.1 to 2.3.3.
- [Release notes](https://github.com/cure53/DOMPurify/releases)
- [Commits](https://github.com/cure53/DOMPurify/compare/2.3.1...2.3.3)

---
updated-dependencies:
- dependency-name: dompurify
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-09-21 09:32:00 +02:00
dependabot[bot]
8670fe9a4f Bump eslint-plugin-prettier from 3.4.0 to 4.0.0 (#2339)
Bumps [eslint-plugin-prettier](https://github.com/prettier/eslint-plugin-prettier) from 3.4.0 to 4.0.0.
- [Release notes](https://github.com/prettier/eslint-plugin-prettier/releases)
- [Changelog](https://github.com/prettier/eslint-plugin-prettier/blob/master/CHANGELOG.md)
- [Commits](https://github.com/prettier/eslint-plugin-prettier/commits/v4.0.0)

---
updated-dependencies:
- dependency-name: eslint-plugin-prettier
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-09-21 07:58:55 +02:00
dependabot[bot]
2a22c3396a Bump @babel/eslint-parser from 7.15.0 to 7.15.7 (#2338)
Bumps [@babel/eslint-parser](https://github.com/babel/babel/tree/HEAD/eslint/babel-eslint-parser) from 7.15.0 to 7.15.7.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.15.7/eslint/babel-eslint-parser)

---
updated-dependencies:
- dependency-name: "@babel/eslint-parser"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-09-21 07:58:26 +02:00
dependabot[bot]
20b139bf7f Bump babel-jest from 27.0.6 to 27.2.1 (#2337)
Bumps [babel-jest](https://github.com/facebook/jest/tree/HEAD/packages/babel-jest) from 27.0.6 to 27.2.1.
- [Release notes](https://github.com/facebook/jest/releases)
- [Changelog](https://github.com/facebook/jest/blob/main/CHANGELOG.md)
- [Commits](https://github.com/facebook/jest/commits/v27.2.1/packages/babel-jest)

---
updated-dependencies:
- dependency-name: babel-jest
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-09-21 00:51:22 +02:00
dependabot[bot]
a838e52fea Bump start-server-and-test from 1.13.1 to 1.14.0 (#2335)
Bumps [start-server-and-test](https://github.com/bahmutov/start-server-and-test) from 1.13.1 to 1.14.0.
- [Release notes](https://github.com/bahmutov/start-server-and-test/releases)
- [Commits](https://github.com/bahmutov/start-server-and-test/compare/v1.13.1...v1.14.0)

---
updated-dependencies:
- dependency-name: start-server-and-test
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-09-21 00:35:26 +02:00
dependabot[bot]
918cea5291 Bump @percy/cli from 1.0.0-beta.65 to 1.0.0-beta.68 (#2334)
Bumps [@percy/cli](https://github.com/percy/cli/tree/HEAD/packages/cli) from 1.0.0-beta.65 to 1.0.0-beta.68.
- [Release notes](https://github.com/percy/cli/releases)
- [Commits](https://github.com/percy/cli/commits/v1.0.0-beta.68/packages/cli)

---
updated-dependencies:
- dependency-name: "@percy/cli"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-09-21 00:29:16 +02:00
dependabot[bot]
b7ecf3b9dd Bump js-base64 from 3.6.1 to 3.7.1 (#2333)
Bumps [js-base64](https://github.com/dankogai/js-base64) from 3.6.1 to 3.7.1.
- [Release notes](https://github.com/dankogai/js-base64/releases)
- [Commits](https://github.com/dankogai/js-base64/compare/3.6.1...3.7.1)

---
updated-dependencies:
- dependency-name: js-base64
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-09-21 00:24:31 +02:00
dependabot[bot]
b90a5e2b0b Bump @babel/preset-env from 7.15.0 to 7.15.6 (#2332)
Bumps [@babel/preset-env](https://github.com/babel/babel/tree/HEAD/packages/babel-preset-env) from 7.15.0 to 7.15.6.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.15.6/packages/babel-preset-env)

---
updated-dependencies:
- dependency-name: "@babel/preset-env"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-09-21 00:12:06 +02:00
dependabot[bot]
1deef137a9 Bump husky from 7.0.1 to 7.0.2 (#2331)
Bumps [husky](https://github.com/typicode/husky) from 7.0.1 to 7.0.2.
- [Release notes](https://github.com/typicode/husky/releases)
- [Commits](https://github.com/typicode/husky/compare/v7.0.1...v7.0.2)

---
updated-dependencies:
- dependency-name: husky
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-09-21 00:03:47 +02:00
dependabot[bot]
8baf553a49 Bump prettier from 2.3.2 to 2.4.1 (#2330)
Bumps [prettier](https://github.com/prettier/prettier) from 2.3.2 to 2.4.1.
- [Release notes](https://github.com/prettier/prettier/releases)
- [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prettier/prettier/compare/2.3.2...2.4.1)

---
updated-dependencies:
- dependency-name: prettier
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-09-21 00:00:14 +02:00
dependabot[bot]
d3afc8a245 Bump tmpl from 1.0.4 to 1.0.5 (#2327)
Bumps [tmpl](https://github.com/daaku/nodejs-tmpl) from 1.0.4 to 1.0.5.
- [Release notes](https://github.com/daaku/nodejs-tmpl/releases)
- [Commits](https://github.com/daaku/nodejs-tmpl/commits/v1.0.5)

---
updated-dependencies:
- dependency-name: tmpl
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-09-20 23:53:01 +02:00
dependabot[bot]
cc4476031a Bump axios from 0.21.1 to 0.21.4 (#2328)
Bumps [axios](https://github.com/axios/axios) from 0.21.1 to 0.21.4.
- [Release notes](https://github.com/axios/axios/releases)
- [Changelog](https://github.com/axios/axios/blob/master/CHANGELOG.md)
- [Commits](https://github.com/axios/axios/compare/v0.21.1...v0.21.4)

---
updated-dependencies:
- dependency-name: axios
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-09-20 23:50:26 +02:00
dependabot[bot]
3a2c8456d7 Bump tar from 6.1.0 to 6.1.11 (#2326)
Bumps [tar](https://github.com/npm/node-tar) from 6.1.0 to 6.1.11.
- [Release notes](https://github.com/npm/node-tar/releases)
- [Changelog](https://github.com/npm/node-tar/blob/main/CHANGELOG.md)
- [Commits](https://github.com/npm/node-tar/compare/v6.1.0...v6.1.11)

---
updated-dependencies:
- dependency-name: tar
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-09-20 23:47:47 +02:00
dependabot[bot]
9cb1a566c1 Bump cypress from 8.1.0 to 8.4.1 (#2325)
Bumps [cypress](https://github.com/cypress-io/cypress) from 8.1.0 to 8.4.1.
- [Release notes](https://github.com/cypress-io/cypress/releases)
- [Changelog](https://github.com/cypress-io/cypress/blob/develop/.releaserc.base.js)
- [Commits](https://github.com/cypress-io/cypress/compare/v8.1.0...v8.4.1)

---
updated-dependencies:
- dependency-name: cypress
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-09-20 23:46:14 +02:00
dependabot[bot]
d2707bbb6a Bump jest from 27.0.6 to 27.2.1 (#2329)
Bumps [jest](https://github.com/facebook/jest) from 27.0.6 to 27.2.1.
- [Release notes](https://github.com/facebook/jest/releases)
- [Changelog](https://github.com/facebook/jest/blob/main/CHANGELOG.md)
- [Commits](https://github.com/facebook/jest/compare/v27.0.6...v27.2.1)

---
updated-dependencies:
- dependency-name: jest
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-09-20 23:43:14 +02:00
dependabot[bot]
88f30a26b2 Bump @babel/core from 7.14.8 to 7.15.5 (#2295)
Bumps [@babel/core](https://github.com/babel/babel/tree/HEAD/packages/babel-core) from 7.14.8 to 7.15.5.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.15.5/packages/babel-core)

---
updated-dependencies:
- dependency-name: "@babel/core"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-09-20 23:20:44 +02:00
dependabot[bot]
61d16b682b Bump webpack-dev-server from 3.11.2 to 4.2.1 (#2323)
* Bump webpack-dev-server from 3.11.2 to 4.2.1

Bumps [webpack-dev-server](https://github.com/webpack/webpack-dev-server) from 3.11.2 to 4.2.1.
- [Release notes](https://github.com/webpack/webpack-dev-server/releases)
- [Changelog](https://github.com/webpack/webpack-dev-server/blob/master/CHANGELOG.md)
- [Commits](https://github.com/webpack/webpack-dev-server/compare/v3.11.2...v4.2.1)

---
updated-dependencies:
- dependency-name: webpack-dev-server
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Matthieu MOREL <mmorel-35@users.noreply.github.com>
2021-09-20 23:19:22 +02:00
Knut Sveidqvist
1c3f94c9ec Merge pull request #2276 from eajenkins/feature/2249_sequence_diagram_popup_menus
Initial implementation for Issue#2249.
2021-09-18 13:28:29 +02:00
Knut Sveidqvist
004e7e376d Merge branch 'develop' into feature/2249_sequence_diagram_popup_menus 2021-09-18 10:19:07 +02:00
Knut Sveidqvist
549011edf4 Merge pull request #2318 from mermaid-js/2315_adding_actor_shape
2315 adding actor shape
2021-09-18 10:15:10 +02:00
Knut Sveidqvist
432267c811 #2315 Fix for broken tests 2021-09-18 10:05:53 +02:00
Knut Sveidqvist
0fcabfae05 #2315 Fixing issue with padding between actors and content in sequence diagram 2021-09-18 08:26:49 +02:00
Knut Sveidqvist
9faa5acb21 #2315 Adding docs and integration tests 2021-09-18 08:03:34 +02:00
Knut Sveidqvist
9c511559ff #2315 Adding to docs and an integration test 2021-09-18 07:51:15 +02:00
Neil Cuzon
f9a4c8eb0e Update usage.md 2021-09-17 19:12:25 -07:00
Neil Cuzon
5f27987ca2 Update usage.md 2021-09-17 19:00:51 -07:00
Neil Cuzon
866ee997d9 Update usage.md 2021-09-17 18:49:47 -07:00
Neil Cuzon
c82b1cee8e Update usage.md 2021-09-17 18:39:44 -07:00
Knut Sveidqvist
6ce1c80a47 #2315 Adding the possibility to add actor figures as participants 2021-09-16 20:43:10 +02:00
Yusuke Wada
0839fadbc2 fix e2e 2021-09-15 12:47:24 +09:00
eajenkins
96977e70b3 Cleaned up remaining prettier errors. 2021-09-14 14:26:43 -07:00
Yusuke Wada
a448af2897 add spec 2021-09-14 18:41:51 +09:00
Yusuke Wada
20aaf644fa useMaxWidth should make height 100% too. 2021-09-14 18:28:15 +09:00
Neil Cuzon
0d91eee5e0 Merge pull request #2282 from new-pac/develop
Emoji front
2021-09-13 20:13:05 -07:00
Knut Sveidqvist
e01ad572a5 Merge pull request #2269 from Xstoudi/feature/field-classifier
Feature: field static classifier
2021-09-13 21:45:55 +02:00
Knut Sveidqvist
8bd830c991 Merge branch 'develop' into feature/field-classifier 2021-09-13 21:45:47 +02:00
eajenkins
85d33ecccd Added support for a new link syntax per recommendation:
link <actor>: <label> @ <link-url>

Removed documentation for class/icon definitions until we can finalize the design for this.

Fixed prettier errors.
2021-09-10 16:27:07 -07:00
Knut Sveidqvist
b6ba4b2fd8 Merge pull request #2237 from RonaldZielaznicki/2070_more_columns_for_entity_relationship_diagrams
2070: Update ER Diagram to have keys and comments.
2021-09-09 17:50:38 +02:00
Knut Sveidqvist
37c6837dc1 Merge pull request #2274 from Yash-Singh1/imageOptimize
Optimize Images
2021-09-09 17:24:19 +02:00
Knut Sveidqvist
08f2f9aef0 Merge pull request #2275 from Yash-Singh1/interpolationDocs
Document curve interpolation
2021-09-09 17:10:48 +02:00
Knut Sveidqvist
09461fd3df Merge pull request #2304 from Swaagie/patch-1
Fix live editor link
2021-09-09 17:08:19 +02:00
Knut Sveidqvist
b8996ce50b Merge pull request #2300 from mmorel-35/patch-1
chore(ci): fix andymckay/labeler configuration
2021-09-09 17:07:10 +02:00
Knut Sveidqvist
857f6ecc81 Merge pull request #2299 from mmorel-35/bug/2297_pr_labeler
chore(ci) : fix pr-labeler failure
2021-09-09 17:06:45 +02:00
Martijn Swaagman
f5963b8ea5 Fix live editor link 2021-09-09 12:17:20 +02:00
Matthieu MOREL
904849e156 chore(ci): fix andymckay/labeler configuration 2021-09-07 09:41:58 +02:00
Matthieu MOREL
b9513c80eb chore(ci) : fix pr-labeler failure
Signed-off-by: Matthieu MOREL <mmorel-35@users.noreply.github.com>
2021-09-07 09:34:25 +02:00
eajenkins
b3210ed2ef Added sanitization of the links to prevent script injection attacks. 2021-09-02 11:59:43 -07:00
Zuorong Zhang
6dbed7964b Emoji front
Make it look neater
2021-08-31 09:37:28 +08:00
E Jenkins
ce6d8576ae Merge branch 'develop' into feature/2249_sequence_diagram_popup_menus 2021-08-27 15:02:11 -07:00
eajenkins
291bec7e90 Initial implementation for Issue#2249.
Includes changes to sequence diagram code to enable popup menus and individualized styling of actors
Includes unit and e2e tests.
Includes updates to the md file for sequencediagrams.
2021-08-27 10:56:56 -07:00
Xavier Stouder
5997227997 chore: add the static field to the new renderer 2021-08-27 09:14:20 +02:00
Yash-Singh1
c73b04111e Document curve interpolation 2021-08-26 17:45:08 -07:00
Yash-Singh1
05637b1eff Optimize Images 2021-08-26 17:28:11 -07:00
Ashish Jain
48b6a32fe1 UPdated Mermaid version to 8.12.0 2021-08-26 19:43:57 +02:00
Ashish Jain
579e79575b Merge branch 'release/8.12.0' 2021-08-26 19:42:17 +02:00
Ashish Jain
296a64f465 Updated the version id 2021-08-26 19:32:05 +02:00
Ashish Jain
3ad190855b Merge pull request #2273 from mermaid-js/2272_switching_flopwchart_renderer_in_docs
#2272 Switching the renderer in the docs
2021-08-26 18:58:48 +02:00
Knut Sveidqvist
206a35ebd9 #2272 Switching the renderer in the docs 2021-08-26 18:55:47 +02:00
Ashish Jain
8acab4bba6 Merge pull request #2225 from danielsitnik/develop
add Codedoc plugin
2021-08-26 18:43:08 +02:00
Ashish Jain
abd3b18727 Merge pull request #2260 from 72636c/bug/percy_migrate_dev_dependency
Move `@percy/migrate` to devDependencies
2021-08-26 18:40:53 +02:00
Ashish Jain
f07a777194 Merge pull request #2271 from mermaid-js/2270_direction_class
2270 Adding support for direction statements in class diagrams.
2021-08-26 18:30:12 +02:00
Ashish Jain
cd60a30aeb Merge pull request #2241 from Yash-Singh1/patch-1
Add nano to integrations
2021-08-26 18:24:14 +02:00
Ashish Jain
2e02f843ad Merge pull request #2246 from reetghosh1/bug/1794_Unequal_Arrowhead_bug
Fixed Unequal Arrow Bug
2021-08-26 18:22:47 +02:00
Ashish Jain
fddc408cd9 Merge pull request #2254 from mmorel-35/patch-1
use right tag for andymckay/labeler
2021-08-26 18:20:28 +02:00
Ashish Jain
d4f0c0808a Merge pull request #2259 from Clint-Chester/develop
Markdown Diagrams Extension for Chrome Webstore
2021-08-26 18:19:40 +02:00
Ashish Jain
dbdee1f7f8 Merge pull request #2266 from jmelfi/docs/2257_Requirements_Diagram_Table_Correction
Fix to table in documentation
2021-08-26 18:10:47 +02:00
Ashish Jain
bae74bcc95 Merge pull request #2257 from mermaid-js/2256_class_switch_to_ng_renderer
Switch default renderer for class diagrams to the next generation renderer
2021-08-26 18:08:48 +02:00
Knut Sveidqvist
bc31125bc6 Updating the docs with direction statements 2021-08-26 17:27:34 +02:00
Ashish Jain
d32fb0e4c0 Fix for classDiagram-v2 support for cardinality label positioning 2021-08-26 17:18:05 +02:00
Knut Sveidqvist
0658a363cb #2270 Add support for direction statements for classDiagrams 2021-08-26 17:05:10 +02:00
Xavier Stouder
186fb03048 doc: add static field notice 2021-08-26 11:42:11 +02:00
Xavier Stouder
8db827e429 chore: fix regexp 2021-08-26 11:37:14 +02:00
Xavier Stouder
46a7039ae9 test: e2e test 2021-08-26 11:36:21 +02:00
Xavier Stouder
8a8f792d4b fix: abstract field doesnt make any sense 2021-08-26 11:00:39 +02:00
Xavier Stouder
c0c978bbdf feat: add the possibility to use classifiers on fields of class diagrams
fix #1953
2021-08-26 10:53:03 +02:00
Joseph Melfi
ff75349d95 Fix to table in documentation
Markdown broken in table at line 65. Added in necessary additions to correct documentation to make readable and easier to follow properly in the future.
2021-08-25 00:24:52 -07:00
Ryan Ling
e88c710fd3 Move @percy/migrate to devDependencies
Percy is used for internal visual testing; consumers shouldn't need to
install it. This should resolve a transitive vulnerability picked up by
security scanners on an outdated version of Lodash:

@percy/migrate@0.11.0 › @oclif/plugin-help@3.2.3 › lodash.template@4.5.0

https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-23337
2021-08-21 13:04:50 +10:00
Ashish Jain
0fba1c06b4 Updated test cases for class diagram v2 2021-08-20 17:28:57 +02:00
Ashish Jain
69a9829041 Updated test cases for class diagram v2 2021-08-20 17:12:46 +02:00
Clint Chester
d68c1958b5 Markdown Diagrams Extension for Chrome Webstore
The Markdown Diagrams Extension also had an extension for Chromes so updating the documentation to include this link.
2021-08-20 18:39:47 +08:00
Ashish Jain
2434a94aae Updated test cases for class diagram v2 2021-08-19 21:27:11 +02:00
Knut Sveidqvist
b80ebb4fcb Merge branch '2256_class_switch_to_ng_renderer' of github.com:mermaid-js/mermaid into 2256_class_switch_to_ng_renderer 2021-08-19 21:16:31 +02:00
Knut Sveidqvist
fd6e59174e Fix for dark theme, class diagrams (v2) 2021-08-19 21:16:26 +02:00
Ashish Jain
54ef5b0bee Fix for classDiagram-v2 support for cardinality where HTML label is true 2021-08-19 21:15:21 +02:00
Knut Sveidqvist
b0c09a5b0f #2256 Switch default renderer for class diagrams to the next generation renderer 2021-08-19 20:11:11 +02:00
Ashish Jain
719de71de4 Fix for broken Pie Diagram for d3 v6 upgrade 2021-08-19 19:50:20 +02:00
Ashish Jain
571816fc28 Updating prettierrc 2021-08-19 19:43:01 +02:00
Ashish Jain
adcc25db8e Fix for broken cypress test 2021-08-19 19:42:13 +02:00
Ashish Jain
7c97f68ee2 Merge branch 'develop' of https://github.com/knsv/mermaid into develop 2021-08-19 19:39:15 +02:00
Ashish Jain
2dfc9a7973 Lint fixes 2021-08-19 19:37:24 +02:00
Knut Sveidqvist
c04aac4ae0 Merge pull request #2255 from mermaid-js/2253_class_diagram_v2_fixes
2253 class diagram v2 fixes
2021-08-19 19:31:29 +02:00
Ashish Jain
798a0ad783 Fix for broken Pie Diagram for d3 v6 upgrade 2021-08-19 19:04:14 +02:00
Matthieu MOREL
935cc3b098 use right tag for andymckay/labeler 2021-08-19 18:55:42 +02:00
Ashish Jain
5ef2ad5536 Fix for classDiagram-v2 support for cardinality 2021-08-19 18:48:19 +02:00
Ashish Jain
0276a67417 Fix for classDiagram-v2 support for generics using '~' & method emphasis 2021-08-19 18:00:49 +02:00
Ashish Jain
46a3d10e8a Fix for classDiagram-v2 support for generics using '~' 2021-08-19 17:51:22 +02:00
Knut Sveidqvist
d09dea7e5e Merge pull request #2224 from mmorel-35/2196_fix_e2e
2196 fix e2e
2021-08-19 16:47:47 +02:00
MOREL Matthieu
55faa3cb1a yarn build and adapt e2e tests
Co-Authored-By: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-08-18 16:49:00 +02:00
Reet Ghosh
d9a9eb56a7 Fixed Unequal Arrow Bug 2021-08-17 22:52:10 +05:30
Yash Singh
5237729a6d Add nano to integrations 2021-08-15 13:44:28 -07:00
Knut Sveidqvist
a251848ba1 #2240 Reversing order of calls 2021-08-15 16:57:26 +02:00
RonaldZielaznicki
3383da514a Update ER Diagram to have keys and comments.
Update ER Diagrams to have keys and comments.
2021-08-12 16:18:54 -04:00
Knut Sveidqvist
3d7091a9e2 Merge branch 'master' of github.com:mermaid-js/mermaid 2021-08-11 18:32:15 +02:00
Knut Sveidqvist
d1759228cc Updated banner 2021-08-11 18:32:12 +02:00
Knut Sveidqvist
768536b9e2 Adding banner for the book about Mermaid 2021-08-11 18:28:35 +02:00
Ashish Jain
8f0b19f427 Updated banner position for the mermaid book 2021-08-11 18:28:25 +02:00
Knut Sveidqvist
972f6a0ea9 Merge branch 'master' of github.com:mermaid-js/mermaid 2021-08-11 18:25:10 +02:00
Knut Sveidqvist
9c55dec6ba Merge branch 'master' of github.com:mermaid-js/mermaid 2021-08-11 18:23:00 +02:00
Knut Sveidqvist
06715be05f Banner for Mermaid book 2021-08-11 18:22:56 +02:00
Ashish Jain
8f8169b8e4 Added Mermaid book banners 2021-08-11 18:14:24 +02:00
Ashish Jain
313aa11528 Added Mermaid book banners 2021-08-11 17:57:49 +02:00
Knut Sveidqvist
2ccd9feae7 Merge branch 'master' into develop 2021-08-07 18:43:01 +02:00
Knut Sveidqvist
fa3735b033 Adding landing page for book 2021-08-07 18:36:19 +02:00
Daniel Sitnik
adfceaf20b add Codedoc plugin 2021-08-06 11:19:23 -03:00
Knut Sveidqvist
8af36b742e Merge branch 'master'
Conflicts:
	dist/mermaid.core.js
	dist/mermaid.core.js.map
	dist/mermaid.js
	dist/mermaid.js.map
	dist/mermaid.min.js
	dist/mermaid.min.js.map
2021-08-05 20:08:37 +02:00
Knut Sveidqvist
a670b67844 Merge branch 'release/8.11.4' 2021-08-05 19:58:47 +02:00
Knut Sveidqvist
e8fc810b8d Release build 2021-08-05 19:57:24 +02:00
Knut Sveidqvist
b6648283c2 Removed some log statements 2021-08-05 19:53:11 +02:00
Knut Sveidqvist
b29979bfd9 Fix for broken test 2021-08-05 18:58:42 +02:00
Knut Sveidqvist
7e346a56ff Lint fix 2021-08-05 18:18:18 +02:00
Knut Sveidqvist
719480cf76 Updated preview version to 7 2021-08-05 18:05:24 +02:00
Knut Sveidqvist
92f1b9c079 Beta preview version 2021-08-05 17:42:55 +02:00
Knut Sveidqvist
c0831ecef6 Using Whitelist in all places 2021-08-05 17:35:28 +02:00
Knut Sveidqvist
d3ae43c4ba Version update 2021-08-05 07:42:52 +02:00
Knut Sveidqvist
a4e01dd8e9 preview version 2021-08-05 01:15:34 +02:00
Knut Sveidqvist
88e195408c Lint fixes 2021-08-05 01:13:13 +02:00
Knut Sveidqvist
f77ae2b045 Switch preview release 2021-08-05 01:08:26 +02:00
Knut Sveidqvist
655ff2675e #2219 Excluding using a black list as well 2021-08-05 01:07:35 +02:00
Knut Sveidqvist
37fae09ce4 #2219 Validating directives agains list of legal configuration keys 2021-08-05 01:05:34 +02:00
Knut Sveidqvist
711fb7d748 #2219 UnFrezing object to not cause other downstream issues 2021-08-05 00:52:10 +02:00
Knut Sveidqvist
f8891beb0a #2219 Frezing object to protect the prototype 2021-08-05 00:40:21 +02:00
Knut Sveidqvist
61a401b119 Merge branch 'mmorel-35-2177_dependency_updates_bis' into develop 2021-08-04 20:07:03 +02:00
Knut Sveidqvist
5dd78c18da Updated mermaid bundles 2021-08-04 20:04:47 +02:00
Knut Sveidqvist
eb4ac5c103 Merge 2021-08-04 20:02:16 +02:00
Knut Sveidqvist
af7f5d0aaf Merge branch 'release/8.11.3' 2021-08-04 19:25:59 +02:00
Knut Sveidqvist
7275b215b8 Release 8.11.3 2021-08-04 19:24:50 +02:00
Knut Sveidqvist
6fa6503515 Merge branch '2219_prototype_handling' into develop 2021-08-03 20:23:13 +02:00
Knut Sveidqvist
73ff972789 #2219 Moving check earlier in the chain for better effect 2021-08-03 20:10:15 +02:00
dependabot[bot]
a51bfd6a04 Bump @babel/preset-env from 7.14.8 to 7.14.9 (#41)
Bumps [@babel/preset-env](https://github.com/babel/babel/tree/HEAD/packages/babel-preset-env) from 7.14.8 to 7.14.9.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.14.9/packages/babel-preset-env)

---
updated-dependencies:
- dependency-name: "@babel/preset-env"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-08-02 12:38:08 +02:00
dependabot[bot]
b8cda6616f Bump @babel/eslint-parser from 7.14.7 to 7.14.9 (#42)
Bumps [@babel/eslint-parser](https://github.com/babel/babel/tree/HEAD/eslint/babel-eslint-parser) from 7.14.7 to 7.14.9.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.14.9/eslint/babel-eslint-parser)

---
updated-dependencies:
- dependency-name: "@babel/eslint-parser"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-08-02 12:37:55 +02:00
dependabot[bot]
1aa5388aaf Bump @percy/cli from 1.0.0-beta.61 to 1.0.0-beta.62 (#40)
Bumps [@percy/cli](https://github.com/percy/cli/tree/HEAD/packages/cli) from 1.0.0-beta.61 to 1.0.0-beta.62.
- [Release notes](https://github.com/percy/cli/releases)
- [Commits](https://github.com/percy/cli/commits/v1.0.0-beta.62/packages/cli)

---
updated-dependencies:
- dependency-name: "@percy/cli"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-08-01 08:46:20 +02:00
dependabot[bot]
0dd79d4f80 Bump eslint from 7.31.0 to 7.32.0 (#39)
Bumps [eslint](https://github.com/eslint/eslint) from 7.31.0 to 7.32.0.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/master/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/compare/v7.31.0...v7.32.0)

---
updated-dependencies:
- dependency-name: eslint
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-08-01 08:45:25 +02:00
Knut Sveidqvist
68cd425950 Merge branch 'master' into develop 2021-07-30 10:37:48 +02:00
Knut Sveidqvist
ffa83547ca Merge branch 'release/8.11.2' 2021-07-30 10:36:54 +02:00
dependabot[bot]
d48cd57198 Bump cypress from 8.0.0 to 8.1.0 (#37)
Bumps [cypress](https://github.com/cypress-io/cypress) from 8.0.0 to 8.1.0.
- [Release notes](https://github.com/cypress-io/cypress/releases)
- [Changelog](https://github.com/cypress-io/cypress/blob/develop/.releaserc.base.js)
- [Commits](https://github.com/cypress-io/cypress/compare/v8.0.0...v8.1.0)

---
updated-dependencies:
- dependency-name: cypress
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-07-29 22:22:55 +02:00
dependabot[bot]
ab26c172d7 Bump @percy/cli from 1.0.0-beta.60 to 1.0.0-beta.61 (#36)
Bumps [@percy/cli](https://github.com/percy/cli/tree/HEAD/packages/cli) from 1.0.0-beta.60 to 1.0.0-beta.61.
- [Release notes](https://github.com/percy/cli/releases)
- [Commits](https://github.com/percy/cli/commits/v1.0.0-beta.61/packages/cli)

---
updated-dependencies:
- dependency-name: "@percy/cli"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-07-29 22:22:31 +02:00
Matthieu MOREL
1d32307a71 use Object.entries instead of d3.entries as it is deprecated (#35) 2021-07-29 22:08:01 +02:00
Matthieu MOREL
42d8bbfce2 babel-eslint => @babel/eslint-parser and remove babel-core and webpack-bundle-analyzer and yarn-upgrade-all config
remove babel-core and webpack-bundle-analyzer and yarn-upgrade-all config
2021-07-29 21:48:46 +02:00
Matthieu MOREL
f7295a7a79 Merge branch 'mermaid-js:develop' into 2177_dependency_updates_bis 2021-07-29 19:11:49 +02:00
Matthieu MOREL
b055015250 Update release-publish.yml 2021-07-29 12:06:11 +02:00
Matthieu MOREL
e325bdb16b Update release-preview-publish.yml 2021-07-29 12:06:00 +02:00
Matthieu MOREL
209ac97d15 Update release-preview-publish.yml 2021-07-29 12:05:18 +02:00
Matthieu MOREL
e64cea499f Update release-publish.yml 2021-07-29 12:04:57 +02:00
Matthieu MOREL
c621c145e9 Update release-draft.yml 2021-07-29 12:04:47 +02:00
Matthieu MOREL
6ea84a36dc Update issue-triage.yml 2021-07-29 12:04:37 +02:00
Matthieu MOREL
9914e9b1ab Update e2e.yml 2021-07-29 12:04:26 +02:00
Matthieu MOREL
5dfaed91f1 Update build.yml 2021-07-29 12:04:04 +02:00
dependabot[bot]
f1ff7d02d1 Bump start-server-and-test from 1.13.0 to 1.13.1 (#32)
Bumps [start-server-and-test](https://github.com/bahmutov/start-server-and-test) from 1.13.0 to 1.13.1.
- [Release notes](https://github.com/bahmutov/start-server-and-test/releases)
- [Commits](https://github.com/bahmutov/start-server-and-test/compare/v1.13.0...v1.13.1)

---
updated-dependencies:
- dependency-name: start-server-and-test
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-07-27 22:09:25 +02:00
Matthieu MOREL
21afb56089 Update dependabot.yml 2021-07-23 20:30:32 +02:00
dependabot[bot]
034cdc9d02 Bump @percy/cypress from 3.1.0 to 3.1.1 (#31)
Bumps [@percy/cypress](https://github.com/percy/percy-cypress) from 3.1.0 to 3.1.1.
- [Release notes](https://github.com/percy/percy-cypress/releases)
- [Commits](https://github.com/percy/percy-cypress/compare/v3.1.0...v3.1.1)

---
updated-dependencies:
- dependency-name: "@percy/cypress"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-07-23 20:26:50 +02:00
dependabot[bot]
2008d497bb Bump start-server-and-test from 1.12.6 to 1.13.0 (#30)
Bumps [start-server-and-test](https://github.com/bahmutov/start-server-and-test) from 1.12.6 to 1.13.0.
- [Release notes](https://github.com/bahmutov/start-server-and-test/releases)
- [Commits](https://github.com/bahmutov/start-server-and-test/compare/v1.12.6...v1.13.0)

---
updated-dependencies:
- dependency-name: start-server-and-test
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-07-22 20:06:45 +02:00
dependabot[bot]
b71a28106c Bump @percy/cli from 1.0.0-beta.58 to 1.0.0-beta.60 (#28)
Bumps @percy/cli from 1.0.0-beta.58 to 1.0.0-beta.60.

---
updated-dependencies:
- dependency-name: "@percy/cli"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-07-21 17:26:47 +02:00
dependabot[bot]
eb5147b497 Bump @babel/preset-env from 7.14.7 to 7.14.8 (#27)
Bumps [@babel/preset-env](https://github.com/babel/babel/tree/HEAD/packages/babel-preset-env) from 7.14.7 to 7.14.8.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.14.8/packages/babel-preset-env)

---
updated-dependencies:
- dependency-name: "@babel/preset-env"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-07-21 17:20:20 +02:00
dependabot[bot]
341c40b610 Bump @babel/core from 7.14.6 to 7.14.8 (#26)
Bumps [@babel/core](https://github.com/babel/babel/tree/HEAD/packages/babel-core) from 7.14.6 to 7.14.8.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.14.8/packages/babel-core)

---
updated-dependencies:
- dependency-name: "@babel/core"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-07-21 10:04:14 +02:00
dependabot[bot]
169800b209 Bump actions/setup-node from 2.2.0 to 2.3.0 (#25)
Bumps [actions/setup-node](https://github.com/actions/setup-node) from 2.2.0 to 2.3.0.
- [Release notes](https://github.com/actions/setup-node/releases)
- [Commits](https://github.com/actions/setup-node/compare/v2.2.0...v2.3.0)

---
updated-dependencies:
- dependency-name: actions/setup-node
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-07-21 09:57:30 +02:00
Matthieu MOREL
bdacc5e3eb Update dependabot.yml 2021-07-20 22:17:02 +02:00
dependabot[bot]
afaf213f11 Bump @percy/migrate from 0.10.0 to 0.11.0 (#23)
Bumps @percy/migrate from 0.10.0 to 0.11.0.

---
updated-dependencies:
- dependency-name: "@percy/migrate"
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-07-20 13:24:22 +02:00
dependabot[bot]
e4116bf5b1 Bump eslint from 7.30.0 to 7.31.0 (#24)
Bumps [eslint](https://github.com/eslint/eslint) from 7.30.0 to 7.31.0.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/master/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/compare/v7.30.0...v7.31.0)

---
updated-dependencies:
- dependency-name: eslint
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-07-20 13:22:52 +02:00
dependabot[bot]
58c1d7dd62 Bump cypress from 7.7.0 to 8.0.0 (#21)
Bumps [cypress](https://github.com/cypress-io/cypress) from 7.7.0 to 8.0.0.
- [Release notes](https://github.com/cypress-io/cypress/releases)
- [Changelog](https://github.com/cypress-io/cypress/blob/develop/.releaserc.base.js)
- [Commits](https://github.com/cypress-io/cypress/compare/v7.7.0...v8.0.0)

---
updated-dependencies:
- dependency-name: cypress
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-07-20 12:11:45 +02:00
Matthieu MOREL
56a4ca0406 Update webpack.config.e2e.js 2021-07-15 21:01:40 +02:00
Matthieu MOREL
3f991a4f1f Update webpack.config.e2e.js 2021-07-15 21:01:03 +02:00
Matthieu MOREL
056abc314c Update webpack.config.base.js 2021-07-15 21:00:39 +02:00
Matthieu MOREL
9870121f01 Update webpack.config.e2e.js 2021-07-15 20:41:04 +02:00
Matthieu MOREL
525e342f9b Update webpack.config.base.js 2021-07-15 20:39:36 +02:00
dependabot[bot]
8b267ba947 Bump webpack-cli from 3.3.12 to 4.7.2 (#6)
Bumps [webpack-cli](https://github.com/webpack/webpack-cli) from 3.3.12 to 4.7.2.
- [Release notes](https://github.com/webpack/webpack-cli/releases)
- [Changelog](https://github.com/webpack/webpack-cli/blob/master/CHANGELOG.md)
- [Commits](https://github.com/webpack/webpack-cli/compare/v3.3.12...webpack-cli@4.7.2)

---
updated-dependencies:
- dependency-name: webpack-cli
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-07-15 19:52:31 +02:00
Matthieu MOREL
843ccbc88b Update package.json 2021-07-15 19:42:40 +02:00
Matthieu MOREL
78fbe18aed Update package.json 2021-07-15 19:31:37 +02:00
Matthieu MOREL
dd83cd9f78 Update package.json 2021-07-15 19:19:19 +02:00
dependabot[bot]
0f178b9f07 Bump webpack-node-externals from 1.7.2 to 3.0.0 (#9)
Bumps [webpack-node-externals](https://github.com/liady/webpack-node-externals) from 1.7.2 to 3.0.0.
- [Release notes](https://github.com/liady/webpack-node-externals/releases)
- [Changelog](https://github.com/liady/webpack-node-externals/blob/master/CHANGELOG.md)
- [Commits](https://github.com/liady/webpack-node-externals/compare/v1.7.2...v3.0.0)

---
updated-dependencies:
- dependency-name: webpack-node-externals
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-07-15 19:18:00 +02:00
dependabot[bot]
381ff20820 Bump terser-webpack-plugin from 2.3.8 to 4.2.3 (#8)
Bumps [terser-webpack-plugin](https://github.com/webpack-contrib/terser-webpack-plugin) from 2.3.8 to 4.2.3.
- [Release notes](https://github.com/webpack-contrib/terser-webpack-plugin/releases)
- [Changelog](https://github.com/webpack-contrib/terser-webpack-plugin/blob/master/CHANGELOG.md)
- [Commits](https://github.com/webpack-contrib/terser-webpack-plugin/compare/v2.3.8...v4.2.3)

---
updated-dependencies:
- dependency-name: terser-webpack-plugin
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-07-15 19:17:47 +02:00
dependabot[bot]
559d5ee5e6 Bump cypress from 7.6.0 to 7.7.0 (#7)
Bumps [cypress](https://github.com/cypress-io/cypress) from 7.6.0 to 7.7.0.
- [Release notes](https://github.com/cypress-io/cypress/releases)
- [Changelog](https://github.com/cypress-io/cypress/blob/develop/.releaserc.base.js)
- [Commits](https://github.com/cypress-io/cypress/compare/v7.6.0...v7.7.0)

---
updated-dependencies:
- dependency-name: cypress
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-07-15 19:17:34 +02:00
dependabot[bot]
ec0e476521 Bump d3 from 5.16.0 to 7.0.0 (#5)
Bumps [d3](https://github.com/d3/d3) from 5.16.0 to 7.0.0.
- [Release notes](https://github.com/d3/d3/releases)
- [Changelog](https://github.com/d3/d3/blob/main/CHANGES.md)
- [Commits](https://github.com/d3/d3/compare/v5.16.0...v7.0.0)

---
updated-dependencies:
- dependency-name: d3
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-07-15 19:12:38 +02:00
dependabot[bot]
3f8ff1a66c Bump actions/cache from 2.1.5 to 2.1.6 (#4)
Bumps [actions/cache](https://github.com/actions/cache) from 2.1.5 to 2.1.6.
- [Release notes](https://github.com/actions/cache/releases)
- [Commits](https://github.com/actions/cache/compare/v2.1.5...v2.1.6)

---
updated-dependencies:
- dependency-name: actions/cache
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-07-15 19:05:38 +02:00
dependabot[bot]
7229b6aaf1 Bump andymckay/labeler from 1.0.2 to 1.0.3 (#3)
Bumps [andymckay/labeler](https://github.com/andymckay/labeler) from 1.0.2 to 1.0.3.
- [Release notes](https://github.com/andymckay/labeler/releases)
- [Commits](https://github.com/andymckay/labeler/compare/1.0.2...1.0.3)

---
updated-dependencies:
- dependency-name: andymckay/labeler
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-07-15 19:05:24 +02:00
dependabot[bot]
3ab447a766 Bump toolmantim/release-drafter from 5.2.0 to 5.15.0 (#2)
Bumps [toolmantim/release-drafter](https://github.com/toolmantim/release-drafter) from 5.2.0 to 5.15.0.
- [Release notes](https://github.com/toolmantim/release-drafter/releases)
- [Commits](https://github.com/toolmantim/release-drafter/compare/v5.2.0...v5.15.0)

---
updated-dependencies:
- dependency-name: toolmantim/release-drafter
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-07-15 19:05:07 +02:00
dependabot[bot]
0ed11dc98c Bump actions/upload-artifact from 2.2.3 to 2.2.4 (#1)
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 2.2.3 to 2.2.4.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/v2.2.3...v2.2.4)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-07-15 19:04:38 +02:00
298 changed files with 147261 additions and 92594 deletions

View File

@@ -1 +1,2 @@
**/*.spec.js dist/**
.github/**

View File

@@ -2,19 +2,27 @@
"env": { "env": {
"browser": true, "browser": true,
"es6": true, "es6": true,
"jest/globals": true,
"node": true "node": true
}, },
"parser": "babel-eslint", "parser": "@babel/eslint-parser",
"parserOptions": { "parserOptions": {
"ecmaFeatures": { "ecmaFeatures": {
"experimentalObjectRestSpread": true, "experimentalObjectRestSpread": true,
"jsx": true "jsx": true
}, },
"sourceType": "module" "sourceType": "module"
}, },
"extends": ["prettier", "eslint:recommended"], "extends": ["eslint:recommended", "plugin:jsdoc/recommended", "plugin:prettier/recommended"],
"plugins": ["prettier"], "plugins": ["jest", "jsdoc", "prettier"],
"rules": { "rules": {
"prettier/prettier": ["error"] "no-prototype-builtins": 0,
"no-unused-vars": 0,
"jsdoc/check-indentation": 0,
"jsdoc/check-alignment": 0,
"jsdoc/check-line-alignment": 0,
"jsdoc/multiline-blocks": 0,
"jsdoc/newline-after-description": 0,
"jsdoc/tag-lines": 0
} }
} }

View File

@@ -1,13 +1,17 @@
version: 2 version: 2
updates: updates:
- package-ecosystem: npm - package-ecosystem: npm
open-pull-requests-limit: 10
directory: / directory: /
target-branch: develop target-branch: develop
schedule: schedule:
interval: daily interval: weekly
day: monday
time: "07:00"
- package-ecosystem: github-actions - package-ecosystem: github-actions
directory: / directory: /
target-branch: develop target-branch: develop
schedule: schedule:
interval: daily interval: weekly
day: monday
time: "07:00"

View File

@@ -1,4 +1,3 @@
'Type: Bug / Error': 'bug/*' 'Type: Bug / Error': 'bug/*'
'Type: Enhancement': 'feature/*' 'Type: Enhancement': 'feature/*'
'Type: Other': 'other/*' 'Type: Other': 'other/*'
'Type: Dependabot': 'dependabot/*'

View File

@@ -9,25 +9,19 @@ jobs:
matrix: matrix:
node-version: [16.x] node-version: [16.x]
steps: steps:
- uses: actions/checkout@v2.3.4 - uses: actions/checkout@v2
- name: Setup Node.js ${{ matrix.node-version }} - name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2.2.0 uses: actions/setup-node@v2
with: with:
cache: yarn
node-version: ${{ matrix.node-version }} node-version: ${{ matrix.node-version }}
- name: Install Yarn - name: Install Yarn
run: npm i yarn --global run: npm i yarn --global
- name: Cache Node Modules
uses: actions/cache@v2.1.5
with:
path: .cache
key: ${{ runner.OS }}-build-${{ hashFiles('**/yarn.lock') }}
- name: Install Packages - name: Install Packages
run: | run: |
yarn config set cache-folder $GITHUB_WORKSPACE/.cache/yarn
yarn install --frozen-lockfile yarn install --frozen-lockfile
env: env:
CYPRESS_CACHE_FOLDER: .cache/Cypress CYPRESS_CACHE_FOLDER: .cache/Cypress
@@ -36,7 +30,7 @@ jobs:
run: yarn build run: yarn build
- name: Upload Build as Artifact - name: Upload Build as Artifact
uses: actions/upload-artifact@v2.2.3 uses: actions/upload-artifact@v2
with: with:
name: dist name: dist
path: dist path: dist
@@ -61,4 +55,4 @@ jobs:
# uses: coverallsapp/github-action@master # uses: coverallsapp/github-action@master
# with: # with:
# github-token: ${{ secrets.GITHUB_TOKEN }} # github-token: ${{ secrets.GITHUB_TOKEN }}
# parallel-finished: true # parallel-finished: true

View File

@@ -12,22 +12,16 @@ jobs:
- uses: actions/checkout@v2.3.4 - uses: actions/checkout@v2.3.4
- name: Setup Node.js ${{ matrix.node-version }} - name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2.2.0 uses: actions/setup-node@v2
with: with:
cache: yarn
node-version: ${{ matrix.node-version }} node-version: ${{ matrix.node-version }}
- name: Install Yarn - name: Install Yarn
run: npm i yarn --global run: npm i yarn --global
- name: Cache Node Modules
uses: actions/cache@v2.1.5
with:
path: .cache
key: ${{ runner.OS }}-build-${{ hashFiles('**/yarn.lock') }}
- name: Install Packages - name: Install Packages
run: | run: |
yarn config set cache-folder $GITHUB_WORKSPACE/.cache/yarn
yarn install --frozen-lockfile yarn install --frozen-lockfile
env: env:
CYPRESS_CACHE_FOLDER: .cache/Cypress CYPRESS_CACHE_FOLDER: .cache/Cypress
@@ -55,4 +49,4 @@ jobs:
# uses: coverallsapp/github-action@master # uses: coverallsapp/github-action@master
# with: # with:
# github-token: ${{ secrets.GITHUB_TOKEN }} # github-token: ${{ secrets.GITHUB_TOKEN }}
# parallel-finished: true # parallel-finished: true

View File

@@ -8,7 +8,7 @@ jobs:
triage: triage:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: andymckay/labeler@1.0.2 - uses: andymckay/labeler@1.0.4
with: with:
repo-token: "${{ secrets.GITHUB_TOKEN }}" repo-token: "${{ secrets.GITHUB_TOKEN }}"
labels: "Status: Triage" add-labels: "Status: Triage"

View File

@@ -1,13 +0,0 @@
name: Lock closed issue
on:
issues:
types: [closed]
jobs:
triage:
runs-on: ubuntu-latest
steps:
- uses: Dunning-Kruger/lock-issues@v1.1
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"

View File

@@ -0,0 +1,13 @@
name: Validate PR Labeler Configuration
on: [push, pull_request]
jobs:
pr-labeler:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2.3.4
- name: Validate Configuration
uses: Yash-Singh1/pr-labeler-config-validator@releases/v0.0.3
with:
configuration-path: .github/pr-labeler.yml

View File

@@ -1,6 +1,6 @@
name: Apply labels to PR name: Apply labels to PR
on: on:
pull_request: pull_request_target:
types: [opened] types: [opened]
jobs: jobs:

View File

@@ -10,6 +10,6 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Draft Release - name: Draft Release
uses: toolmantim/release-drafter@v5.2.0 uses: toolmantim/release-drafter@v5
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View File

@@ -9,9 +9,9 @@ jobs:
publish: publish:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2.3.4 - uses: actions/checkout@v2
- name: Setup Node.js - name: Setup Node.js
uses: actions/setup-node@v2.2.0 uses: actions/setup-node@v2
with: with:
node-version: 16.x node-version: 16.x
- name: Install Yarn - name: Install Yarn
@@ -25,7 +25,7 @@ jobs:
- name: Publish - name: Publish
run: | run: |
PREVIEW_VERSION=1 PREVIEW_VERSION=8
VERSION=$(echo ${{github.ref}} | tail -c +20)-preview.$PREVIEW_VERSION VERSION=$(echo ${{github.ref}} | tail -c +20)-preview.$PREVIEW_VERSION
echo $VERSION echo $VERSION
npm version --no-git-tag-version --allow-same-version $VERSION npm version --no-git-tag-version --allow-same-version $VERSION

View File

@@ -12,7 +12,7 @@ jobs:
- uses: fregante/setup-git-user@v1 - uses: fregante/setup-git-user@v1
- name: Setup Node.js - name: Setup Node.js
uses: actions/setup-node@v2.2.0 uses: actions/setup-node@v2
with: with:
node-version: 16.x node-version: 16.x
- name: Install Yarn - name: Install Yarn

1
.gitignore vendored
View File

@@ -24,3 +24,4 @@ local/
_site _site
Gemfile.lock Gemfile.lock
/.vs

4
.husky/pre-commit Executable file
View File

@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
yarn dlx lint-staged

5
.lintstagedrc.json Normal file
View File

@@ -0,0 +1,5 @@
{
"*": [
"yarn lint:fix"
]
}

View File

@@ -1,3 +0,0 @@
version: 1
snapshot:
widths: [1280]

View File

@@ -1,4 +0,0 @@
{
"printWidth": 100,
"singleQuote": true
}

8
.prettierrc.json Normal file
View File

@@ -0,0 +1,8 @@
{
"endOfLine": "auto",
"plugins": [
"prettier-plugin-jsdoc"
],
"printWidth": 100,
"singleQuote": true
}

View File

@@ -1,12 +0,0 @@
dist: trusty
language: node_js
node_js:
- "10"
cache:
npm: false
script:
- yarn build
- yarn test --coverage
- yarn e2e
after_success:
- cat ./coverage/lcov.info | ./node_modules/.bin/coveralls

View File

@@ -11,7 +11,7 @@ Here are a few things to know to get you started on the right path.
We make all changes via pull requests. As we have many pull requests from developers new to mermaid, the current approach is to have *knsv, Knut Sveidqvist* as a main reviewer of changes and merging pull requests. More precisely like this: We make all changes via pull requests. As we have many pull requests from developers new to mermaid, the current approach is to have *knsv, Knut Sveidqvist* as a main reviewer of changes and merging pull requests. More precisely like this:
* Large changes reviewed by knsv or other developer asked to review by knsv * Large changes reviewed by knsv or other developer asked to review by knsv
* Smaller low-risk changes like dependecies, documentation etc can be merged by active collaborators * Smaller low-risk changes like dependencies, documentation etc can be merged by active collaborators
* documentation (updates to the docs folder is also allowed via direct commits) * documentation (updates to the docs folder is also allowed via direct commits)
To commit code, create a branch, let it start with the type like feature or bug followed by the issue number for reference and some describing text. To commit code, create a branch, let it start with the type like feature or bug followed by the issue number for reference and some describing text.
@@ -35,13 +35,13 @@ The documentation is written in Markdown, for more information about Markdown [s
If you want to preview the documentation site on your machine, you need to install `docsify-cli`: If you want to preview the documentation site on your machine, you need to install `docsify-cli`:
``` ```sh
$ npm i docsify-cli -g $ npm i docsify-cli -g
```` ```
If you are more familiar with Yarn, you can use the following command: If you are more familiar with Yarn, you can use the following command:
``` ```sh
$ yarn global add docsify-cli $ yarn global add docsify-cli
``` ```
@@ -50,7 +50,7 @@ If the installation is successful, the command `docsify` will be available in yo
You can now run the following command to serve the documentation site: You can now run the following command to serve the documentation site:
``` ```sh
$ docsify serve docs $ docsify serve docs
``` ```
@@ -85,7 +85,7 @@ The rendering tests are very straightforward to create. There is a function imgS
When running in ci it will take a snapshot of the rendered diagram and compare it with the snapshot from last build and flag for review it if it differs. When running in ci it will take a snapshot of the rendered diagram and compare it with the snapshot from last build and flag for review it if it differs.
This is what a rendering test looks like: This is what a rendering test looks like:
``` ```javascript
it('should render forks and joins', () => { it('should render forks and joins', () => {
imgSnapshotTest( imgSnapshotTest(
` `

View File

@@ -1,11 +1,15 @@
# mermaid [![Build Status](https://travis-ci.org/mermaid-js/mermaid.svg?branch=master)](https://travis-ci.org/mermaid-js/mermaid) [![NPM](https://img.shields.io/npm/v/mermaid)](https://www.npmjs.com/package/mermaid) [![Coverage Status](https://coveralls.io/repos/github/mermaid-js/mermaid/badge.svg?branch=master)](https://coveralls.io/github/mermaid-js/mermaid?branch=master) [![Join our Slack!](https://img.shields.io/static/v1?message=join%20chat&color=9cf&logo=slack&label=slack)](https://join.slack.com/t/mermaid-talk/shared_invite/enQtNzc4NDIyNzk4OTAyLWVhYjQxOTI2OTg4YmE1ZmJkY2Y4MTU3ODliYmIwOTY3NDJlYjA0YjIyZTdkMDMyZTUwOGI0NjEzYmEwODcwOTE) [![This project is using Percy.io for visual regression testing.](https://percy.io/static/images/percy-badge.svg)](https://percy.io/Mermaid/mermaid) # mermaid [![Build Status](https://travis-ci.org/mermaid-js/mermaid.svg?branch=master)](https://travis-ci.org/mermaid-js/mermaid) [![NPM](https://img.shields.io/npm/v/mermaid)](https://www.npmjs.com/package/mermaid) [![Coverage Status](https://coveralls.io/repos/github/mermaid-js/mermaid/badge.svg?branch=master)](https://coveralls.io/github/mermaid-js/mermaid?branch=master) [![Join our Slack!](https://img.shields.io/static/v1?message=join%20chat&color=9cf&logo=slack&label=slack)](https://join.slack.com/t/mermaid-talk/shared_invite/enQtNzc4NDIyNzk4OTAyLWVhYjQxOTI2OTg4YmE1ZmJkY2Y4MTU3ODliYmIwOTY3NDJlYjA0YjIyZTdkMDMyZTUwOGI0NjEzYmEwODcwOTE) [![This project is using Percy.io for visual regression testing.](https://percy.io/static/images/percy-badge.svg)](https://percy.io/Mermaid/mermaid)
English | [简体中文](./README.zh-CN.md)
![banner](./img/header.png) ![banner](./img/header.png)
:trophy: **Mermaid was nominated and won the [JS Open Source Awards (2019)](https://osawards.com/javascript/2019) in the category "The most exciting use of technology"!!!** :trophy: **Mermaid was nominated and won the [JS Open Source Awards (2019)](https://osawards.com/javascript/2019) in the category "The most exciting use of technology"!!!**
**Thanks to all involved, people committing pull requests, people answering questions! 🙏** **Thanks to all involved, people committing pull requests, people answering questions! 🙏**
<a href="https://mermaid-js.github.io/mermaid/landing/" alt="Link to landing page for the book The Official Guide To mermaid.js"><img src="https://github.com/mermaid-js/mermaid/blob/master/docs/img/book-banner-post-release.jpg"></a>
## About ## About
<!-- <Main description> --> <!-- <Main description> -->
@@ -200,7 +204,7 @@ pie
- [Live Editor](https://github.com/mermaid-js/mermaid-live-editor) - [Live Editor](https://github.com/mermaid-js/mermaid-live-editor)
- [HTTP Server](https://github.com/TomWright/mermaid-server) - [HTTP Server](https://github.com/TomWright/mermaid-server)
## Contributors [![Help wanted](https://img.shields.io/github/labels/mermaid-js/mermaid/Help%20wanted!)](https://github.com/mermaid-js/mermaid/issues?q=is%3Aissue+is%3Aopen+label%3A%22Help+wanted%21%22) [![Contributors](https://img.shields.io/github/contributors/mermaid-js/mermaid)](https://github.com/mermaid-js/mermaid/graphs/contributors) [![Commits](https://img.shields.io/github/commit-activity/m/mermaid-js/mermaid)](https://github.com/mermaid-js/mermaid/graphs/contributors) ## Contributors [![Good first issue](https://img.shields.io/github/labels/mermaid-js/mermaid/Good%20first%20issue%21)](https://github.com/mermaid-js/mermaid/issues?q=is%3Aissue+is%3Aopen+label%3A%22Good+first+issue%21%22) [![Contributors](https://img.shields.io/github/contributors/mermaid-js/mermaid)](https://github.com/mermaid-js/mermaid/graphs/contributors) [![Commits](https://img.shields.io/github/commit-activity/m/mermaid-js/mermaid)](https://github.com/mermaid-js/mermaid/graphs/contributors)
Mermaid is a growing community and is always accepting new contributors. There's a lot of different ways to help out and we're always looking for extra hands! Look at [this issue](https://github.com/mermaid-js/mermaid/issues/866) if you want to know where to start helping out. Mermaid is a growing community and is always accepting new contributors. There's a lot of different ways to help out and we're always looking for extra hands! Look at [this issue](https://github.com/mermaid-js/mermaid/issues/866) if you want to know where to start helping out.

220
README.zh-CN.md Normal file
View File

@@ -0,0 +1,220 @@
# mermaid [![Build Status](https://travis-ci.org/mermaid-js/mermaid.svg?branch=master)](https://travis-ci.org/mermaid-js/mermaid) [![NPM](https://img.shields.io/npm/v/mermaid)](https://www.npmjs.com/package/mermaid) [![Coverage Status](https://coveralls.io/repos/github/mermaid-js/mermaid/badge.svg?branch=master)](https://coveralls.io/github/mermaid-js/mermaid?branch=master) [![Join our Slack!](https://img.shields.io/static/v1?message=join%20chat&color=9cf&logo=slack&label=slack)](https://join.slack.com/t/mermaid-talk/shared_invite/enQtNzc4NDIyNzk4OTAyLWVhYjQxOTI2OTg4YmE1ZmJkY2Y4MTU3ODliYmIwOTY3NDJlYjA0YjIyZTdkMDMyZTUwOGI0NjEzYmEwODcwOTE) [![This project is using Percy.io for visual regression testing.](https://percy.io/static/images/percy-badge.svg)](https://percy.io/Mermaid/mermaid)
[English](./README.md) | 简体中文
![banner](./img/header.png)
:trophy: **Mermaid 被提名并获得了 [JS Open Source Awards (2019)](https://osawards.com/javascript/2019) 的 "The most exciting use of technology" 奖项!!!**
**感谢所有参与进来提交 PR解答疑问的人们! 🙏**
<a href="https://mermaid-js.github.io/mermaid/landing/" alt="Link to landing page for the book The Official Guide To mermaid.js"><img src="https://github.com/mermaid-js/mermaid/blob/master/docs/img/book-banner-pre-release.jpg"></a>
## 关于 Mermaid
<!-- <Main description> -->
Mermaid 是一个基于 Javascript 的图表绘制工具,通过解析类 Markdown 的文本语法来实现图表的创建和动态修改。Mermaid 诞生的主要目的是让文档的更新能够及时跟上开发进度。
> Mermaid 致力于解决 Doc-Rot 这个令人头疼的问题。
绘图和编写文档花费了开发者宝贵的开发时间,而且随着业务的变更,它很快就会过期。 但是如果缺少了图表或文档,对于生产力和团队新人的业务学习都会产生巨大的阻碍。 <br/>
Mermaid 通过减少创建可修改的图表所需要的时间、精力和工具来解决这一难题,从而提高了内容的智能化和可重用性。 作为一个基于文本的绘图工具, Mermaid 天生就易于维护和更新,它也可以作为生产脚本(或其他代码)的一部分,使得文档编写变得更加简单。 有了它之后,开发者可以从维护文档这个与开发割离且麻烦的任务中解放出来。 <br/>
即使是从未接触过编程的非专业人员也可以通过 [Mermaid Live Editor](https://mermaid-js.github.io/mermaid-live-editor/)来创建图表。<br/>
你可以访问 [教程](./docs/Tutorials.md) 来查看 Live Editor 的视频教程。
U也可以查看 [Mermaid 的集成和使用](./docs/integrations.md) 这个清单来检查你的文档工具是否已经集成了 Mermaid 支持。
如果想要查看关于 Mermaid 更详细的介绍及基础使用方式,可以查看 [入门指引](./docs/n00b-overview.md) and [用法](./docs/usage.md).
🌐 [CDN](https://unpkg.com/mermaid/) | 📖 [文档](https://mermaidjs.github.io) | 🙌 [贡献](https://github.com/mermaid-js/mermaid/blob/develop/CONTRIBUTING.md) | 📜 [更新日志](./docs/CHANGELOG.md)
<!-- </Main description> -->
## 示例
__下面是一些使用 Mermaid 和类 Markdown 语法创建的图表示例。点击 [语法](https://mermaid-js.github.io/mermaid/#/n00b-syntaxReference) 查看详情__
<table>
<!-- <Flowchart> -->
<tr><td colspan=2 align="center">
<b>流程图</b></br>
[<a href="http://mermaid-js.github.io/mermaid/#/flowchart">文档</a> - <a href="https://mermaidjs.github.io/mermaid-live-editor/#/edit/eyJjb2RlIjoiZ3JhcGggVERcbiAgICBBW0hhcmRdIC0tPnxUZXh0fCBCKFJvdW5kKVxuICAgIEIgLS0-IEN7RGVjaXNpb259XG4gICAgQyAtLT58T25lfCBEW1Jlc3VsdCAxXVxuICAgIEMgLS0-fFR3b3wgRVtSZXN1bHQgMl0iLCJtZXJtYWlkIjp7InRoZW1lIjoiZGVmYXVsdCJ9fQ">live editor</a>]
</td></tr>
<tr>
<td><pre>
graph TD
A[Hard] -->|Text| B(Round)
B --> C{Decision}
C -->|One| D[Result 1]
C -->|Two| E[Result 2]
</pre></td>
<td align="center">
<img src="https://raw.githubusercontent.com/mermaid-js/mermaid/master/img/gray-flow.png" />
</td>
</tr>
<!-- </Flowchart> -->
<!-- <Sequence> -->
<tr><td colspan=2 align="center">
<b>时序图</b><br />
[<a href="http://mermaid-js.github.io/mermaid/#/sequenceDiagram">文档</a> - <a href="https://mermaidjs.github.io/mermaid-live-editor/#/edit/eyJjb2RlIjoic2VxdWVuY2VEaWFncmFtXG5BbGljZS0-PkpvaG46IEhlbGxvIEpvaG4sIGhvdyBhcmUgeW91P1xubG9vcCBIZWFsdGhjaGVja1xuICAgIEpvaG4tPj5Kb2huOiBGaWdodCBhZ2FpbnN0IGh5cG9jaG9uZHJpYVxuZW5kXG5Ob3RlIHJpZ2h0IG9mIEpvaG46IFJhdGlvbmFsIHRob3VnaHRzIVxuSm9obi0tPj5BbGljZTogR3JlYXQhXG5Kb2huLT4-Qm9iOiBIb3cgYWJvdXQgeW91P1xuQm9iLS0-PkpvaG46IEpvbGx5IGdvb2QhIiwibWVybWFpZCI6eyJ0aGVtZSI6ImRlZmF1bHQifX0">live editor</a>]
</td></tr>
<tr>
<td><pre>
sequenceDiagram
Alice->>John: Hello John, how are you?
loop Healthcheck
John->>John: Fight against hypochondria
end
Note right of John: Rational thoughts!
John-->>Alice: Great!
John->>Bob: How about you?
Bob-->>John: Jolly good!
</pre></td>
<td align="center">
<img src="https://raw.githubusercontent.com/mermaid-js/mermaid/master/img/gray-sequence.png" />
</td>
</tr>
<!-- </Sequence> -->
<!-- <Gantt> -->
<tr><td colspan=2 align="center">
<b>甘特图</b><br />
[<a href="http://mermaid-js.github.io/mermaid/#/gantt">文档</a> - <a href="https://mermaidjs.github.io/mermaid-live-editor/#/edit/eyJjb2RlIjoiZ2FudHRcbnNlY3Rpb24gU2VjdGlvblxuQ29tcGxldGVkIDpkb25lLCAgICBkZXMxLCAyMDE0LTAxLTA2LDIwMTQtMDEtMDhcbkFjdGl2ZSAgICAgICAgOmFjdGl2ZSwgIGRlczIsIDIwMTQtMDEtMDcsIDNkXG5QYXJhbGxlbCAxICAgOiAgICAgICAgIGRlczMsIGFmdGVyIGRlczEsIDFkXG5QYXJhbGxlbCAyICAgOiAgICAgICAgIGRlczQsIGFmdGVyIGRlczEsIDFkXG5QYXJhbGxlbCAzICAgOiAgICAgICAgIGRlczUsIGFmdGVyIGRlczMsIDFkXG5QYXJhbGxlbCA0ICAgOiAgICAgICAgIGRlczYsIGFmdGVyIGRlczQsIDFkIiwibWVybWFpZCI6eyJ0aGVtZSI6ImRlZmF1bHQifX0">live editor</a>]
</td></tr>
<tr>
<td><pre>
gantt
section Section
Completed :done, des1, 2014-01-06,2014-01-08
Active :active, des2, 2014-01-07, 3d
Parallel 1 : des3, after des1, 1d
Parallel 2 : des4, after des1, 1d
Parallel 3 : des5, after des3, 1d
Parallel 4 : des6, after des4, 1d
</pre></td>
<td align="center">
<img src="https://raw.githubusercontent.com/mermaid-js/mermaid/master/img/gray-gantt.png" />
</td>
</tr>
<!-- </Gantt> -->
<!-- <Class> -->
<tr><td colspan=2 align="center">
<b>类图</b><br />
[<a href="http://mermaid-js.github.io/mermaid/#/classDiagram">文档</a> - <a href="https://mermaidjs.github.io/mermaid-live-editor/#/edit/eyJjb2RlIjoiY2xhc3NEaWFncmFtXG5DbGFzczAxIDx8LS0gQXZlcnlMb25nQ2xhc3MgOiBDb29sXG48PGludGVyZmFjZT4-IENsYXNzMDFcbkNsYXNzMDkgLS0-IEMyIDogV2hlcmUgYW0gaT9cbkNsYXNzMDkgLS0qIEMzXG5DbGFzczA5IC0tfD4gQ2xhc3MwN1xuQ2xhc3MwNyA6IGVxdWFscygpXG5DbGFzczA3IDogT2JqZWN0W10gZWxlbWVudERhdGFcbkNsYXNzMDEgOiBzaXplKClcbkNsYXNzMDEgOiBpbnQgY2hpbXBcbkNsYXNzMDEgOiBpbnQgZ29yaWxsYVxuY2xhc3MgQ2xhc3MxMCB7XG4gID4-c2VydmljZT4-XG4gIGludCBpZFxuICBzaXplKClcbn0iLCJtZXJtYWlkIjp7InRoZW1lIjoiZGVmYXVsdCJ9fQ">live editor</a>]
</td></tr>
<tr>
<td><pre>
classDiagram
Class01 &lt;|-- AveryLongClass : Cool
&lt;&lt;interface>> Class01
Class09 --> C2 : Where am i?
Class09 --* C3
Class09 --|> Class07
Class07 : equals()
Class07 : Object[] elementData
Class01 : size()
Class01 : int chimp
Class01 : int gorilla
class Class10 {
&lt;&lt;service>>
int id
size()
}
</pre></td>
<td align="center">
<img src="https://raw.githubusercontent.com/mermaid-js/mermaid/master/img/gray-class.png" />
</td>
</tr>
<!-- </Class> -->
<!-- <State> -->
<tr><td colspan=2 align="center">
<b>状态图</b><br />
[<a href="http://mermaid-js.github.io/mermaid/#/stateDiagram">文档</a> - <a href="https://mermaid-js.github.io/mermaid-live-editor/#/edit/eyJjb2RlIjoic3RhdGVEaWFncmFtLXYyXG4gICAgWypdIC0tPiBTdGlsbFxuICAgIFN0aWxsIC0tPiBbKl1cbiAgICBTdGlsbCAtLT4gTW92aW5nXG4gICAgTW92aW5nIC0tPiBTdGlsbFxuICAgIE1vdmluZyAtLT4gQ3Jhc2hcbiAgICBDcmFzaCAtLT4gWypdIiwibWVybWFpZCI6eyJ0aGVtZSI6ImRlZmF1bHQiLCJ0aGVtZVZhcmlhYmxlcyI6eyJiYWNrZ3JvdW5kIjoid2hpdGUiLCJwcmltYXJ5Q29sb3IiOiIjRUNFQ0ZGIiwic2Vjb25kYXJ5Q29sb3IiOiIjZmZmZmRlIiwidGVydGlhcnlDb2xvciI6ImhzbCg4MCwgMTAwJSwgOTYuMjc0NTA5ODAzOSUpIiwicHJpbWFyeUJvcmRlckNvbG9yIjoiaHNsKDI0MCwgNjAlLCA4Ni4yNzQ1MDk4MDM5JSkiLCJzZWNvbmRhcnlCb3JkZXJDb2xvciI6ImhzbCg2MCwgNjAlLCA4My41Mjk0MTE3NjQ3JSkiLCJ0ZXJ0aWFyeUJvcmRlckNvbG9yIjoiaHNsKDgwLCA2MCUsIDg2LjI3NDUwOTgwMzklKSIsInByaW1hcnlUZXh0Q29sb3IiOiIjMTMxMzAwIiwic2Vjb25kYXJ5VGV4dENvbG9yIjoiIzAwMDAyMSIsInRlcnRpYXJ5VGV4dENvbG9yIjoicmdiKDkuNTAwMDAwMDAwMSwgOS41MDAwMDAwMDAxLCA5LjUwMDAwMDAwMDEpIiwibGluZUNvbG9yIjoiIzMzMzMzMyIsInRleHRDb2xvciI6IiMzMzMiLCJtYWluQmtnIjoiI0VDRUNGRiIsInNlY29uZEJrZyI6IiNmZmZmZGUiLCJib3JkZXIxIjoiIzkzNzBEQiIsImJvcmRlcjIiOiIjYWFhYTMzIiwiYXJyb3doZWFkQ29sb3IiOiIjMzMzMzMzIiwiZm9udEZhbWlseSI6IlwidHJlYnVjaGV0IG1zXCIsIHZlcmRhbmEsIGFyaWFsIiwiZm9udFNpemUiOiIxNnB4IiwibGFiZWxCYWNrZ3JvdW5kIjoiI2U4ZThlOCIsIm5vZGVCa2ciOiIjRUNFQ0ZGIiwibm9kZUJvcmRlciI6IiM5MzcwREIiLCJjbHVzdGVyQmtnIjoiI2ZmZmZkZSIsImNsdXN0ZXJCb3JkZXIiOiIjYWFhYTMzIiwiZGVmYXVsdExpbmtDb2xvciI6IiMzMzMzMzMiLCJ0aXRsZUNvbG9yIjoiIzMzMyIsImVkZ2VMYWJlbEJhY2tncm91bmQiOiIjZThlOGU4IiwiYWN0b3JCb3JkZXIiOiJoc2woMjU5LjYyNjE2ODIyNDMsIDU5Ljc3NjUzNjMxMjglLCA4Ny45MDE5NjA3ODQzJSkiLCJhY3RvckJrZyI6IiNFQ0VDRkYiLCJhY3RvclRleHRDb2xvciI6ImJsYWNrIiwiYWN0b3JMaW5lQ29sb3IiOiJncmV5Iiwic2lnbmFsQ29sb3IiOiIjMzMzIiwic2lnbmFsVGV4dENvbG9yIjoiIzMzMyIsImxhYmVsQm94QmtnQ29sb3IiOiIjRUNFQ0ZGIiwibGFiZWxCb3hCb3JkZXJDb2xvciI6ImhzbCgyNTkuNjI2MTY4MjI0MywgNTkuNzc2NTM2MzEyOCUsIDg3LjkwMTk2MDc4NDMlKSIsImxhYmVsVGV4dENvbG9yIjoiYmxhY2siLCJsb29wVGV4dENvbG9yIjoiYmxhY2siLCJub3RlQm9yZGVyQ29sb3IiOiIjYWFhYTMzIiwibm90ZUJrZ0NvbG9yIjoiI2ZmZjVhZCIsIm5vdGVUZXh0Q29sb3IiOiJibGFjayIsImFjdGl2YXRpb25Cb3JkZXJDb2xvciI6IiM2NjYiLCJhY3RpdmF0aW9uQmtnQ29sb3IiOiIjZjRmNGY0Iiwic2VxdWVuY2VOdW1iZXJDb2xvciI6IndoaXRlIiwic2VjdGlvbkJrZ0NvbG9yIjoicmdiYSgxMDIsIDEwMiwgMjU1LCAwLjQ5KSIsImFsdFNlY3Rpb25Ca2dDb2xvciI6IndoaXRlIiwic2VjdGlvbkJrZ0NvbG9yMiI6IiNmZmY0MDAiLCJ0YXNrQm9yZGVyQ29sb3IiOiIjNTM0ZmJjIiwidGFza0JrZ0NvbG9yIjoiIzhhOTBkZCIsInRhc2tUZXh0TGlnaHRDb2xvciI6IndoaXRlIiwidGFza1RleHRDb2xvciI6IndoaXRlIiwidGFza1RleHREYXJrQ29sb3IiOiJibGFjayIsInRhc2tUZXh0T3V0c2lkZUNvbG9yIjoiYmxhY2siLCJ0YXNrVGV4dENsaWNrYWJsZUNvbG9yIjoiIzAwMzE2MyIsImFjdGl2ZVRhc2tCb3JkZXJDb2xvciI6IiM1MzRmYmMiLCJhY3RpdmVUYXNrQmtnQ29sb3IiOiIjYmZjN2ZmIiwiZ3JpZENvbG9yIjoibGlnaHRncmV5IiwiZG9uZVRhc2tCa2dDb2xvciI6ImxpZ2h0Z3JleSIsImRvbmVUYXNrQm9yZGVyQ29sb3IiOiJncmV5IiwiY3JpdEJvcmRlckNvbG9yIjoiI2ZmODg4OCIsImNyaXRCa2dDb2xvciI6InJlZCIsInRvZGF5TGluZUNvbG9yIjoicmVkIiwibGFiZWxDb2xvciI6ImJsYWNrIiwiZXJyb3JCa2dDb2xvciI6IiM1NTIyMjIiLCJlcnJvclRleHRDb2xvciI6IiM1NTIyMjIiLCJjbGFzc1RleHQiOiIjMTMxMzAwIiwiZmlsbFR5cGUwIjoiI0VDRUNGRiIsImZpbGxUeXBlMSI6IiNmZmZmZGUiLCJmaWxsVHlwZTIiOiJoc2woMzA0LCAxMDAlLCA5Ni4yNzQ1MDk4MDM5JSkiLCJmaWxsVHlwZTMiOiJoc2woMTI0LCAxMDAlLCA5My41Mjk0MTE3NjQ3JSkiLCJmaWxsVHlwZTQiOiJoc2woMTc2LCAxMDAlLCA5Ni4yNzQ1MDk4MDM5JSkiLCJmaWxsVHlwZTUiOiJoc2woLTQsIDEwMCUsIDkzLjUyOTQxMTc2NDclKSIsImZpbGxUeXBlNiI6ImhzbCg4LCAxMDAlLCA5Ni4yNzQ1MDk4MDM5JSkiLCJmaWxsVHlwZTciOiJoc2woMTg4LCAxMDAlLCA5My41Mjk0MTE3NjQ3JSkifX0sInVwZGF0ZUVkaXRvciI6ZmFsc2V9">live editor</a>]
</td></tr>
<tr>
<td><pre>
stateDiagram-v2
[*] --> Still
Still --> [*]
Still --> Moving
Moving --> Still
Moving --> Crash
Crash --> [*]
</pre></td>
<td align="center">
<img src="https://raw.githubusercontent.com/mermaid-js/mermaid/master/img/gray-state.png" />
</td>
</tr>
<!-- </State> -->
<!-- <Pie> -->
<tr><td colspan=2 align="center">
<b>饼图</b><br />
[<a href="http://mermaid-js.github.io/mermaid/#/pie">文档</a> - <a href="https://mermaidjs.github.io/mermaid-live-editor/#/edit/eyJjb2RlIjoicGllXG5cIkRvZ3NcIiA6IDQyLjk2XG5cIkNhdHNcIiA6IDUwLjA1XG5cIlJhdHNcIiA6IDEwLjAxIiwibWVybWFpZCI6eyJ0aGVtZSI6ImRlZmF1bHQifX0">live editor</a>]
</td></tr>
<tr>
<td><pre>
pie
"Dogs" : 386
"Cats" : 85
"Rats" : 15
</pre></td>
<td align="center">
<img src="https://raw.githubusercontent.com/mermaid-js/mermaid/master/img/gray-pie.png" />
</td>
</tr>
<!-- </Pie> -->
<!-- <Git> -->
<tr><td colspan=2 align="center">
<b>Git图</b><br />
[实验特性 - <a href="https://mermaidjs.github.io/mermaid-live-editor/#/edit/eyJjb2RlIjoiZ2l0R3JhcGg6XG5vcHRpb25zXG57XG4gICAgXCJub2RlU3BhY2luZ1wiOiAxNTAsXG4gICAgXCJub2RlUmFkaXVzXCI6IDEwXG59XG5lbmRcbmNvbW1pdFxuYnJhbmNoIG5ld2JyYW5jaFxuY2hlY2tvdXQgbmV3YnJhbmNoXG5jb21taXRcbmNvbW1pdFxuY2hlY2tvdXQgbWFzdGVyXG5jb21taXRcbmNvbW1pdFxubWVyZ2UgbmV3YnJhbmNoXG4iLCJtZXJtYWlkIjp7InRoZW1lIjoiZGVmYXVsdCJ9fQ">live editor</a>]
</td></tr>
<tr>
<td colspan="2" align="center"><i>敬请期待!</i></td>
</tr>
<!-- </Git> -->
<!-- <Journey> -->
<tr><td colspan=2 align="center">
<b>用户体验旅程图</b><br />
[<a href="http://mermaid-js.github.io/mermaid/#/user-journey">文档</a> - <a href="https://mermaidjs.github.io/mermaid-live-editor/#/edit/eyJjb2RlIjoic3RhdGVEaWFncmFtXG4gICAgWypdIC0tPiBTdGlsbFxuICAgIFN0aWxsIC0tPiBbKl1cbiAgICBTdGlsbCAtLT4gTW92aW5nXG4gICAgTW92aW5nIC0tPiBTdGlsbFxuICAgIE1vdmluZyAtLT4gQ3Jhc2hcbiAgICBDcmFzaCAtLT4gWypdIiwibWVybWFpZCI6eyJ0aGVtZSI6ImRlZmF1bHQifX0">live editor</a>]
</td></tr>
<tr>
<td>
<pre>
journey
title My working day
section Go to work
Make tea: 5: Me
Go upstairs: 3: Me
Do work: 1: Me, Cat
section Go home
Go downstairs: 5: Me
Sit down: 3: Me
</pre></td>
<td align="center">
<img alt="User Journey Diagram" src="img/gray-user-journey.png" />
</td>
</tr>
<!-- </Journey> -->
</table>
## 相关项目
- [Command Line Interface](https://github.com/mermaid-js/mermaid-cli)
- [Live Editor](https://github.com/mermaid-js/mermaid-live-editor)
- [HTTP Server](https://github.com/TomWright/mermaid-server)
## 贡献者 [![Good first issue](https://img.shields.io/github/labels/mermaid-js/mermaid/Good%20first%20issue%21)](https://github.com/mermaid-js/mermaid/issues?q=is%3Aissue+is%3Aopen+label%3A%22Good+first+issue%21%22) [![Contributors](https://img.shields.io/github/contributors/mermaid-js/mermaid)](https://github.com/mermaid-js/mermaid/graphs/contributors) [![Commits](https://img.shields.io/github/commit-activity/m/mermaid-js/mermaid)](https://github.com/mermaid-js/mermaid/graphs/contributors)
Mermaid 是一个不断发展中的社区,并且还在接收新的贡献者。有很多不同的方式可以参与进来,而且我们还在寻找额外的帮助。如果你想知道如何开始贡献,请查看 [这个 issue](https://github.com/mermaid-js/mermaid/issues/866)。
关于如何贡献的详细信息可以在 [贡献指南](CONTRIBUTING.md) 中找到。
## 鸣谢
来自 Knut Sveidqvist:
>*特别感谢 [d3](http://d3js.org/) 和 [dagre-d3](https://github.com/cpettitt/dagre-d3) 这两个优秀的项目,它们提供了图形布局和绘图工具库! *
>*同样感谢 [js-sequence-diagram](http://bramp.github.io/js-sequence-diagrams) 提供了时序图语法的使用。 感谢 Jessica Peter 提供了甘特图渲染的灵感。*
>*感谢 [Tyler Long](https://github.com/tylerlong) 从 2017年四月开始成为了项目的合作者。*
>
>*感谢越来越多的 [贡献者们](https://github.com/knsv/mermaid/graphs/contributors),没有你们,就没有这个项目的今天!*
---
*Mermaid 是由 Knut Sveidqvist 创建,它为了更简单的文档编写而生。*

View File

@@ -1,3 +1,3 @@
export const curveBasis = 'basis' export const curveBasis = 'basis';
export const curveLinear = 'linear' export const curveLinear = 'linear';
export const curveCardinal = 'cardinal' export const curveCardinal = 'cardinal';

71
__mocks__/d3.js vendored
View File

@@ -1,11 +1,10 @@
/* eslint-env jest */
let NewD3 = function () { let NewD3 = function () {
function returnThis () { function returnThis() {
return this return this;
} }
return { return {
append: function () { append: function () {
return NewD3() return NewD3();
}, },
lower: returnThis, lower: returnThis,
attr: returnThis, attr: returnThis,
@@ -16,41 +15,47 @@ let NewD3 = function () {
getBBox: function () { getBBox: function () {
return { return {
height: 10, height: 10,
width: 20 width: 20,
} };
} },
} },
} },
} };
} };
export const select = function () { export const select = function () {
return new NewD3() return new NewD3();
} };
export const selectAll = function () { export const selectAll = function () {
return new NewD3() return new NewD3();
} };
export const curveBasis = 'basis' export const curveBasis = 'basis';
export const curveLinear = 'linear' export const curveLinear = 'linear';
export const curveCardinal = 'cardinal' export const curveCardinal = 'cardinal';
export const MockD3 = (name, parent) => { export const MockD3 = (name, parent) => {
const children = [] const children = [];
const elem = { const elem = {
get __children () { return children }, get __children() {
get __name () { return name }, return children;
get __parent () { return parent } },
} get __name() {
return name;
},
get __parent() {
return parent;
},
};
elem.append = (name) => { elem.append = (name) => {
const mockElem = MockD3(name, elem) const mockElem = MockD3(name, elem);
children.push(mockElem) children.push(mockElem);
return mockElem return mockElem;
} };
elem.lower = jest.fn(() => elem) elem.lower = jest.fn(() => elem);
elem.attr = jest.fn(() => elem) elem.attr = jest.fn(() => elem);
elem.text = jest.fn(() => elem) elem.text = jest.fn(() => elem);
elem.style = jest.fn(() => elem) elem.style = jest.fn(() => elem);
return elem return elem;
} };

View File

@@ -3,8 +3,8 @@ module.exports = {
[ [
'@babel/preset-env', '@babel/preset-env',
{ {
targets: "defaults, ie >= 11, current node" targets: 'defaults, ie >= 11, current node',
} },
] ],
] ],
} };

View File

@@ -1 +1,3 @@
{ "video": false } {
"video": false
}

10
cypress/.eslintrc.json Normal file
View File

@@ -0,0 +1,10 @@
{
"env": {
"cypress/globals": true
},
"extends": ["plugin:cypress/recommended"],
"plugins": ["cypress"],
"rules":{
"cypress/no-unnecessary-waiting": 0
}
}

View File

@@ -2,15 +2,16 @@
context('Actions', () => { context('Actions', () => {
beforeEach(() => { beforeEach(() => {
cy.visit('https://example.cypress.io/commands/actions') cy.visit('https://example.cypress.io/commands/actions');
}) });
// https://on.cypress.io/interacting-with-elements // https://on.cypress.io/interacting-with-elements
it('.type() - type into a DOM element', () => { it('.type() - type into a DOM element', () => {
// https://on.cypress.io/type // https://on.cypress.io/type
cy.get('.action-email') cy.get('.action-email')
.type('fake@email.com').should('have.value', 'fake@email.com') .type('fake@email.com')
.should('have.value', 'fake@email.com')
// .type() with special character sequences // .type() with special character sequences
.type('{leftarrow}{rightarrow}{uparrow}{downarrow}') .type('{leftarrow}{rightarrow}{uparrow}{downarrow}')
@@ -24,48 +25,52 @@ context('Actions', () => {
// Delay each keypress by 0.1 sec // Delay each keypress by 0.1 sec
.type('slow.typing@email.com', { delay: 100 }) .type('slow.typing@email.com', { delay: 100 })
.should('have.value', 'slow.typing@email.com') .should('have.value', 'slow.typing@email.com');
cy.get('.action-disabled') cy.get('.action-disabled')
// Ignore error checking prior to type // Ignore error checking prior to type
// like whether the input is visible or disabled // like whether the input is visible or disabled
.type('disabled error checking', { force: true }) .type('disabled error checking', { force: true })
.should('have.value', 'disabled error checking') .should('have.value', 'disabled error checking');
}) });
it('.focus() - focus on a DOM element', () => { it('.focus() - focus on a DOM element', () => {
// https://on.cypress.io/focus // https://on.cypress.io/focus
cy.get('.action-focus').focus() cy.get('.action-focus')
.focus()
.should('have.class', 'focus') .should('have.class', 'focus')
.prev().should('have.attr', 'style', 'color: orange;') .prev()
}) .should('have.attr', 'style', 'color: orange;');
});
it('.blur() - blur off a DOM element', () => { it('.blur() - blur off a DOM element', () => {
// https://on.cypress.io/blur // https://on.cypress.io/blur
cy.get('.action-blur').type('About to blur').blur() cy.get('.action-blur')
.type('About to blur')
.blur()
.should('have.class', 'error') .should('have.class', 'error')
.prev().should('have.attr', 'style', 'color: red;') .prev()
}) .should('have.attr', 'style', 'color: red;');
});
it('.clear() - clears an input or textarea element', () => { it('.clear() - clears an input or textarea element', () => {
// https://on.cypress.io/clear // https://on.cypress.io/clear
cy.get('.action-clear').type('Clear this text') cy.get('.action-clear')
.type('Clear this text')
.should('have.value', 'Clear this text') .should('have.value', 'Clear this text')
.clear() .clear()
.should('have.value', '') .should('have.value', '');
}) });
it('.submit() - submit a form', () => { it('.submit() - submit a form', () => {
// https://on.cypress.io/submit // https://on.cypress.io/submit
cy.get('.action-form') cy.get('.action-form').find('[type="text"]').type('HALFOFF');
.find('[type="text"]').type('HALFOFF') cy.get('.action-form').submit().next().should('contain', 'Your form has been submitted!');
cy.get('.action-form').submit() });
.next().should('contain', 'Your form has been submitted!')
})
it('.click() - click on a DOM element', () => { it('.click() - click on a DOM element', () => {
// https://on.cypress.io/click // https://on.cypress.io/click
cy.get('.action-btn').click() cy.get('.action-btn').click();
// You can click on 9 specific positions of an element: // You can click on 9 specific positions of an element:
// ----------------------------------- // -----------------------------------
@@ -81,16 +86,16 @@ context('Actions', () => {
// ----------------------------------- // -----------------------------------
// clicking in the center of the element is the default // clicking in the center of the element is the default
cy.get('#action-canvas').click() cy.get('#action-canvas').click();
cy.get('#action-canvas').click('topLeft') cy.get('#action-canvas').click('topLeft');
cy.get('#action-canvas').click('top') cy.get('#action-canvas').click('top');
cy.get('#action-canvas').click('topRight') cy.get('#action-canvas').click('topRight');
cy.get('#action-canvas').click('left') cy.get('#action-canvas').click('left');
cy.get('#action-canvas').click('right') cy.get('#action-canvas').click('right');
cy.get('#action-canvas').click('bottomLeft') cy.get('#action-canvas').click('bottomLeft');
cy.get('#action-canvas').click('bottom') cy.get('#action-canvas').click('bottom');
cy.get('#action-canvas').click('bottomRight') cy.get('#action-canvas').click('bottomRight');
// .click() accepts an x and y coordinate // .click() accepts an x and y coordinate
// that controls where the click occurs :) // that controls where the click occurs :)
@@ -102,90 +107,83 @@ context('Actions', () => {
.click(100, 185) .click(100, 185)
.click(125, 190) .click(125, 190)
.click(150, 185) .click(150, 185)
.click(170, 165) .click(170, 165);
// click multiple elements by passing multiple: true // click multiple elements by passing multiple: true
cy.get('.action-labels>.label').click({ multiple: true }) cy.get('.action-labels>.label').click({ multiple: true });
// Ignore error checking prior to clicking // Ignore error checking prior to clicking
cy.get('.action-opacity>.btn').click({ force: true }) cy.get('.action-opacity>.btn').click({ force: true });
}) });
it('.dblclick() - double click on a DOM element', () => { it('.dblclick() - double click on a DOM element', () => {
// https://on.cypress.io/dblclick // https://on.cypress.io/dblclick
// Our app has a listener on 'dblclick' event in our 'scripts.js' // Our app has a listener on 'dblclick' event in our 'scripts.js'
// that hides the div and shows an input on double click // that hides the div and shows an input on double click
cy.get('.action-div').dblclick().should('not.be.visible') cy.get('.action-div').dblclick().should('not.be.visible');
cy.get('.action-input-hidden').should('be.visible') cy.get('.action-input-hidden').should('be.visible');
}) });
it('.check() - check a checkbox or radio element', () => { it('.check() - check a checkbox or radio element', () => {
// https://on.cypress.io/check // https://on.cypress.io/check
// By default, .check() will check all // By default, .check() will check all
// matching checkbox or radio elements in succession, one after another // matching checkbox or radio elements in succession, one after another
cy.get('.action-checkboxes [type="checkbox"]').not('[disabled]') cy.get('.action-checkboxes [type="checkbox"]').not('[disabled]').check().should('be.checked');
.check().should('be.checked')
cy.get('.action-radios [type="radio"]').not('[disabled]') cy.get('.action-radios [type="radio"]').not('[disabled]').check().should('be.checked');
.check().should('be.checked')
// .check() accepts a value argument // .check() accepts a value argument
cy.get('.action-radios [type="radio"]') cy.get('.action-radios [type="radio"]').check('radio1').should('be.checked');
.check('radio1').should('be.checked')
// .check() accepts an array of values // .check() accepts an array of values
cy.get('.action-multiple-checkboxes [type="checkbox"]') cy.get('.action-multiple-checkboxes [type="checkbox"]')
.check(['checkbox1', 'checkbox2']).should('be.checked') .check(['checkbox1', 'checkbox2'])
.should('be.checked');
// Ignore error checking prior to checking // Ignore error checking prior to checking
cy.get('.action-checkboxes [disabled]') cy.get('.action-checkboxes [disabled]').check({ force: true }).should('be.checked');
.check({ force: true }).should('be.checked')
cy.get('.action-radios [type="radio"]') cy.get('.action-radios [type="radio"]').check('radio3', { force: true }).should('be.checked');
.check('radio3', { force: true }).should('be.checked') });
})
it('.uncheck() - uncheck a checkbox element', () => { it('.uncheck() - uncheck a checkbox element', () => {
// https://on.cypress.io/uncheck // https://on.cypress.io/uncheck
// By default, .uncheck() will uncheck all matching // By default, .uncheck() will uncheck all matching
// checkbox elements in succession, one after another // checkbox elements in succession, one after another
cy.get('.action-check [type="checkbox"]') cy.get('.action-check [type="checkbox"]').not('[disabled]').uncheck().should('not.be.checked');
.not('[disabled]')
.uncheck().should('not.be.checked')
// .uncheck() accepts a value argument // .uncheck() accepts a value argument
cy.get('.action-check [type="checkbox"]') cy.get('.action-check [type="checkbox"]')
.check('checkbox1') .check('checkbox1')
.uncheck('checkbox1').should('not.be.checked') .uncheck('checkbox1')
.should('not.be.checked');
// .uncheck() accepts an array of values // .uncheck() accepts an array of values
cy.get('.action-check [type="checkbox"]') cy.get('.action-check [type="checkbox"]')
.check(['checkbox1', 'checkbox3']) .check(['checkbox1', 'checkbox3'])
.uncheck(['checkbox1', 'checkbox3']).should('not.be.checked') .uncheck(['checkbox1', 'checkbox3'])
.should('not.be.checked');
// Ignore error checking prior to unchecking // Ignore error checking prior to unchecking
cy.get('.action-check [disabled]') cy.get('.action-check [disabled]').uncheck({ force: true }).should('not.be.checked');
.uncheck({ force: true }).should('not.be.checked') });
})
it('.select() - select an option in a <select> element', () => { it('.select() - select an option in a <select> element', () => {
// https://on.cypress.io/select // https://on.cypress.io/select
// Select option(s) with matching text content // Select option(s) with matching text content
cy.get('.action-select').select('apples') cy.get('.action-select').select('apples');
cy.get('.action-select-multiple') cy.get('.action-select-multiple').select(['apples', 'oranges', 'bananas']);
.select(['apples', 'oranges', 'bananas'])
// Select option(s) with matching value // Select option(s) with matching value
cy.get('.action-select').select('fr-bananas') cy.get('.action-select').select('fr-bananas');
cy.get('.action-select-multiple') cy.get('.action-select-multiple').select(['fr-apples', 'fr-oranges', 'fr-bananas']);
.select(['fr-apples', 'fr-oranges', 'fr-bananas']) });
})
it('.scrollIntoView() - scroll an element into view', () => { it('.scrollIntoView() - scroll an element into view', () => {
// https://on.cypress.io/scrollintoview // https://on.cypress.io/scrollintoview
@@ -194,27 +192,21 @@ context('Actions', () => {
// because they're not within // because they're not within
// the viewable area of their parent // the viewable area of their parent
// (we need to scroll to see them) // (we need to scroll to see them)
cy.get('#scroll-horizontal button') cy.get('#scroll-horizontal button').should('not.be.visible');
.should('not.be.visible')
// scroll the button into view, as if the user had scrolled // scroll the button into view, as if the user had scrolled
cy.get('#scroll-horizontal button').scrollIntoView() cy.get('#scroll-horizontal button').scrollIntoView().should('be.visible');
.should('be.visible')
cy.get('#scroll-vertical button') cy.get('#scroll-vertical button').should('not.be.visible');
.should('not.be.visible')
// Cypress handles the scroll direction needed // Cypress handles the scroll direction needed
cy.get('#scroll-vertical button').scrollIntoView() cy.get('#scroll-vertical button').scrollIntoView().should('be.visible');
.should('be.visible')
cy.get('#scroll-both button') cy.get('#scroll-both button').should('not.be.visible');
.should('not.be.visible')
// Cypress knows to scroll to the right and down // Cypress knows to scroll to the right and down
cy.get('#scroll-both button').scrollIntoView() cy.get('#scroll-both button').scrollIntoView().should('be.visible');
.should('be.visible') });
})
it('.trigger() - trigger an event on a DOM element', () => { it('.trigger() - trigger an event on a DOM element', () => {
// https://on.cypress.io/trigger // https://on.cypress.io/trigger
@@ -228,12 +220,12 @@ context('Actions', () => {
cy.get('.trigger-input-range') cy.get('.trigger-input-range')
.invoke('val', 25) .invoke('val', 25)
.trigger('change') .trigger('change')
.get('input[type=range]').siblings('p') .get('input[type=range]')
.should('have.text', '25') .siblings('p')
}) .should('have.text', '25');
});
it('cy.scrollTo() - scroll the window or element to a position', () => { it('cy.scrollTo() - scroll the window or element to a position', () => {
// https://on.cypress.io/scrollTo // https://on.cypress.io/scrollTo
// You can scroll to 9 specific positions of an element: // You can scroll to 9 specific positions of an element:
@@ -251,22 +243,22 @@ context('Actions', () => {
// if you chain .scrollTo() off of cy, we will // if you chain .scrollTo() off of cy, we will
// scroll the entire window // scroll the entire window
cy.scrollTo('bottom') cy.scrollTo('bottom');
cy.get('#scrollable-horizontal').scrollTo('right') cy.get('#scrollable-horizontal').scrollTo('right');
// or you can scroll to a specific coordinate: // or you can scroll to a specific coordinate:
// (x axis, y axis) in pixels // (x axis, y axis) in pixels
cy.get('#scrollable-vertical').scrollTo(250, 250) cy.get('#scrollable-vertical').scrollTo(250, 250);
// or you can scroll to a specific percentage // or you can scroll to a specific percentage
// of the (width, height) of the element // of the (width, height) of the element
cy.get('#scrollable-both').scrollTo('75%', '25%') cy.get('#scrollable-both').scrollTo('75%', '25%');
// control the easing of the scroll (default is 'swing') // control the easing of the scroll (default is 'swing')
cy.get('#scrollable-vertical').scrollTo('center', { easing: 'linear' }) cy.get('#scrollable-vertical').scrollTo('center', { easing: 'linear' });
// control the duration of the scroll (in ms) // control the duration of the scroll (in ms)
cy.get('#scrollable-both').scrollTo('center', { duration: 2000 }) cy.get('#scrollable-both').scrollTo('center', { duration: 2000 });
}) });
}) });

View File

@@ -2,8 +2,8 @@
context('Aliasing', () => { context('Aliasing', () => {
beforeEach(() => { beforeEach(() => {
cy.visit('https://example.cypress.io/commands/aliasing') cy.visit('https://example.cypress.io/commands/aliasing');
}) });
it('.as() - alias a DOM element for later use', () => { it('.as() - alias a DOM element for later use', () => {
// https://on.cypress.io/as // https://on.cypress.io/as
@@ -12,31 +12,25 @@ context('Aliasing', () => {
// We don't have to traverse to the element // We don't have to traverse to the element
// later in our code, we reference it with @ // later in our code, we reference it with @
cy.get('.as-table').find('tbody>tr') cy.get('.as-table').find('tbody>tr').first().find('td').first().find('button').as('firstBtn');
.first().find('td').first()
.find('button').as('firstBtn')
// when we reference the alias, we place an // when we reference the alias, we place an
// @ in front of its name // @ in front of its name
cy.get('@firstBtn').click() cy.get('@firstBtn').click();
cy.get('@firstBtn') cy.get('@firstBtn').should('have.class', 'btn-success').and('contain', 'Changed');
.should('have.class', 'btn-success') });
.and('contain', 'Changed')
})
it('.as() - alias a route for later use', () => { it('.as() - alias a route for later use', () => {
// Alias the route to wait for its response // Alias the route to wait for its response
cy.server() cy.server();
cy.route('GET', 'comments/*').as('getComment') cy.route('GET', 'comments/*').as('getComment');
// we have code that gets a comment when // we have code that gets a comment when
// the button is clicked in scripts.js // the button is clicked in scripts.js
cy.get('.network-btn').click() cy.get('.network-btn').click();
// https://on.cypress.io/wait // https://on.cypress.io/wait
cy.wait('@getComment').its('status').should('eq', 200) cy.wait('@getComment').its('status').should('eq', 200);
});
}) });
})

View File

@@ -2,8 +2,8 @@
context('Assertions', () => { context('Assertions', () => {
beforeEach(() => { beforeEach(() => {
cy.visit('https://example.cypress.io/commands/assertions') cy.visit('https://example.cypress.io/commands/assertions');
}) });
describe('Implicit Assertions', () => { describe('Implicit Assertions', () => {
it('.should() - make an assertion about the current subject', () => { it('.should() - make an assertion about the current subject', () => {
@@ -23,7 +23,7 @@ context('Assertions', () => {
// first need to invoke jQuery method text() // first need to invoke jQuery method text()
// and then match using regular expression // and then match using regular expression
.invoke('text') .invoke('text')
.should('match', /column content/i) .should('match', /column content/i);
// a better way to check element's text content against a regular expression // a better way to check element's text content against a regular expression
// is to use "cy.contains" // is to use "cy.contains"
@@ -32,33 +32,33 @@ context('Assertions', () => {
.find('tbody tr:last') .find('tbody tr:last')
// finds first <td> element with text content matching regular expression // finds first <td> element with text content matching regular expression
.contains('td', /column content/i) .contains('td', /column content/i)
.should('be.visible') .should('be.visible');
// for more information about asserting element's text // for more information about asserting element's text
// see https://on.cypress.io/using-cypress-faq#How-do-I-get-an-elements-text-contents // see https://on.cypress.io/using-cypress-faq#How-do-I-get-an-elements-text-contents
}) });
it('.and() - chain multiple assertions together', () => { it('.and() - chain multiple assertions together', () => {
// https://on.cypress.io/and // https://on.cypress.io/and
cy.get('.assertions-link') cy.get('.assertions-link')
.should('have.class', 'active') .should('have.class', 'active')
.and('have.attr', 'href') .and('have.attr', 'href')
.and('include', 'cypress.io') .and('include', 'cypress.io');
}) });
}) });
describe('Explicit Assertions', () => { describe('Explicit Assertions', () => {
// https://on.cypress.io/assertions // https://on.cypress.io/assertions
it('expect - make an assertion about a specified subject', () => { it('expect - make an assertion about a specified subject', () => {
// We can use Chai's BDD style assertions // We can use Chai's BDD style assertions
expect(true).to.be.true expect(true).to.be.true;
const o = { foo: 'bar' } const o = { foo: 'bar' };
expect(o).to.equal(o) expect(o).to.equal(o);
expect(o).to.deep.equal({ foo: 'bar' }) expect(o).to.deep.equal({ foo: 'bar' });
// matching text using regular expression // matching text using regular expression
expect('FooBar').to.match(/bar$/i) expect('FooBar').to.match(/bar$/i);
}) });
it('pass your own callback function to should()', () => { it('pass your own callback function to should()', () => {
// Pass a function to should that can have any number // Pass a function to should that can have any number
@@ -71,14 +71,14 @@ context('Assertions', () => {
// https://on.cypress.io/$ // https://on.cypress.io/$
// return an array of texts from all of the p's // return an array of texts from all of the p's
// @ts-ignore TS6133 unused variable // @ts-ignore TS6133 unused variable
const texts = $p.map((i, el) => Cypress.$(el).text()) const texts = $p.map((i, el) => Cypress.$(el).text());
// jquery map returns jquery object // jquery map returns jquery object
// and .get() convert this to simple array // and .get() convert this to simple array
const paragraphs = texts.get() const paragraphs = texts.get();
// array should have length of 3 // array should have length of 3
expect(paragraphs, 'has 3 paragraphs').to.have.length(3) expect(paragraphs, 'has 3 paragraphs').to.have.length(3);
// use second argument to expect(...) to provide clear // use second argument to expect(...) to provide clear
// message with each assertion // message with each assertion
@@ -86,27 +86,27 @@ context('Assertions', () => {
'Some text from first p', 'Some text from first p',
'More text from second p', 'More text from second p',
'And even more text from third p', 'And even more text from third p',
]) ]);
}) });
}) });
it('finds element by class name regex', () => { it('finds element by class name regex', () => {
cy.get('.docs-header') cy.get('.docs-header')
.find('div') .find('div')
// .should(cb) callback function will be retried // .should(cb) callback function will be retried
.should(($div) => { .should(($div) => {
expect($div).to.have.length(1) expect($div).to.have.length(1);
const className = $div[0].className const className = $div[0].className;
expect(className).to.match(/heading-/) expect(className).to.match(/heading-/);
}) })
// .then(cb) callback is not retried, // .then(cb) callback is not retried,
// it either passes or fails // it either passes or fails
.then(($div) => { .then(($div) => {
expect($div, 'text content').to.have.text('Introduction') expect($div, 'text content').to.have.text('Introduction');
}) });
}) });
it('can throw any error', () => { it('can throw any error', () => {
cy.get('.docs-header') cy.get('.docs-header')
@@ -114,55 +114,56 @@ context('Assertions', () => {
.should(($div) => { .should(($div) => {
if ($div.length !== 1) { if ($div.length !== 1) {
// you can throw your own errors // you can throw your own errors
throw new Error('Did not find 1 element') throw new Error('Did not find 1 element');
} }
const className = $div[0].className const className = $div[0].className;
if (!className.match(/heading-/)) { if (!className.match(/heading-/)) {
throw new Error(`Could not find class "heading-" in ${className}`) throw new Error(`Could not find class "heading-" in ${className}`);
} }
}) });
}) });
it('matches unknown text between two elements', () => { it('matches unknown text between two elements', () => {
/** /**
* Text from the first element. * Text from the first element.
*
* @type {string} * @type {string}
*/ */
let text let text;
/** /**
* Normalizes passed text, * Normalizes passed text, useful before comparing text with spaces and different capitalization.
* useful before comparing text with spaces and different capitalization. *
* @param {string} s Text to normalize * @param {string} s Text to normalize
*/ */
const normalizeText = (s) => s.replace(/\s/g, '').toLowerCase() const normalizeText = (s) => s.replace(/\s/g, '').toLowerCase();
cy.get('.two-elements') cy.get('.two-elements')
.find('.first') .find('.first')
.then(($first) => { .then(($first) => {
// save text from the first element // save text from the first element
text = normalizeText($first.text()) text = normalizeText($first.text());
}) });
cy.get('.two-elements') cy.get('.two-elements')
.find('.second') .find('.second')
.should(($div) => { .should(($div) => {
// we can massage text before comparing // we can massage text before comparing
const secondText = normalizeText($div.text()) const secondText = normalizeText($div.text());
expect(secondText, 'second text').to.equal(text) expect(secondText, 'second text').to.equal(text);
}) });
}) });
it('assert - assert shape of an object', () => { it('assert - assert shape of an object', () => {
const person = { const person = {
name: 'Joe', name: 'Joe',
age: 20, age: 20,
} };
assert.isObject(person, 'value is object') assert.isObject(person, 'value is object');
}) });
}) });
}) });

View File

@@ -2,55 +2,54 @@
context('Connectors', () => { context('Connectors', () => {
beforeEach(() => { beforeEach(() => {
cy.visit('https://example.cypress.io/commands/connectors') cy.visit('https://example.cypress.io/commands/connectors');
}) });
it('.each() - iterate over an array of elements', () => { it('.each() - iterate over an array of elements', () => {
// https://on.cypress.io/each // https://on.cypress.io/each
cy.get('.connectors-each-ul>li') cy.get('.connectors-each-ul>li').each(($el, index, $list) => {
.each(($el, index, $list) => { console.log($el, index, $list);
console.log($el, index, $list) });
}) });
})
it('.its() - get properties on the current subject', () => { it('.its() - get properties on the current subject', () => {
// https://on.cypress.io/its // https://on.cypress.io/its
cy.get('.connectors-its-ul>li') cy.get('.connectors-its-ul>li')
// calls the 'length' property yielding that value // calls the 'length' property yielding that value
.its('length') .its('length')
.should('be.gt', 2) .should('be.gt', 2);
}) });
it('.invoke() - invoke a function on the current subject', () => { it('.invoke() - invoke a function on the current subject', () => {
// our div is hidden in our script.js // our div is hidden in our script.js
// $('.connectors-div').hide() // $('.connectors-div').hide()
// https://on.cypress.io/invoke // https://on.cypress.io/invoke
cy.get('.connectors-div').should('be.hidden') cy.get('.connectors-div')
.should('be.hidden')
// call the jquery method 'show' on the 'div.container' // call the jquery method 'show' on the 'div.container'
.invoke('show') .invoke('show')
.should('be.visible') .should('be.visible');
}) });
it('.spread() - spread an array as individual args to callback function', () => { it('.spread() - spread an array as individual args to callback function', () => {
// https://on.cypress.io/spread // https://on.cypress.io/spread
const arr = ['foo', 'bar', 'baz'] const arr = ['foo', 'bar', 'baz'];
cy.wrap(arr).spread((foo, bar, baz) => { cy.wrap(arr).spread((foo, bar, baz) => {
expect(foo).to.eq('foo') expect(foo).to.eq('foo');
expect(bar).to.eq('bar') expect(bar).to.eq('bar');
expect(baz).to.eq('baz') expect(baz).to.eq('baz');
}) });
}) });
it('.then() - invoke a callback function with the current subject', () => { it('.then() - invoke a callback function with the current subject', () => {
// https://on.cypress.io/then // https://on.cypress.io/then
cy.get('.connectors-list > li') cy.get('.connectors-list > li').then(($lis) => {
.then(($lis) => { expect($lis, '3 items').to.have.length(3);
expect($lis, '3 items').to.have.length(3) expect($lis.eq(0), 'first item').to.contain('Walk the dog');
expect($lis.eq(0), 'first item').to.contain('Walk the dog') expect($lis.eq(1), 'second item').to.contain('Feed the cat');
expect($lis.eq(1), 'second item').to.contain('Feed the cat') expect($lis.eq(2), 'third item').to.contain('Write JavaScript');
expect($lis.eq(2), 'third item').to.contain('Write JavaScript') });
}) });
}) });
})

View File

@@ -2,77 +2,78 @@
context('Cookies', () => { context('Cookies', () => {
beforeEach(() => { beforeEach(() => {
Cypress.Cookies.debug(true) Cypress.Cookies.debug(true);
cy.visit('https://example.cypress.io/commands/cookies') cy.visit('https://example.cypress.io/commands/cookies');
// clear cookies again after visiting to remove // clear cookies again after visiting to remove
// any 3rd party cookies picked up such as cloudflare // any 3rd party cookies picked up such as cloudflare
cy.clearCookies() cy.clearCookies();
}) });
it('cy.getCookie() - get a browser cookie', () => { it('cy.getCookie() - get a browser cookie', () => {
// https://on.cypress.io/getcookie // https://on.cypress.io/getcookie
cy.get('#getCookie .set-a-cookie').click() cy.get('#getCookie .set-a-cookie').click();
// cy.getCookie() yields a cookie object // cy.getCookie() yields a cookie object
cy.getCookie('token').should('have.property', 'value', '123ABC') cy.getCookie('token').should('have.property', 'value', '123ABC');
}) });
it('cy.getCookies() - get browser cookies', () => { it('cy.getCookies() - get browser cookies', () => {
// https://on.cypress.io/getcookies // https://on.cypress.io/getcookies
cy.getCookies().should('be.empty') cy.getCookies().should('be.empty');
cy.get('#getCookies .set-a-cookie').click() cy.get('#getCookies .set-a-cookie').click();
// cy.getCookies() yields an array of cookies // cy.getCookies() yields an array of cookies
cy.getCookies().should('have.length', 1).should((cookies) => { cy.getCookies()
.should('have.length', 1)
// each cookie has these properties .should((cookies) => {
expect(cookies[0]).to.have.property('name', 'token') // each cookie has these properties
expect(cookies[0]).to.have.property('value', '123ABC') expect(cookies[0]).to.have.property('name', 'token');
expect(cookies[0]).to.have.property('httpOnly', false) expect(cookies[0]).to.have.property('value', '123ABC');
expect(cookies[0]).to.have.property('secure', false) expect(cookies[0]).to.have.property('httpOnly', false);
expect(cookies[0]).to.have.property('domain') expect(cookies[0]).to.have.property('secure', false);
expect(cookies[0]).to.have.property('path') expect(cookies[0]).to.have.property('domain');
}) expect(cookies[0]).to.have.property('path');
}) });
});
it('cy.setCookie() - set a browser cookie', () => { it('cy.setCookie() - set a browser cookie', () => {
// https://on.cypress.io/setcookie // https://on.cypress.io/setcookie
cy.getCookies().should('be.empty') cy.getCookies().should('be.empty');
cy.setCookie('foo', 'bar') cy.setCookie('foo', 'bar');
// cy.getCookie() yields a cookie object // cy.getCookie() yields a cookie object
cy.getCookie('foo').should('have.property', 'value', 'bar') cy.getCookie('foo').should('have.property', 'value', 'bar');
}) });
it('cy.clearCookie() - clear a browser cookie', () => { it('cy.clearCookie() - clear a browser cookie', () => {
// https://on.cypress.io/clearcookie // https://on.cypress.io/clearcookie
cy.getCookie('token').should('be.null') cy.getCookie('token').should('be.null');
cy.get('#clearCookie .set-a-cookie').click() cy.get('#clearCookie .set-a-cookie').click();
cy.getCookie('token').should('have.property', 'value', '123ABC') cy.getCookie('token').should('have.property', 'value', '123ABC');
// cy.clearCookies() yields null // cy.clearCookies() yields null
cy.clearCookie('token').should('be.null') cy.clearCookie('token').should('be.null');
cy.getCookie('token').should('be.null') cy.getCookie('token').should('be.null');
}) });
it('cy.clearCookies() - clear browser cookies', () => { it('cy.clearCookies() - clear browser cookies', () => {
// https://on.cypress.io/clearcookies // https://on.cypress.io/clearcookies
cy.getCookies().should('be.empty') cy.getCookies().should('be.empty');
cy.get('#clearCookies .set-a-cookie').click() cy.get('#clearCookies .set-a-cookie').click();
cy.getCookies().should('have.length', 1) cy.getCookies().should('have.length', 1);
// cy.clearCookies() yields null // cy.clearCookies() yields null
cy.clearCookies() cy.clearCookies();
cy.getCookies().should('be.empty') cy.getCookies().should('be.empty');
}) });
}) });

View File

@@ -2,81 +2,85 @@
context('Cypress.Commands', () => { context('Cypress.Commands', () => {
beforeEach(() => { beforeEach(() => {
cy.visit('https://example.cypress.io/cypress-api') cy.visit('https://example.cypress.io/cypress-api');
}) });
// https://on.cypress.io/custom-commands // https://on.cypress.io/custom-commands
it('.add() - create a custom command', () => { it('.add() - create a custom command', () => {
Cypress.Commands.add('console', { Cypress.Commands.add(
prevSubject: true, 'console',
}, (subject, method) => { {
// the previous subject is automatically received prevSubject: true,
// and the commands arguments are shifted },
(subject, method) => {
// the previous subject is automatically received
// and the commands arguments are shifted
// allow us to change the console method used // allow us to change the console method used
method = method || 'log' method = method || 'log';
// log the subject to the console // log the subject to the console
// @ts-ignore TS7017 // @ts-ignore TS7017
console[method]('The subject is', subject) console[method]('The subject is', subject);
// whatever we return becomes the new subject // whatever we return becomes the new subject
// we don't want to change the subject so // we don't want to change the subject so
// we return whatever was passed in // we return whatever was passed in
return subject return subject;
}) }
);
// @ts-ignore TS2339 // @ts-ignore TS2339
cy.get('button').console('info').then(($button) => { cy.get('button')
// subject is still $button .console('info')
}) .then(($button) => {
}) // subject is still $button
}) });
});
});
context('Cypress.Cookies', () => { context('Cypress.Cookies', () => {
beforeEach(() => { beforeEach(() => {
cy.visit('https://example.cypress.io/cypress-api') cy.visit('https://example.cypress.io/cypress-api');
}) });
// https://on.cypress.io/cookies // https://on.cypress.io/cookies
it('.debug() - enable or disable debugging', () => { it('.debug() - enable or disable debugging', () => {
Cypress.Cookies.debug(true) Cypress.Cookies.debug(true);
// Cypress will now log in the console when // Cypress will now log in the console when
// cookies are set or cleared // cookies are set or cleared
cy.setCookie('fakeCookie', '123ABC') cy.setCookie('fakeCookie', '123ABC');
cy.clearCookie('fakeCookie') cy.clearCookie('fakeCookie');
cy.setCookie('fakeCookie', '123ABC') cy.setCookie('fakeCookie', '123ABC');
cy.clearCookie('fakeCookie') cy.clearCookie('fakeCookie');
cy.setCookie('fakeCookie', '123ABC') cy.setCookie('fakeCookie', '123ABC');
}) });
it('.preserveOnce() - preserve cookies by key', () => { it('.preserveOnce() - preserve cookies by key', () => {
// normally cookies are reset after each test // normally cookies are reset after each test
cy.getCookie('fakeCookie').should('not.be.ok') cy.getCookie('fakeCookie').should('not.be.ok');
// preserving a cookie will not clear it when // preserving a cookie will not clear it when
// the next test starts // the next test starts
cy.setCookie('lastCookie', '789XYZ') cy.setCookie('lastCookie', '789XYZ');
Cypress.Cookies.preserveOnce('lastCookie') Cypress.Cookies.preserveOnce('lastCookie');
}) });
it('.defaults() - set defaults for all cookies', () => { it('.defaults() - set defaults for all cookies', () => {
// now any cookie with the name 'session_id' will // now any cookie with the name 'session_id' will
// not be cleared before each new test runs // not be cleared before each new test runs
Cypress.Cookies.defaults({ Cypress.Cookies.defaults({
whitelist: 'session_id', whitelist: 'session_id',
}) });
}) });
}) });
context('Cypress.Server', () => { context('Cypress.Server', () => {
beforeEach(() => { beforeEach(() => {
cy.visit('https://example.cypress.io/cypress-api') cy.visit('https://example.cypress.io/cypress-api');
}) });
// Permanently override server options for // Permanently override server options for
// all instances of cy.server() // all instances of cy.server()
@@ -86,71 +90,71 @@ context('Cypress.Server', () => {
Cypress.Server.defaults({ Cypress.Server.defaults({
delay: 0, delay: 0,
force404: false, force404: false,
}) });
}) });
}) });
context('Cypress.arch', () => { context('Cypress.arch', () => {
beforeEach(() => { beforeEach(() => {
cy.visit('https://example.cypress.io/cypress-api') cy.visit('https://example.cypress.io/cypress-api');
}) });
it('Get CPU architecture name of underlying OS', () => { it('Get CPU architecture name of underlying OS', () => {
// https://on.cypress.io/arch // https://on.cypress.io/arch
expect(Cypress.arch).to.exist expect(Cypress.arch).to.exist;
}) });
}) });
context('Cypress.config()', () => { context('Cypress.config()', () => {
beforeEach(() => { beforeEach(() => {
cy.visit('https://example.cypress.io/cypress-api') cy.visit('https://example.cypress.io/cypress-api');
}) });
it('Get and set configuration options', () => { it('Get and set configuration options', () => {
// https://on.cypress.io/config // https://on.cypress.io/config
let myConfig = Cypress.config() let myConfig = Cypress.config();
expect(myConfig).to.have.property('animationDistanceThreshold', 5) expect(myConfig).to.have.property('animationDistanceThreshold', 5);
expect(myConfig).to.have.property('baseUrl', null) expect(myConfig).to.have.property('baseUrl', null);
expect(myConfig).to.have.property('defaultCommandTimeout', 4000) expect(myConfig).to.have.property('defaultCommandTimeout', 4000);
expect(myConfig).to.have.property('requestTimeout', 5000) expect(myConfig).to.have.property('requestTimeout', 5000);
expect(myConfig).to.have.property('responseTimeout', 30000) expect(myConfig).to.have.property('responseTimeout', 30000);
expect(myConfig).to.have.property('viewportHeight', 660) expect(myConfig).to.have.property('viewportHeight', 660);
expect(myConfig).to.have.property('viewportWidth', 1000) expect(myConfig).to.have.property('viewportWidth', 1000);
expect(myConfig).to.have.property('pageLoadTimeout', 60000) expect(myConfig).to.have.property('pageLoadTimeout', 60000);
expect(myConfig).to.have.property('waitForAnimations', true) expect(myConfig).to.have.property('waitForAnimations', true);
expect(Cypress.config('pageLoadTimeout')).to.eq(60000) expect(Cypress.config('pageLoadTimeout')).to.eq(60000);
// this will change the config for the rest of your tests! // this will change the config for the rest of your tests!
Cypress.config('pageLoadTimeout', 20000) Cypress.config('pageLoadTimeout', 20000);
expect(Cypress.config('pageLoadTimeout')).to.eq(20000) expect(Cypress.config('pageLoadTimeout')).to.eq(20000);
Cypress.config('pageLoadTimeout', 60000) Cypress.config('pageLoadTimeout', 60000);
}) });
}) });
context('Cypress.dom', () => { context('Cypress.dom', () => {
beforeEach(() => { beforeEach(() => {
cy.visit('https://example.cypress.io/cypress-api') cy.visit('https://example.cypress.io/cypress-api');
}) });
// https://on.cypress.io/dom // https://on.cypress.io/dom
it('.isHidden() - determine if a DOM element is hidden', () => { it('.isHidden() - determine if a DOM element is hidden', () => {
let hiddenP = Cypress.$('.dom-p p.hidden').get(0) let hiddenP = Cypress.$('.dom-p p.hidden').get(0);
let visibleP = Cypress.$('.dom-p p.visible').get(0) let visibleP = Cypress.$('.dom-p p.visible').get(0);
// our first paragraph has css class 'hidden' // our first paragraph has css class 'hidden'
expect(Cypress.dom.isHidden(hiddenP)).to.be.true expect(Cypress.dom.isHidden(hiddenP)).to.be.true;
expect(Cypress.dom.isHidden(visibleP)).to.be.false expect(Cypress.dom.isHidden(visibleP)).to.be.false;
}) });
}) });
context('Cypress.env()', () => { context('Cypress.env()', () => {
beforeEach(() => { beforeEach(() => {
cy.visit('https://example.cypress.io/cypress-api') cy.visit('https://example.cypress.io/cypress-api');
}) });
// We can set environment variables for highly dynamic values // We can set environment variables for highly dynamic values
@@ -161,62 +165,61 @@ context('Cypress.env()', () => {
Cypress.env({ Cypress.env({
host: 'veronica.dev.local', host: 'veronica.dev.local',
api_server: 'http://localhost:8888/v1/', api_server: 'http://localhost:8888/v1/',
}) });
// get environment variable // get environment variable
expect(Cypress.env('host')).to.eq('veronica.dev.local') expect(Cypress.env('host')).to.eq('veronica.dev.local');
// set environment variable // set environment variable
Cypress.env('api_server', 'http://localhost:8888/v2/') Cypress.env('api_server', 'http://localhost:8888/v2/');
expect(Cypress.env('api_server')).to.eq('http://localhost:8888/v2/') expect(Cypress.env('api_server')).to.eq('http://localhost:8888/v2/');
// get all environment variable // get all environment variable
expect(Cypress.env()).to.have.property('host', 'veronica.dev.local') expect(Cypress.env()).to.have.property('host', 'veronica.dev.local');
expect(Cypress.env()).to.have.property('api_server', 'http://localhost:8888/v2/') expect(Cypress.env()).to.have.property('api_server', 'http://localhost:8888/v2/');
}) });
}) });
context('Cypress.log', () => { context('Cypress.log', () => {
beforeEach(() => { beforeEach(() => {
cy.visit('https://example.cypress.io/cypress-api') cy.visit('https://example.cypress.io/cypress-api');
}) });
it('Control what is printed to the Command Log', () => { it('Control what is printed to the Command Log', () => {
// https://on.cypress.io/cypress-log // https://on.cypress.io/cypress-log
}) });
}) });
context('Cypress.platform', () => { context('Cypress.platform', () => {
beforeEach(() => { beforeEach(() => {
cy.visit('https://example.cypress.io/cypress-api') cy.visit('https://example.cypress.io/cypress-api');
}) });
it('Get underlying OS name', () => { it('Get underlying OS name', () => {
// https://on.cypress.io/platform // https://on.cypress.io/platform
expect(Cypress.platform).to.be.exist expect(Cypress.platform).to.be.exist;
}) });
}) });
context('Cypress.version', () => { context('Cypress.version', () => {
beforeEach(() => { beforeEach(() => {
cy.visit('https://example.cypress.io/cypress-api') cy.visit('https://example.cypress.io/cypress-api');
}) });
it('Get current version of Cypress being run', () => { it('Get current version of Cypress being run', () => {
// https://on.cypress.io/version // https://on.cypress.io/version
expect(Cypress.version).to.be.exist expect(Cypress.version).to.be.exist;
}) });
}) });
context('Cypress.spec', () => { context('Cypress.spec', () => {
beforeEach(() => { beforeEach(() => {
cy.visit('https://example.cypress.io/cypress-api') cy.visit('https://example.cypress.io/cypress-api');
}) });
it('Get current spec information', () => { it('Get current spec information', () => {
// https://on.cypress.io/spec // https://on.cypress.io/spec
// wrap the object so we can inspect it easily by clicking in the command log // wrap the object so we can inspect it easily by clicking in the command log
cy.wrap(Cypress.spec).should('have.keys', ['name', 'relative', 'absolute']) cy.wrap(Cypress.spec).should('have.keys', ['name', 'relative', 'absolute']);
}) });
}) });

View File

@@ -3,18 +3,18 @@
/// JSON fixture file can be loaded directly using /// JSON fixture file can be loaded directly using
// the built-in JavaScript bundler // the built-in JavaScript bundler
// @ts-ignore // @ts-ignore
const requiredExample = require('../../fixtures/example') const requiredExample = require('../../fixtures/example');
context('Files', () => { context('Files', () => {
beforeEach(() => { beforeEach(() => {
cy.visit('https://example.cypress.io/commands/files') cy.visit('https://example.cypress.io/commands/files');
}) });
beforeEach(() => { beforeEach(() => {
// load example.json fixture file and store // load example.json fixture file and store
// in the test context object // in the test context object
cy.fixture('example.json').as('example') cy.fixture('example.json').as('example');
}) });
it('cy.fixture() - load a fixture', () => { it('cy.fixture() - load a fixture', () => {
// https://on.cypress.io/fixture // https://on.cypress.io/fixture
@@ -22,57 +22,58 @@ context('Files', () => {
// Instead of writing a response inline you can // Instead of writing a response inline you can
// use a fixture file's content. // use a fixture file's content.
cy.server() cy.server();
cy.fixture('example.json').as('comment') cy.fixture('example.json').as('comment');
// when application makes an Ajax request matching "GET comments/*" // when application makes an Ajax request matching "GET comments/*"
// Cypress will intercept it and reply with object // Cypress will intercept it and reply with object
// from the "comment" alias // from the "comment" alias
cy.route('GET', 'comments/*', '@comment').as('getComment') cy.route('GET', 'comments/*', '@comment').as('getComment');
// we have code that gets a comment when // we have code that gets a comment when
// the button is clicked in scripts.js // the button is clicked in scripts.js
cy.get('.fixture-btn').click() cy.get('.fixture-btn').click();
cy.wait('@getComment').its('responseBody') cy.wait('@getComment')
.its('responseBody')
.should('have.property', 'name') .should('have.property', 'name')
.and('include', 'Using fixtures to represent data') .and('include', 'Using fixtures to represent data');
// you can also just write the fixture in the route // you can also just write the fixture in the route
cy.route('GET', 'comments/*', 'fixture:example.json').as('getComment') cy.route('GET', 'comments/*', 'fixture:example.json').as('getComment');
// we have code that gets a comment when // we have code that gets a comment when
// the button is clicked in scripts.js // the button is clicked in scripts.js
cy.get('.fixture-btn').click() cy.get('.fixture-btn').click();
cy.wait('@getComment').its('responseBody') cy.wait('@getComment')
.its('responseBody')
.should('have.property', 'name') .should('have.property', 'name')
.and('include', 'Using fixtures to represent data') .and('include', 'Using fixtures to represent data');
// or write fx to represent fixture // or write fx to represent fixture
// by default it assumes it's .json // by default it assumes it's .json
cy.route('GET', 'comments/*', 'fx:example').as('getComment') cy.route('GET', 'comments/*', 'fx:example').as('getComment');
// we have code that gets a comment when // we have code that gets a comment when
// the button is clicked in scripts.js // the button is clicked in scripts.js
cy.get('.fixture-btn').click() cy.get('.fixture-btn').click();
cy.wait('@getComment').its('responseBody') cy.wait('@getComment')
.its('responseBody')
.should('have.property', 'name') .should('have.property', 'name')
.and('include', 'Using fixtures to represent data') .and('include', 'Using fixtures to represent data');
}) });
it('cy.fixture() or require - load a fixture', function () { it('cy.fixture() or require - load a fixture', function () {
// we are inside the "function () { ... }" // we are inside the "function () { ... }"
// callback and can use test context object "this" // callback and can use test context object "this"
// "this.example" was loaded in "beforeEach" function callback // "this.example" was loaded in "beforeEach" function callback
expect(this.example, 'fixture in the test context') expect(this.example, 'fixture in the test context').to.deep.equal(requiredExample);
.to.deep.equal(requiredExample)
// or use "cy.wrap" and "should('deep.equal', ...)" assertion // or use "cy.wrap" and "should('deep.equal', ...)" assertion
// @ts-ignore // @ts-ignore
cy.wrap(this.example, 'fixture vs require') cy.wrap(this.example, 'fixture vs require').should('deep.equal', requiredExample);
.should('deep.equal', requiredExample) });
})
it('cy.readFile() - read a files contents', () => { it('cy.readFile() - read a files contents', () => {
// https://on.cypress.io/readfile // https://on.cypress.io/readfile
@@ -80,9 +81,9 @@ context('Files', () => {
// You can read a file and yield its contents // You can read a file and yield its contents
// The filePath is relative to your project's root. // The filePath is relative to your project's root.
cy.readFile('cypress.json').then((json) => { cy.readFile('cypress.json').then((json) => {
expect(json).to.be.an('object') expect(json).to.be.an('object');
}) });
}) });
it('cy.writeFile() - write to a file', () => { it('cy.writeFile() - write to a file', () => {
// https://on.cypress.io/writefile // https://on.cypress.io/writefile
@@ -91,13 +92,12 @@ context('Files', () => {
// Use a response from a request to automatically // Use a response from a request to automatically
// generate a fixture file for use later // generate a fixture file for use later
cy.request('https://jsonplaceholder.cypress.io/users') cy.request('https://jsonplaceholder.cypress.io/users').then((response) => {
.then((response) => { cy.writeFile('cypress/fixtures/users.json', response.body);
cy.writeFile('cypress/fixtures/users.json', response.body) });
})
cy.fixture('users').should((users) => { cy.fixture('users').should((users) => {
expect(users[0].name).to.exist expect(users[0].name).to.exist;
}) });
// JavaScript arrays and objects are stringified // JavaScript arrays and objects are stringified
// and formatted into text. // and formatted into text.
@@ -105,10 +105,10 @@ context('Files', () => {
id: 8739, id: 8739,
name: 'Jane', name: 'Jane',
email: 'jane@example.com', email: 'jane@example.com',
}) });
cy.fixture('profile').should((profile) => { cy.fixture('profile').should((profile) => {
expect(profile.name).to.eq('Jane') expect(profile.name).to.eq('Jane');
}) });
}) });
}) });

View File

@@ -2,51 +2,57 @@
context('Local Storage', () => { context('Local Storage', () => {
beforeEach(() => { beforeEach(() => {
cy.visit('https://example.cypress.io/commands/local-storage') cy.visit('https://example.cypress.io/commands/local-storage');
}) });
// Although local storage is automatically cleared // Although local storage is automatically cleared
// in between tests to maintain a clean state // in between tests to maintain a clean state
// sometimes we need to clear the local storage manually // sometimes we need to clear the local storage manually
it('cy.clearLocalStorage() - clear all data in local storage', () => { it('cy.clearLocalStorage() - clear all data in local storage', () => {
// https://on.cypress.io/clearlocalstorage // https://on.cypress.io/clearlocalstorage
cy.get('.ls-btn').click().should(() => { cy.get('.ls-btn')
expect(localStorage.getItem('prop1')).to.eq('red') .click()
expect(localStorage.getItem('prop2')).to.eq('blue') .should(() => {
expect(localStorage.getItem('prop3')).to.eq('magenta') expect(localStorage.getItem('prop1')).to.eq('red');
}) expect(localStorage.getItem('prop2')).to.eq('blue');
expect(localStorage.getItem('prop3')).to.eq('magenta');
});
// clearLocalStorage() yields the localStorage object // clearLocalStorage() yields the localStorage object
cy.clearLocalStorage().should((ls) => { cy.clearLocalStorage().should((ls) => {
expect(ls.getItem('prop1')).to.be.null expect(ls.getItem('prop1')).to.be.null;
expect(ls.getItem('prop2')).to.be.null expect(ls.getItem('prop2')).to.be.null;
expect(ls.getItem('prop3')).to.be.null expect(ls.getItem('prop3')).to.be.null;
}) });
// Clear key matching string in Local Storage // Clear key matching string in Local Storage
cy.get('.ls-btn').click().should(() => { cy.get('.ls-btn')
expect(localStorage.getItem('prop1')).to.eq('red') .click()
expect(localStorage.getItem('prop2')).to.eq('blue') .should(() => {
expect(localStorage.getItem('prop3')).to.eq('magenta') expect(localStorage.getItem('prop1')).to.eq('red');
}) expect(localStorage.getItem('prop2')).to.eq('blue');
expect(localStorage.getItem('prop3')).to.eq('magenta');
});
cy.clearLocalStorage('prop1').should((ls) => { cy.clearLocalStorage('prop1').should((ls) => {
expect(ls.getItem('prop1')).to.be.null expect(ls.getItem('prop1')).to.be.null;
expect(ls.getItem('prop2')).to.eq('blue') expect(ls.getItem('prop2')).to.eq('blue');
expect(ls.getItem('prop3')).to.eq('magenta') expect(ls.getItem('prop3')).to.eq('magenta');
}) });
// Clear keys matching regex in Local Storage // Clear keys matching regex in Local Storage
cy.get('.ls-btn').click().should(() => { cy.get('.ls-btn')
expect(localStorage.getItem('prop1')).to.eq('red') .click()
expect(localStorage.getItem('prop2')).to.eq('blue') .should(() => {
expect(localStorage.getItem('prop3')).to.eq('magenta') expect(localStorage.getItem('prop1')).to.eq('red');
}) expect(localStorage.getItem('prop2')).to.eq('blue');
expect(localStorage.getItem('prop3')).to.eq('magenta');
});
cy.clearLocalStorage(/prop1|2/).should((ls) => { cy.clearLocalStorage(/prop1|2/).should((ls) => {
expect(ls.getItem('prop1')).to.be.null expect(ls.getItem('prop1')).to.be.null;
expect(ls.getItem('prop2')).to.be.null expect(ls.getItem('prop2')).to.be.null;
expect(ls.getItem('prop3')).to.eq('magenta') expect(ls.getItem('prop3')).to.eq('magenta');
}) });
}) });
}) });

View File

@@ -2,31 +2,31 @@
context('Location', () => { context('Location', () => {
beforeEach(() => { beforeEach(() => {
cy.visit('https://example.cypress.io/commands/location') cy.visit('https://example.cypress.io/commands/location');
}) });
it('cy.hash() - get the current URL hash', () => { it('cy.hash() - get the current URL hash', () => {
// https://on.cypress.io/hash // https://on.cypress.io/hash
cy.hash().should('be.empty') cy.hash().should('be.empty');
}) });
it('cy.location() - get window.location', () => { it('cy.location() - get window.location', () => {
// https://on.cypress.io/location // https://on.cypress.io/location
cy.location().should((location) => { cy.location().should((location) => {
expect(location.hash).to.be.empty expect(location.hash).to.be.empty;
expect(location.href).to.eq('https://example.cypress.io/commands/location') expect(location.href).to.eq('https://example.cypress.io/commands/location');
expect(location.host).to.eq('example.cypress.io') expect(location.host).to.eq('example.cypress.io');
expect(location.hostname).to.eq('example.cypress.io') expect(location.hostname).to.eq('example.cypress.io');
expect(location.origin).to.eq('https://example.cypress.io') expect(location.origin).to.eq('https://example.cypress.io');
expect(location.pathname).to.eq('/commands/location') expect(location.pathname).to.eq('/commands/location');
expect(location.port).to.eq('') expect(location.port).to.eq('');
expect(location.protocol).to.eq('https:') expect(location.protocol).to.eq('https:');
expect(location.search).to.be.empty expect(location.search).to.be.empty;
}) });
}) });
it('cy.url() - get the current URL', () => { it('cy.url() - get the current URL', () => {
// https://on.cypress.io/url // https://on.cypress.io/url
cy.url().should('eq', 'https://example.cypress.io/commands/location') cy.url().should('eq', 'https://example.cypress.io/commands/location');
}) });
}) });

View File

@@ -2,8 +2,8 @@
context('Misc', () => { context('Misc', () => {
beforeEach(() => { beforeEach(() => {
cy.visit('https://example.cypress.io/commands/misc') cy.visit('https://example.cypress.io/commands/misc');
}) });
it('.end() - end the command chain', () => { it('.end() - end the command chain', () => {
// https://on.cypress.io/end // https://on.cypress.io/end
@@ -12,12 +12,12 @@ context('Misc', () => {
// and force Cypress to re-query from the root element // and force Cypress to re-query from the root element
cy.get('.misc-table').within(() => { cy.get('.misc-table').within(() => {
// ends the current chain and yields null // ends the current chain and yields null
cy.contains('Cheryl').click().end() cy.contains('Cheryl').click().end();
// queries the entire table again // queries the entire table again
cy.contains('Charles').click() cy.contains('Charles').click();
}) });
}) });
it('cy.exec() - execute a system command', () => { it('cy.exec() - execute a system command', () => {
// https://on.cypress.io/exec // https://on.cypress.io/exec
@@ -25,40 +25,36 @@ context('Misc', () => {
// execute a system command. // execute a system command.
// so you can take actions necessary for // so you can take actions necessary for
// your test outside the scope of Cypress. // your test outside the scope of Cypress.
cy.exec('echo Jane Lane') cy.exec('echo Jane Lane').its('stdout').should('contain', 'Jane Lane');
.its('stdout').should('contain', 'Jane Lane')
// we can use Cypress.platform string to // we can use Cypress.platform string to
// select appropriate command // select appropriate command
// https://on.cypress/io/platform // https://on.cypress/io/platform
cy.log(`Platform ${Cypress.platform} architecture ${Cypress.arch}`) cy.log(`Platform ${Cypress.platform} architecture ${Cypress.arch}`);
if (Cypress.platform === 'win32') { if (Cypress.platform === 'win32') {
cy.exec('print cypress.json') cy.exec('print cypress.json').its('stderr').should('be.empty');
.its('stderr').should('be.empty')
} else { } else {
cy.exec('cat cypress.json') cy.exec('cat cypress.json').its('stderr').should('be.empty');
.its('stderr').should('be.empty')
cy.exec('pwd') cy.exec('pwd').its('code').should('eq', 0);
.its('code').should('eq', 0)
} }
}) });
it('cy.focused() - get the DOM element that has focus', () => { it('cy.focused() - get the DOM element that has focus', () => {
// https://on.cypress.io/focused // https://on.cypress.io/focused
cy.get('.misc-form').find('#name').click() cy.get('.misc-form').find('#name').click();
cy.focused().should('have.id', 'name') cy.focused().should('have.id', 'name');
cy.get('.misc-form').find('#description').click() cy.get('.misc-form').find('#description').click();
cy.focused().should('have.id', 'description') cy.focused().should('have.id', 'description');
}) });
context('Cypress.Screenshot', function () { context('Cypress.Screenshot', function () {
it('cy.screenshot() - take a screenshot', () => { it('cy.screenshot() - take a screenshot', () => {
// https://on.cypress.io/screenshot // https://on.cypress.io/screenshot
cy.screenshot('my-image') cy.screenshot('my-image');
}) });
it('Cypress.Screenshot.defaults() - change default config of screenshots', function () { it('Cypress.Screenshot.defaults() - change default config of screenshots', function () {
Cypress.Screenshot.defaults({ Cypress.Screenshot.defaults({
@@ -68,16 +64,14 @@ context('Misc', () => {
scale: false, scale: false,
disableTimersAndAnimations: true, disableTimersAndAnimations: true,
screenshotOnRunFailure: true, screenshotOnRunFailure: true,
beforeScreenshot () { }, beforeScreenshot() {},
afterScreenshot () { }, afterScreenshot() {},
}) });
}) });
}) });
it('cy.wrap() - wrap an object', () => { it('cy.wrap() - wrap an object', () => {
// https://on.cypress.io/wrap // https://on.cypress.io/wrap
cy.wrap({ foo: 'bar' }) cy.wrap({ foo: 'bar' }).should('have.property', 'foo').and('include', 'bar');
.should('have.property', 'foo') });
.and('include', 'bar') });
})
})

View File

@@ -2,38 +2,38 @@
context('Navigation', () => { context('Navigation', () => {
beforeEach(() => { beforeEach(() => {
cy.visit('https://example.cypress.io') cy.visit('https://example.cypress.io');
cy.get('.navbar-nav').contains('Commands').click() cy.get('.navbar-nav').contains('Commands').click();
cy.get('.dropdown-menu').contains('Navigation').click() cy.get('.dropdown-menu').contains('Navigation').click();
}) });
it('cy.go() - go back or forward in the browser\'s history', () => { it("cy.go() - go back or forward in the browser's history", () => {
// https://on.cypress.io/go // https://on.cypress.io/go
cy.location('pathname').should('include', 'navigation') cy.location('pathname').should('include', 'navigation');
cy.go('back') cy.go('back');
cy.location('pathname').should('not.include', 'navigation') cy.location('pathname').should('not.include', 'navigation');
cy.go('forward') cy.go('forward');
cy.location('pathname').should('include', 'navigation') cy.location('pathname').should('include', 'navigation');
// clicking back // clicking back
cy.go(-1) cy.go(-1);
cy.location('pathname').should('not.include', 'navigation') cy.location('pathname').should('not.include', 'navigation');
// clicking forward // clicking forward
cy.go(1) cy.go(1);
cy.location('pathname').should('include', 'navigation') cy.location('pathname').should('include', 'navigation');
}) });
it('cy.reload() - reload the page', () => { it('cy.reload() - reload the page', () => {
// https://on.cypress.io/reload // https://on.cypress.io/reload
cy.reload() cy.reload();
// reload the page without using the cache // reload the page without using the cache
cy.reload(true) cy.reload(true);
}) });
it('cy.visit() - visit a remote url', () => { it('cy.visit() - visit a remote url', () => {
// https://on.cypress.io/visit // https://on.cypress.io/visit
@@ -43,14 +43,14 @@ context('Navigation', () => {
// Pass options to the visit // Pass options to the visit
cy.visit('https://example.cypress.io/commands/navigation', { cy.visit('https://example.cypress.io/commands/navigation', {
timeout: 50000, // increase total time for the visit to resolve timeout: 50000, // increase total time for the visit to resolve
onBeforeLoad (contentWindow) { onBeforeLoad(contentWindow) {
// contentWindow is the remote page's window object // contentWindow is the remote page's window object
expect(typeof contentWindow === 'object').to.be.true expect(typeof contentWindow === 'object').to.be.true;
}, },
onLoad (contentWindow) { onLoad(contentWindow) {
// contentWindow is the remote page's window object // contentWindow is the remote page's window object
expect(typeof contentWindow === 'object').to.be.true expect(typeof contentWindow === 'object').to.be.true;
}, },
}) });
}) });
}) });

View File

@@ -2,8 +2,8 @@
context('Network Requests', () => { context('Network Requests', () => {
beforeEach(() => { beforeEach(() => {
cy.visit('https://example.cypress.io/commands/network-requests') cy.visit('https://example.cypress.io/commands/network-requests');
}) });
// Manage AJAX / XHR requests in your app // Manage AJAX / XHR requests in your app
@@ -13,59 +13,56 @@ context('Network Requests', () => {
cy.server().should((server) => { cy.server().should((server) => {
// the default options on server // the default options on server
// you can override any of these options // you can override any of these options
expect(server.delay).to.eq(0) expect(server.delay).to.eq(0);
expect(server.method).to.eq('GET') expect(server.method).to.eq('GET');
expect(server.status).to.eq(200) expect(server.status).to.eq(200);
expect(server.headers).to.be.null expect(server.headers).to.be.null;
expect(server.response).to.be.null expect(server.response).to.be.null;
expect(server.onRequest).to.be.undefined expect(server.onRequest).to.be.undefined;
expect(server.onResponse).to.be.undefined expect(server.onResponse).to.be.undefined;
expect(server.onAbort).to.be.undefined expect(server.onAbort).to.be.undefined;
// These options control the server behavior // These options control the server behavior
// affecting all requests // affecting all requests
// pass false to disable existing route stubs // pass false to disable existing route stubs
expect(server.enable).to.be.true expect(server.enable).to.be.true;
// forces requests that don't match your routes to 404 // forces requests that don't match your routes to 404
expect(server.force404).to.be.false expect(server.force404).to.be.false;
// whitelists requests from ever being logged or stubbed // whitelists requests from ever being logged or stubbed
expect(server.whitelist).to.be.a('function') expect(server.whitelist).to.be.a('function');
}) });
cy.server({ cy.server({
method: 'POST', method: 'POST',
delay: 1000, delay: 1000,
status: 422, status: 422,
response: {}, response: {},
}) });
// any route commands will now inherit the above options // any route commands will now inherit the above options
// from the server. anything we pass specifically // from the server. anything we pass specifically
// to route will override the defaults though. // to route will override the defaults though.
}) });
it('cy.request() - make an XHR request', () => { it('cy.request() - make an XHR request', () => {
// https://on.cypress.io/request // https://on.cypress.io/request
cy.request('https://jsonplaceholder.cypress.io/comments') cy.request('https://jsonplaceholder.cypress.io/comments').should((response) => {
.should((response) => { expect(response.status).to.eq(200);
expect(response.status).to.eq(200) expect(response.body).to.have.length(500);
expect(response.body).to.have.length(500) expect(response).to.have.property('headers');
expect(response).to.have.property('headers') expect(response).to.have.property('duration');
expect(response).to.have.property('duration') });
}) });
})
it('cy.request() - verify response using BDD syntax', () => { it('cy.request() - verify response using BDD syntax', () => {
cy.request('https://jsonplaceholder.cypress.io/comments') cy.request('https://jsonplaceholder.cypress.io/comments').then((response) => {
.then((response) => {
// https://on.cypress.io/assertions // https://on.cypress.io/assertions
expect(response).property('status').to.equal(200) expect(response).property('status').to.equal(200);
expect(response).property('body').to.have.length(500) expect(response).property('body').to.have.length(500);
expect(response).to.include.keys('headers', 'duration') expect(response).to.include.keys('headers', 'duration');
}) });
}) });
it('cy.request() with query parameters', () => { it('cy.request() with query parameters', () => {
// will execute request // will execute request
@@ -77,42 +74,42 @@ context('Network Requests', () => {
id: 3, id: 3,
}, },
}) })
.its('body') .its('body')
.should('be.an', 'array') .should('be.an', 'array')
.and('have.length', 1) .and('have.length', 1)
.its('0') // yields first element of the array .its('0') // yields first element of the array
.should('contain', { .should('contain', {
postId: 1, postId: 1,
id: 3, id: 3,
}) });
}) });
it('cy.request() - pass result to the second request', () => { it('cy.request() - pass result to the second request', () => {
// first, let's find out the userId of the first user we have // first, let's find out the userId of the first user we have
cy.request('https://jsonplaceholder.cypress.io/users?_limit=1') cy.request('https://jsonplaceholder.cypress.io/users?_limit=1')
.its('body.0') // yields the first element of the returned list .its('body.0') // yields the first element of the returned list
.then((user) => { .then((user) => {
expect(user).property('id').to.be.a('number') expect(user).property('id').to.be.a('number');
// make a new post on behalf of the user // make a new post on behalf of the user
cy.request('POST', 'https://jsonplaceholder.cypress.io/posts', { cy.request('POST', 'https://jsonplaceholder.cypress.io/posts', {
userId: user.id, userId: user.id,
title: 'Cypress Test Runner', title: 'Cypress Test Runner',
body: 'Fast, easy and reliable testing for anything that runs in a browser.', body: 'Fast, easy and reliable testing for anything that runs in a browser.',
}) });
}) })
// note that the value here is the returned value of the 2nd request // note that the value here is the returned value of the 2nd request
// which is the new post object // which is the new post object
.then((response) => { .then((response) => {
expect(response).property('status').to.equal(201) // new entity created expect(response).property('status').to.equal(201); // new entity created
expect(response).property('body').to.contain({ expect(response).property('body').to.contain({
id: 101, // there are already 100 posts, so new entity gets id 101 id: 101, // there are already 100 posts, so new entity gets id 101
title: 'Cypress Test Runner', title: 'Cypress Test Runner',
}) });
// we don't know the user id here - since it was in above closure // we don't know the user id here - since it was in above closure
// so in this test just confirm that the property is there // so in this test just confirm that the property is there
expect(response.body).property('userId').to.be.a('number') expect(response.body).property('userId').to.be.a('number');
}) });
}) });
it('cy.request() - save response in the shared test context', () => { it('cy.request() - save response in the shared test context', () => {
// https://on.cypress.io/variables-and-aliases // https://on.cypress.io/variables-and-aliases
@@ -131,47 +128,48 @@ context('Network Requests', () => {
title: 'Cypress Test Runner', title: 'Cypress Test Runner',
body: 'Fast, easy and reliable testing for anything that runs in a browser.', body: 'Fast, easy and reliable testing for anything that runs in a browser.',
}) })
.its('body').as('post') // save the new post from the response .its('body')
.as('post'); // save the new post from the response
}) })
.then(function () { .then(function () {
// When this callback runs, both "cy.request" API commands have finished // When this callback runs, both "cy.request" API commands have finished
// and the test context has "user" and "post" objects set. // and the test context has "user" and "post" objects set.
// Let's verify them. // Let's verify them.
expect(this.post, 'post has the right user id').property('userId').to.equal(this.user.id) expect(this.post, 'post has the right user id').property('userId').to.equal(this.user.id);
}) });
}) });
it('cy.route() - route responses to matching requests', () => { it('cy.route() - route responses to matching requests', () => {
// https://on.cypress.io/route // https://on.cypress.io/route
let message = 'whoa, this comment does not exist' let message = 'whoa, this comment does not exist';
cy.server() cy.server();
// Listen to GET to comments/1 // Listen to GET to comments/1
cy.route('GET', 'comments/*').as('getComment') cy.route('GET', 'comments/*').as('getComment');
// we have code that gets a comment when // we have code that gets a comment when
// the button is clicked in scripts.js // the button is clicked in scripts.js
cy.get('.network-btn').click() cy.get('.network-btn').click();
// https://on.cypress.io/wait // https://on.cypress.io/wait
cy.wait('@getComment').its('status').should('eq', 200) cy.wait('@getComment').its('status').should('eq', 200);
// Listen to POST to comments // Listen to POST to comments
cy.route('POST', '/comments').as('postComment') cy.route('POST', '/comments').as('postComment');
// we have code that posts a comment when // we have code that posts a comment when
// the button is clicked in scripts.js // the button is clicked in scripts.js
cy.get('.network-post').click() cy.get('.network-post').click();
cy.wait('@postComment') cy.wait('@postComment');
// get the route // get the route
cy.get('@postComment').should((xhr) => { cy.get('@postComment').should((xhr) => {
expect(xhr.requestBody).to.include('email') expect(xhr.requestBody).to.include('email');
expect(xhr.requestHeaders).to.have.property('Content-Type') expect(xhr.requestHeaders).to.have.property('Content-Type');
expect(xhr.responseBody).to.have.property('name', 'Using POST in cy.route()') expect(xhr.responseBody).to.have.property('name', 'Using POST in cy.route()');
}) });
// Stub a response to PUT comments/ **** // Stub a response to PUT comments/ ****
cy.route({ cy.route({
@@ -180,15 +178,15 @@ context('Network Requests', () => {
status: 404, status: 404,
response: { error: message }, response: { error: message },
delay: 500, delay: 500,
}).as('putComment') }).as('putComment');
// we have code that puts a comment when // we have code that puts a comment when
// the button is clicked in scripts.js // the button is clicked in scripts.js
cy.get('.network-put').click() cy.get('.network-put').click();
cy.wait('@putComment') cy.wait('@putComment');
// our 404 statusCode logic in scripts.js executed // our 404 statusCode logic in scripts.js executed
cy.get('.network-put-comment').should('contain', message) cy.get('.network-put-comment').should('contain', message);
}) });
}) });

View File

@@ -2,8 +2,8 @@
context('Querying', () => { context('Querying', () => {
beforeEach(() => { beforeEach(() => {
cy.visit('https://example.cypress.io/commands/querying') cy.visit('https://example.cypress.io/commands/querying');
}) });
// The most commonly used query is 'cy.get()', you can // The most commonly used query is 'cy.get()', you can
// think of this like the '$' in jQuery // think of this like the '$' in jQuery
@@ -11,77 +11,65 @@ context('Querying', () => {
it('cy.get() - query DOM elements', () => { it('cy.get() - query DOM elements', () => {
// https://on.cypress.io/get // https://on.cypress.io/get
cy.get('#query-btn').should('contain', 'Button') cy.get('#query-btn').should('contain', 'Button');
cy.get('.query-btn').should('contain', 'Button') cy.get('.query-btn').should('contain', 'Button');
cy.get('#querying .well>button:first').should('contain', 'Button') cy.get('#querying .well>button:first').should('contain', 'Button');
// ↲ // ↲
// Use CSS selectors just like jQuery // Use CSS selectors just like jQuery
cy.get('[data-test-id="test-example"]').should('have.class', 'example') cy.get('[data-test-id="test-example"]').should('have.class', 'example');
// 'cy.get()' yields jQuery object, you can get its attribute // 'cy.get()' yields jQuery object, you can get its attribute
// by invoking `.attr()` method // by invoking `.attr()` method
cy.get('[data-test-id="test-example"]') cy.get('[data-test-id="test-example"]')
.invoke('attr', 'data-test-id') .invoke('attr', 'data-test-id')
.should('equal', 'test-example') .should('equal', 'test-example');
// or you can get element's CSS property // or you can get element's CSS property
cy.get('[data-test-id="test-example"]') cy.get('[data-test-id="test-example"]').invoke('css', 'position').should('equal', 'static');
.invoke('css', 'position')
.should('equal', 'static')
// or use assertions directly during 'cy.get()' // or use assertions directly during 'cy.get()'
// https://on.cypress.io/assertions // https://on.cypress.io/assertions
cy.get('[data-test-id="test-example"]') cy.get('[data-test-id="test-example"]')
.should('have.attr', 'data-test-id', 'test-example') .should('have.attr', 'data-test-id', 'test-example')
.and('have.css', 'position', 'static') .and('have.css', 'position', 'static');
}) });
it('cy.contains() - query DOM elements with matching content', () => { it('cy.contains() - query DOM elements with matching content', () => {
// https://on.cypress.io/contains // https://on.cypress.io/contains
cy.get('.query-list') cy.get('.query-list').contains('bananas').should('have.class', 'third');
.contains('bananas')
.should('have.class', 'third')
// we can pass a regexp to `.contains()` // we can pass a regexp to `.contains()`
cy.get('.query-list') cy.get('.query-list').contains(/^b\w+/).should('have.class', 'third');
.contains(/^b\w+/)
.should('have.class', 'third')
cy.get('.query-list') cy.get('.query-list').contains('apples').should('have.class', 'first');
.contains('apples')
.should('have.class', 'first')
// passing a selector to contains will // passing a selector to contains will
// yield the selector containing the text // yield the selector containing the text
cy.get('#querying') cy.get('#querying').contains('ul', 'oranges').should('have.class', 'query-list');
.contains('ul', 'oranges')
.should('have.class', 'query-list')
cy.get('.query-button') cy.get('.query-button').contains('Save Form').should('have.class', 'btn');
.contains('Save Form') });
.should('have.class', 'btn')
})
it('.within() - query DOM elements within a specific element', () => { it('.within() - query DOM elements within a specific element', () => {
// https://on.cypress.io/within // https://on.cypress.io/within
cy.get('.query-form').within(() => { cy.get('.query-form').within(() => {
cy.get('input:first').should('have.attr', 'placeholder', 'Email') cy.get('input:first').should('have.attr', 'placeholder', 'Email');
cy.get('input:last').should('have.attr', 'placeholder', 'Password') cy.get('input:last').should('have.attr', 'placeholder', 'Password');
}) });
}) });
it('cy.root() - query the root DOM element', () => { it('cy.root() - query the root DOM element', () => {
// https://on.cypress.io/root // https://on.cypress.io/root
// By default, root is the document // By default, root is the document
cy.root().should('match', 'html') cy.root().should('match', 'html');
cy.get('.query-ul').within(() => { cy.get('.query-ul').within(() => {
// In this within, the root is now the ul DOM element // In this within, the root is now the ul DOM element
cy.root().should('have.class', 'query-ul') cy.root().should('have.class', 'query-ul');
}) });
}) });
}) });

View File

@@ -3,93 +3,92 @@
context('Spies, Stubs, and Clock', () => { context('Spies, Stubs, and Clock', () => {
it('cy.spy() - wrap a method in a spy', () => { it('cy.spy() - wrap a method in a spy', () => {
// https://on.cypress.io/spy // https://on.cypress.io/spy
cy.visit('https://example.cypress.io/commands/spies-stubs-clocks') cy.visit('https://example.cypress.io/commands/spies-stubs-clocks');
const obj = { const obj = {
foo () {}, foo() {},
} };
const spy = cy.spy(obj, 'foo').as('anyArgs') const spy = cy.spy(obj, 'foo').as('anyArgs');
obj.foo() obj.foo();
expect(spy).to.be.called expect(spy).to.be.called;
}) });
it('cy.spy() retries until assertions pass', () => { it('cy.spy() retries until assertions pass', () => {
cy.visit('https://example.cypress.io/commands/spies-stubs-clocks') cy.visit('https://example.cypress.io/commands/spies-stubs-clocks');
const obj = { const obj = {
/** /**
* Prints the argument passed * Prints the argument passed
*
* @param x {any} * @param x {any}
*/ */
foo (x) { foo(x) {
console.log('obj.foo called with', x) console.log('obj.foo called with', x);
}, },
} };
cy.spy(obj, 'foo').as('foo') cy.spy(obj, 'foo').as('foo');
setTimeout(() => { setTimeout(() => {
obj.foo('first') obj.foo('first');
}, 500) }, 500);
setTimeout(() => { setTimeout(() => {
obj.foo('second') obj.foo('second');
}, 2500) }, 2500);
cy.get('@foo').should('have.been.calledTwice') cy.get('@foo').should('have.been.calledTwice');
}) });
it('cy.stub() - create a stub and/or replace a function with stub', () => { it('cy.stub() - create a stub and/or replace a function with stub', () => {
// https://on.cypress.io/stub // https://on.cypress.io/stub
cy.visit('https://example.cypress.io/commands/spies-stubs-clocks') cy.visit('https://example.cypress.io/commands/spies-stubs-clocks');
const obj = { const obj = {
/** /**
* prints both arguments to the console * Prints both arguments to the console
*
* @param a {string} * @param a {string}
* @param b {string} * @param b {string}
*/ */
foo (a, b) { foo(a, b) {
console.log('a', a, 'b', b) console.log('a', a, 'b', b);
}, },
} };
const stub = cy.stub(obj, 'foo').as('foo') const stub = cy.stub(obj, 'foo').as('foo');
obj.foo('foo', 'bar') obj.foo('foo', 'bar');
expect(stub).to.be.called expect(stub).to.be.called;
}) });
it('cy.clock() - control time in the browser', () => { it('cy.clock() - control time in the browser', () => {
// https://on.cypress.io/clock // https://on.cypress.io/clock
// create the date in UTC so its always the same // create the date in UTC so its always the same
// no matter what local timezone the browser is running in // no matter what local timezone the browser is running in
const now = new Date(Date.UTC(2017, 2, 14)).getTime() const now = new Date(Date.UTC(2017, 2, 14)).getTime();
cy.clock(now) cy.clock(now);
cy.visit('https://example.cypress.io/commands/spies-stubs-clocks') cy.visit('https://example.cypress.io/commands/spies-stubs-clocks');
cy.get('#clock-div').click() cy.get('#clock-div').click().should('have.text', '1489449600');
.should('have.text', '1489449600') });
})
it('cy.tick() - move time in the browser', () => { it('cy.tick() - move time in the browser', () => {
// https://on.cypress.io/tick // https://on.cypress.io/tick
// create the date in UTC so its always the same // create the date in UTC so its always the same
// no matter what local timezone the browser is running in // no matter what local timezone the browser is running in
const now = new Date(Date.UTC(2017, 2, 14)).getTime() const now = new Date(Date.UTC(2017, 2, 14)).getTime();
cy.clock(now) cy.clock(now);
cy.visit('https://example.cypress.io/commands/spies-stubs-clocks') cy.visit('https://example.cypress.io/commands/spies-stubs-clocks');
cy.get('#tick-div').click() cy.get('#tick-div').click().should('have.text', '1489449600');
.should('have.text', '1489449600') cy.tick(10000); // 10 seconds passed
cy.tick(10000) // 10 seconds passed cy.get('#tick-div').click().should('have.text', '1489449610');
cy.get('#tick-div').click() });
.should('have.text', '1489449610') });
})
})

View File

@@ -2,120 +2,96 @@
context('Traversal', () => { context('Traversal', () => {
beforeEach(() => { beforeEach(() => {
cy.visit('https://example.cypress.io/commands/traversal') cy.visit('https://example.cypress.io/commands/traversal');
}) });
it('.children() - get child DOM elements', () => { it('.children() - get child DOM elements', () => {
// https://on.cypress.io/children // https://on.cypress.io/children
cy.get('.traversal-breadcrumb') cy.get('.traversal-breadcrumb').children('.active').should('contain', 'Data');
.children('.active') });
.should('contain', 'Data')
})
it('.closest() - get closest ancestor DOM element', () => { it('.closest() - get closest ancestor DOM element', () => {
// https://on.cypress.io/closest // https://on.cypress.io/closest
cy.get('.traversal-badge') cy.get('.traversal-badge').closest('ul').should('have.class', 'list-group');
.closest('ul') });
.should('have.class', 'list-group')
})
it('.eq() - get a DOM element at a specific index', () => { it('.eq() - get a DOM element at a specific index', () => {
// https://on.cypress.io/eq // https://on.cypress.io/eq
cy.get('.traversal-list>li') cy.get('.traversal-list>li').eq(1).should('contain', 'siamese');
.eq(1).should('contain', 'siamese') });
})
it('.filter() - get DOM elements that match the selector', () => { it('.filter() - get DOM elements that match the selector', () => {
// https://on.cypress.io/filter // https://on.cypress.io/filter
cy.get('.traversal-nav>li') cy.get('.traversal-nav>li').filter('.active').should('contain', 'About');
.filter('.active').should('contain', 'About') });
})
it('.find() - get descendant DOM elements of the selector', () => { it('.find() - get descendant DOM elements of the selector', () => {
// https://on.cypress.io/find // https://on.cypress.io/find
cy.get('.traversal-pagination') cy.get('.traversal-pagination').find('li').find('a').should('have.length', 7);
.find('li').find('a') });
.should('have.length', 7)
})
it('.first() - get first DOM element', () => { it('.first() - get first DOM element', () => {
// https://on.cypress.io/first // https://on.cypress.io/first
cy.get('.traversal-table td') cy.get('.traversal-table td').first().should('contain', '1');
.first().should('contain', '1') });
})
it('.last() - get last DOM element', () => { it('.last() - get last DOM element', () => {
// https://on.cypress.io/last // https://on.cypress.io/last
cy.get('.traversal-buttons .btn') cy.get('.traversal-buttons .btn').last().should('contain', 'Submit');
.last().should('contain', 'Submit') });
})
it('.next() - get next sibling DOM element', () => { it('.next() - get next sibling DOM element', () => {
// https://on.cypress.io/next // https://on.cypress.io/next
cy.get('.traversal-ul') cy.get('.traversal-ul').contains('apples').next().should('contain', 'oranges');
.contains('apples').next().should('contain', 'oranges') });
})
it('.nextAll() - get all next sibling DOM elements', () => { it('.nextAll() - get all next sibling DOM elements', () => {
// https://on.cypress.io/nextall // https://on.cypress.io/nextall
cy.get('.traversal-next-all') cy.get('.traversal-next-all').contains('oranges').nextAll().should('have.length', 3);
.contains('oranges') });
.nextAll().should('have.length', 3)
})
it('.nextUntil() - get next sibling DOM elements until next el', () => { it('.nextUntil() - get next sibling DOM elements until next el', () => {
// https://on.cypress.io/nextuntil // https://on.cypress.io/nextuntil
cy.get('#veggies') cy.get('#veggies').nextUntil('#nuts').should('have.length', 3);
.nextUntil('#nuts').should('have.length', 3) });
})
it('.not() - remove DOM elements from set of DOM elements', () => { it('.not() - remove DOM elements from set of DOM elements', () => {
// https://on.cypress.io/not // https://on.cypress.io/not
cy.get('.traversal-disabled .btn') cy.get('.traversal-disabled .btn').not('[disabled]').should('not.contain', 'Disabled');
.not('[disabled]').should('not.contain', 'Disabled') });
})
it('.parent() - get parent DOM element from DOM elements', () => { it('.parent() - get parent DOM element from DOM elements', () => {
// https://on.cypress.io/parent // https://on.cypress.io/parent
cy.get('.traversal-mark') cy.get('.traversal-mark').parent().should('contain', 'Morbi leo risus');
.parent().should('contain', 'Morbi leo risus') });
})
it('.parents() - get parent DOM elements from DOM elements', () => { it('.parents() - get parent DOM elements from DOM elements', () => {
// https://on.cypress.io/parents // https://on.cypress.io/parents
cy.get('.traversal-cite') cy.get('.traversal-cite').parents().should('match', 'blockquote');
.parents().should('match', 'blockquote') });
})
it('.parentsUntil() - get parent DOM elements from DOM elements until el', () => { it('.parentsUntil() - get parent DOM elements from DOM elements until el', () => {
// https://on.cypress.io/parentsuntil // https://on.cypress.io/parentsuntil
cy.get('.clothes-nav') cy.get('.clothes-nav').find('.active').parentsUntil('.clothes-nav').should('have.length', 2);
.find('.active') });
.parentsUntil('.clothes-nav')
.should('have.length', 2)
})
it('.prev() - get previous sibling DOM element', () => { it('.prev() - get previous sibling DOM element', () => {
// https://on.cypress.io/prev // https://on.cypress.io/prev
cy.get('.birds').find('.active') cy.get('.birds').find('.active').prev().should('contain', 'Lorikeets');
.prev().should('contain', 'Lorikeets') });
})
it('.prevAll() - get all previous sibling DOM elements', () => { it('.prevAll() - get all previous sibling DOM elements', () => {
// https://on.cypress.io/prevAll // https://on.cypress.io/prevAll
cy.get('.fruits-list').find('.third') cy.get('.fruits-list').find('.third').prevAll().should('have.length', 2);
.prevAll().should('have.length', 2) });
})
it('.prevUntil() - get all previous sibling DOM elements until el', () => { it('.prevUntil() - get all previous sibling DOM elements until el', () => {
// https://on.cypress.io/prevUntil // https://on.cypress.io/prevUntil
cy.get('.foods-list').find('#nuts') cy.get('.foods-list').find('#nuts').prevUntil('#veggies').should('have.length', 3);
.prevUntil('#veggies').should('have.length', 3) });
})
it('.siblings() - get all sibling DOM elements', () => { it('.siblings() - get all sibling DOM elements', () => {
// https://on.cypress.io/siblings // https://on.cypress.io/siblings
cy.get('.traversal-pills .active') cy.get('.traversal-pills .active').siblings().should('have.length', 2);
.siblings().should('have.length', 2) });
}) });
})

View File

@@ -2,132 +2,128 @@
context('Utilities', () => { context('Utilities', () => {
beforeEach(() => { beforeEach(() => {
cy.visit('https://example.cypress.io/utilities') cy.visit('https://example.cypress.io/utilities');
}) });
it('Cypress._ - call a lodash method', () => { it('Cypress._ - call a lodash method', () => {
// https://on.cypress.io/_ // https://on.cypress.io/_
cy.request('https://jsonplaceholder.cypress.io/users') cy.request('https://jsonplaceholder.cypress.io/users').then((response) => {
.then((response) => { let ids = Cypress._.chain(response.body).map('id').take(3).value();
let ids = Cypress._.chain(response.body).map('id').take(3).value()
expect(ids).to.deep.eq([1, 2, 3]) expect(ids).to.deep.eq([1, 2, 3]);
}) });
}) });
it('Cypress.$ - call a jQuery method', () => { it('Cypress.$ - call a jQuery method', () => {
// https://on.cypress.io/$ // https://on.cypress.io/$
let $li = Cypress.$('.utility-jquery li:first') let $li = Cypress.$('.utility-jquery li:first');
cy.wrap($li) cy.wrap($li).should('not.have.class', 'active').click().should('have.class', 'active');
.should('not.have.class', 'active') });
.click()
.should('have.class', 'active')
})
it('Cypress.Blob - blob utilities and base64 string conversion', () => { it('Cypress.Blob - blob utilities and base64 string conversion', () => {
// https://on.cypress.io/blob // https://on.cypress.io/blob
cy.get('.utility-blob').then(($div) => cy.get('.utility-blob').then(($div) =>
// https://github.com/nolanlawson/blob-util#imgSrcToDataURL // https://github.com/nolanlawson/blob-util#imgSrcToDataURL
// get the dataUrl string for the javascript-logo // get the dataUrl string for the javascript-logo
Cypress.Blob.imgSrcToDataURL('https://example.cypress.io/assets/img/javascript-logo.png', undefined, 'anonymous') Cypress.Blob.imgSrcToDataURL(
.then((dataUrl) => { 'https://example.cypress.io/assets/img/javascript-logo.png',
undefined,
'anonymous'
).then((dataUrl) => {
// create an <img> element and set its src to the dataUrl // create an <img> element and set its src to the dataUrl
let img = Cypress.$('<img />', { src: dataUrl }) let img = Cypress.$('<img />', { src: dataUrl });
// need to explicitly return cy here since we are initially returning // need to explicitly return cy here since we are initially returning
// the Cypress.Blob.imgSrcToDataURL promise to our test // the Cypress.Blob.imgSrcToDataURL promise to our test
// append the image // append the image
$div.append(img) $div.append(img);
cy.get('.utility-blob img').click() cy.get('.utility-blob img').click().should('have.attr', 'src', dataUrl);
.should('have.attr', 'src', dataUrl) })
})) );
}) });
it('Cypress.minimatch - test out glob patterns against strings', () => { it('Cypress.minimatch - test out glob patterns against strings', () => {
// https://on.cypress.io/minimatch // https://on.cypress.io/minimatch
let matching = Cypress.minimatch('/users/1/comments', '/users/*/comments', { let matching = Cypress.minimatch('/users/1/comments', '/users/*/comments', {
matchBase: true, matchBase: true,
}) });
expect(matching, 'matching wildcard').to.be.true expect(matching, 'matching wildcard').to.be.true;
matching = Cypress.minimatch('/users/1/comments/2', '/users/*/comments', { matching = Cypress.minimatch('/users/1/comments/2', '/users/*/comments', {
matchBase: true, matchBase: true,
}) });
expect(matching, 'comments').to.be.false expect(matching, 'comments').to.be.false;
// ** matches against all downstream path segments // ** matches against all downstream path segments
matching = Cypress.minimatch('/foo/bar/baz/123/quux?a=b&c=2', '/foo/**', { matching = Cypress.minimatch('/foo/bar/baz/123/quux?a=b&c=2', '/foo/**', {
matchBase: true, matchBase: true,
}) });
expect(matching, 'comments').to.be.true expect(matching, 'comments').to.be.true;
// whereas * matches only the next path segment // whereas * matches only the next path segment
matching = Cypress.minimatch('/foo/bar/baz/123/quux?a=b&c=2', '/foo/*', { matching = Cypress.minimatch('/foo/bar/baz/123/quux?a=b&c=2', '/foo/*', {
matchBase: false, matchBase: false,
}) });
expect(matching, 'comments').to.be.false expect(matching, 'comments').to.be.false;
}) });
it('Cypress.moment() - format or parse dates using a moment method', () => { it('Cypress.moment() - format or parse dates using a moment method', () => {
// https://on.cypress.io/moment // https://on.cypress.io/moment
const time = Cypress.moment().utc('2014-04-25T19:38:53.196Z').format('h:mm A') const time = Cypress.moment().utc('2014-04-25T19:38:53.196Z').format('h:mm A');
expect(time).to.be.a('string') expect(time).to.be.a('string');
cy.get('.utility-moment').contains('3:38 PM') cy.get('.utility-moment').contains('3:38 PM').should('have.class', 'badge');
.should('have.class', 'badge')
// the time in the element should be between 3pm and 5pm // the time in the element should be between 3pm and 5pm
const start = Cypress.moment('3:00 PM', 'LT') const start = Cypress.moment('3:00 PM', 'LT');
const end = Cypress.moment('5:00 PM', 'LT') const end = Cypress.moment('5:00 PM', 'LT');
cy.get('.utility-moment .badge') cy.get('.utility-moment .badge').should(($el) => {
.should(($el) => { // parse American time like "3:38 PM"
// parse American time like "3:38 PM" const m = Cypress.moment($el.text().trim(), 'LT');
const m = Cypress.moment($el.text().trim(), 'LT')
// display hours + minutes + AM|PM // display hours + minutes + AM|PM
const f = 'h:mm A' const f = 'h:mm A';
expect(m.isBetween(start, end),
`${m.format(f)} should be between ${start.format(f)} and ${end.format(f)}`).to.be.true
})
})
expect(
m.isBetween(start, end),
`${m.format(f)} should be between ${start.format(f)} and ${end.format(f)}`
).to.be.true;
});
});
it('Cypress.Promise - instantiate a bluebird promise', () => { it('Cypress.Promise - instantiate a bluebird promise', () => {
// https://on.cypress.io/promise // https://on.cypress.io/promise
let waited = false let waited = false;
/** /** @returns Bluebird<string> */
* @return Bluebird<string> function waitOneSecond() {
*/
function waitOneSecond () {
// return a promise that resolves after 1 second // return a promise that resolves after 1 second
// @ts-ignore TS2351 (new Cypress.Promise) // @ts-ignore TS2351 (new Cypress.Promise)
return new Cypress.Promise((resolve, reject) => { return new Cypress.Promise((resolve, reject) => {
setTimeout(() => { setTimeout(() => {
// set waited to true // set waited to true
waited = true waited = true;
// resolve with 'foo' string // resolve with 'foo' string
resolve('foo') resolve('foo');
}, 1000) }, 1000);
}) });
} }
cy.then(() => cy.then(() =>
// return a promise to cy.then() that // return a promise to cy.then() that
// is awaited until it resolves // is awaited until it resolves
// @ts-ignore TS7006 // @ts-ignore TS7006
waitOneSecond().then((str) => { waitOneSecond().then((str) => {
expect(str).to.eq('foo') expect(str).to.eq('foo');
expect(waited).to.be.true expect(waited).to.be.true;
})) })
}) );
}) });
});

View File

@@ -2,22 +2,22 @@
context('Viewport', () => { context('Viewport', () => {
beforeEach(() => { beforeEach(() => {
cy.visit('https://example.cypress.io/commands/viewport') cy.visit('https://example.cypress.io/commands/viewport');
}) });
it('cy.viewport() - set the viewport size and dimension', () => { it('cy.viewport() - set the viewport size and dimension', () => {
// https://on.cypress.io/viewport // https://on.cypress.io/viewport
cy.get('#navbar').should('be.visible') cy.get('#navbar').should('be.visible');
cy.viewport(320, 480) cy.viewport(320, 480);
// the navbar should have collapse since our screen is smaller // the navbar should have collapse since our screen is smaller
cy.get('#navbar').should('not.be.visible') cy.get('#navbar').should('not.be.visible');
cy.get('.navbar-toggle').should('be.visible').click() cy.get('.navbar-toggle').should('be.visible').click();
cy.get('.nav').find('a').should('be.visible') cy.get('.nav').find('a').should('be.visible');
// lets see what our app looks like on a super large screen // lets see what our app looks like on a super large screen
cy.viewport(2999, 2999) cy.viewport(2999, 2999);
// cy.viewport() accepts a set of preset sizes // cy.viewport() accepts a set of preset sizes
// to easily set the screen to a device's width and height // to easily set the screen to a device's width and height
@@ -25,35 +25,35 @@ context('Viewport', () => {
// We added a cy.wait() between each viewport change so you can see // We added a cy.wait() between each viewport change so you can see
// the change otherwise it is a little too fast to see :) // the change otherwise it is a little too fast to see :)
cy.viewport('macbook-15') cy.viewport('macbook-15');
cy.wait(200) cy.wait(200);
cy.viewport('macbook-13') cy.viewport('macbook-13');
cy.wait(200) cy.wait(200);
cy.viewport('macbook-11') cy.viewport('macbook-11');
cy.wait(200) cy.wait(200);
cy.viewport('ipad-2') cy.viewport('ipad-2');
cy.wait(200) cy.wait(200);
cy.viewport('ipad-mini') cy.viewport('ipad-mini');
cy.wait(200) cy.wait(200);
cy.viewport('iphone-6+') cy.viewport('iphone-6+');
cy.wait(200) cy.wait(200);
cy.viewport('iphone-6') cy.viewport('iphone-6');
cy.wait(200) cy.wait(200);
cy.viewport('iphone-5') cy.viewport('iphone-5');
cy.wait(200) cy.wait(200);
cy.viewport('iphone-4') cy.viewport('iphone-4');
cy.wait(200) cy.wait(200);
cy.viewport('iphone-3') cy.viewport('iphone-3');
cy.wait(200) cy.wait(200);
// cy.viewport() accepts an orientation for all presets // cy.viewport() accepts an orientation for all presets
// the default orientation is 'portrait' // the default orientation is 'portrait'
cy.viewport('ipad-2', 'portrait') cy.viewport('ipad-2', 'portrait');
cy.wait(200) cy.wait(200);
cy.viewport('iphone-4', 'landscape') cy.viewport('iphone-4', 'landscape');
cy.wait(200) cy.wait(200);
// The viewport will be reset back to the default dimensions // The viewport will be reset back to the default dimensions
// in between tests (the default can be set in cypress.json) // in between tests (the default can be set in cypress.json)
}) });
}) });

View File

@@ -2,33 +2,32 @@
context('Waiting', () => { context('Waiting', () => {
beforeEach(() => { beforeEach(() => {
cy.visit('https://example.cypress.io/commands/waiting') cy.visit('https://example.cypress.io/commands/waiting');
}) });
// BE CAREFUL of adding unnecessary wait times. // BE CAREFUL of adding unnecessary wait times.
// https://on.cypress.io/best-practices#Unnecessary-Waiting // https://on.cypress.io/best-practices#Unnecessary-Waiting
// https://on.cypress.io/wait // https://on.cypress.io/wait
it('cy.wait() - wait for a specific amount of time', () => { it('cy.wait() - wait for a specific amount of time', () => {
cy.get('.wait-input1').type('Wait 1000ms after typing') cy.get('.wait-input1').type('Wait 1000ms after typing');
cy.wait(1000) cy.wait(1000);
cy.get('.wait-input2').type('Wait 1000ms after typing') cy.get('.wait-input2').type('Wait 1000ms after typing');
cy.wait(1000) cy.wait(1000);
cy.get('.wait-input3').type('Wait 1000ms after typing') cy.get('.wait-input3').type('Wait 1000ms after typing');
cy.wait(1000) cy.wait(1000);
}) });
it('cy.wait() - wait for a specific route', () => { it('cy.wait() - wait for a specific route', () => {
cy.server() cy.server();
// Listen to GET to comments/1 // Listen to GET to comments/1
cy.route('GET', 'comments/*').as('getComment') cy.route('GET', 'comments/*').as('getComment');
// we have code that gets a comment when // we have code that gets a comment when
// the button is clicked in scripts.js // the button is clicked in scripts.js
cy.get('.network-btn').click() cy.get('.network-btn').click();
// wait for GET comments/1 // wait for GET comments/1
cy.wait('@getComment').its('status').should('eq', 200) cy.wait('@getComment').its('status').should('eq', 200);
}) });
});
})

View File

@@ -2,21 +2,21 @@
context('Window', () => { context('Window', () => {
beforeEach(() => { beforeEach(() => {
cy.visit('https://example.cypress.io/commands/window') cy.visit('https://example.cypress.io/commands/window');
}) });
it('cy.window() - get the global window object', () => { it('cy.window() - get the global window object', () => {
// https://on.cypress.io/window // https://on.cypress.io/window
cy.window().should('have.property', 'top') cy.window().should('have.property', 'top');
}) });
it('cy.document() - get the document object', () => { it('cy.document() - get the document object', () => {
// https://on.cypress.io/document // https://on.cypress.io/document
cy.document().should('have.property', 'charset').and('eq', 'UTF-8') cy.document().should('have.property', 'charset').and('eq', 'UTF-8');
}) });
it('cy.title() - get the title', () => { it('cy.title() - get the title', () => {
// https://on.cypress.io/title // https://on.cypress.io/title
cy.title().should('include', 'Kitchen Sink') cy.title().should('include', 'Kitchen Sink');
}) });
}) });

View File

@@ -1,11 +1,9 @@
/* eslint-env jest */
/* global cy */
import { Base64 } from 'js-base64'; import { Base64 } from 'js-base64';
export const mermaidUrl = (graphStr, options, api) => { export const mermaidUrl = (graphStr, options, api) => {
const obj = { const obj = {
code: graphStr, code: graphStr,
mermaid: options mermaid: options,
}; };
const objStr = JSON.stringify(obj); const objStr = JSON.stringify(obj);
let url = 'http://localhost:9000/e2e.html?graph=' + Base64.encodeURI(objStr); let url = 'http://localhost:9000/e2e.html?graph=' + Base64.encodeURI(objStr);

View File

@@ -1,5 +1,4 @@
import { renderGraph } from '../../helpers/util'; import { renderGraph } from '../../helpers/util';
/* eslint-env jest */
describe('Configuration', () => { describe('Configuration', () => {
describe('arrowMarkerAbsolute', () => { describe('arrowMarkerAbsolute', () => {
it('should handle default value false of arrowMarkerAbsolute', () => { it('should handle default value false of arrowMarkerAbsolute', () => {
@@ -11,12 +10,14 @@ describe('Configuration', () => {
C -->|Two| E[iPhone] C -->|Two| E[iPhone]
C -->|Three| F[fa:fa-car Car] C -->|Three| F[fa:fa-car Car]
`, `,
{ } {}
); );
// Check the marker-end property to make sure it is properly set to // Check the marker-end property to make sure it is properly set to
// start with # // start with #
cy.get('.edgePath path').first().should('have.attr', 'marker-end') cy.get('.edgePath path')
.first()
.should('have.attr', 'marker-end')
.should('exist') .should('exist')
.and('include', 'url(#'); .and('include', 'url(#');
}); });
@@ -29,12 +30,14 @@ describe('Configuration', () => {
C -->|Two| E[iPhone] C -->|Two| E[iPhone]
C -->|Three| F[fa:fa-car Car] C -->|Three| F[fa:fa-car Car]
`, `,
{ } {}
); );
// Check the marker-end property to make sure it is properly set to // Check the marker-end property to make sure it is properly set to
// start with # // start with #
cy.get('.edgePath path').first().should('have.attr', 'marker-end') cy.get('.edgePath path')
.first()
.should('have.attr', 'marker-end')
.should('exist') .should('exist')
.and('include', 'url(#'); .and('include', 'url(#');
}); });
@@ -48,13 +51,15 @@ describe('Configuration', () => {
C -->|Three| F[fa:fa-car Car] C -->|Three| F[fa:fa-car Car]
`, `,
{ {
arrowMarkerAbsolute: false arrowMarkerAbsolute: false,
} }
); );
// Check the marker-end property to make sure it is properly set to // Check the marker-end property to make sure it is properly set to
// start with # // start with #
cy.get('.edgePath path').first().should('have.attr', 'marker-end') cy.get('.edgePath path')
.first()
.should('have.attr', 'marker-end')
.should('exist') .should('exist')
.and('include', 'url(#'); .and('include', 'url(#');
}); });
@@ -68,13 +73,15 @@ describe('Configuration', () => {
C -->|Three| F[fa:fa-car Car] C -->|Three| F[fa:fa-car Car]
`, `,
{ {
arrowMarkerAbsolute: "false" arrowMarkerAbsolute: 'false',
} }
); );
// Check the marker-end property to make sure it is properly set to // Check the marker-end property to make sure it is properly set to
// start with # // start with #
cy.get('.edgePath path').first().should('have.attr', 'marker-end') cy.get('.edgePath path')
.first()
.should('have.attr', 'marker-end')
.should('exist') .should('exist')
.and('include', 'url(#'); .and('include', 'url(#');
}); });
@@ -88,11 +95,13 @@ describe('Configuration', () => {
C -->|Three| F[fa:fa-car Car] C -->|Three| F[fa:fa-car Car]
`, `,
{ {
arrowMarkerAbsolute: true arrowMarkerAbsolute: true,
} }
); );
cy.get('.edgePath path').first().should('have.attr', 'marker-end') cy.get('.edgePath path')
.first()
.should('have.attr', 'marker-end')
.should('exist') .should('exist')
.and('include', 'url(http://localhost'); .and('include', 'url(http://localhost');
}); });

View File

@@ -1,13 +1,10 @@
/* eslint-env jest */
describe('Interaction', () => { describe('Interaction', () => {
describe('Interaction - security level loose', () => { describe('Interaction - security level loose', () => {
it('Graph: should handle a click on a node with a bound function', () => { it('Graph: should handle a click on a node with a bound function', () => {
const url = 'http://localhost:9000/click_security_loose.html'; const url = 'http://localhost:9000/click_security_loose.html';
cy.viewport(1440, 1024); cy.viewport(1440, 1024);
cy.visit(url); cy.visit(url);
cy.get('body') cy.get('body').find('g#flowchart-Function-2').click();
.find('g#flowchart-Function-2')
.click();
cy.get('.created-by-click').should('have.text', 'Clicked By Flow'); cy.get('.created-by-click').should('have.text', 'Clicked By Flow');
}); });
@@ -15,9 +12,7 @@ describe('Interaction', () => {
const url = 'http://localhost:9000/click_security_loose.html'; const url = 'http://localhost:9000/click_security_loose.html';
cy.viewport(1440, 1024); cy.viewport(1440, 1024);
cy.visit(url); cy.visit(url);
cy.get('body') cy.get('body').find('g#flowchart-FunctionArg-18').click();
.find('g#flowchart-FunctionArg-18')
.click();
cy.get('.created-by-click-2').should('have.text', 'Clicked By Flow: ARGUMENT'); cy.get('.created-by-click-2').should('have.text', 'Clicked By Flow: ARGUMENT');
}); });
@@ -25,9 +20,7 @@ describe('Interaction', () => {
const url = 'http://localhost:9000/click_security_loose.html'; const url = 'http://localhost:9000/click_security_loose.html';
cy.viewport(1440, 1024); cy.viewport(1440, 1024);
cy.visit(url); cy.visit(url);
cy.get('body') cy.get('body').find('g[id="flowchart-FunctionArg-22"]').click();
.find('g[id="flowchart-FunctionArg-22"]')
.click();
cy.get('.created-by-click-2').should('have.text', 'Clicked By Flow: ARGUMENT'); cy.get('.created-by-click-2').should('have.text', 'Clicked By Flow: ARGUMENT');
}); });
@@ -35,11 +28,9 @@ describe('Interaction', () => {
const url = 'http://localhost:9000/click_security_loose.html'; const url = 'http://localhost:9000/click_security_loose.html';
cy.viewport(1440, 1024); cy.viewport(1440, 1024);
cy.visit(url); cy.visit(url);
cy.get('body') cy.get('body').find('#flowchart-URL-3').click();
.find('#flowchart-URL-3')
.click();
cy.location().should(location => { cy.location().should((location) => {
expect(location.href).to.eq('http://localhost:9000/webpackUsage.html'); expect(location.href).to.eq('http://localhost:9000/webpackUsage.html');
}); });
}); });
@@ -47,11 +38,9 @@ describe('Interaction', () => {
const url = 'http://localhost:9000/click_security_loose.html'; const url = 'http://localhost:9000/click_security_loose.html';
cy.viewport(1440, 1024); cy.viewport(1440, 1024);
cy.visit(url); cy.visit(url);
cy.get('body') cy.get('body').find('g[id="flowchart-2URL-7"]').click();
.find('g[id="flowchart-2URL-7"]')
.click();
cy.location().should(location => { cy.location().should((location) => {
expect(location.href).to.eq('http://localhost:9000/webpackUsage.html'); expect(location.href).to.eq('http://localhost:9000/webpackUsage.html');
}); });
}); });
@@ -60,9 +49,7 @@ describe('Interaction', () => {
const url = 'http://localhost:9000/click_security_loose.html'; const url = 'http://localhost:9000/click_security_loose.html';
cy.viewport(1440, 1024); cy.viewport(1440, 1024);
cy.visit(url); cy.visit(url);
cy.get('body') cy.get('body').find('g#flowchart-Function-10').click();
.find('g#flowchart-Function-10')
.click();
cy.get('.created-by-click').should('have.text', 'Clicked By Flow'); cy.get('.created-by-click').should('have.text', 'Clicked By Flow');
}); });
@@ -70,9 +57,7 @@ describe('Interaction', () => {
const url = 'http://localhost:9000/click_security_loose.html'; const url = 'http://localhost:9000/click_security_loose.html';
cy.viewport(1440, 1024); cy.viewport(1440, 1024);
cy.visit(url); cy.visit(url);
cy.get('body') cy.get('body').find('g[id="flowchart-1Function-14"]').click();
.find('g[id="flowchart-1Function-14"]')
.click();
cy.get('.created-by-click').should('have.text', 'Clicked By Flow'); cy.get('.created-by-click').should('have.text', 'Clicked By Flow');
}); });
@@ -80,11 +65,9 @@ describe('Interaction', () => {
const url = 'http://localhost:9000/click_security_loose.html'; const url = 'http://localhost:9000/click_security_loose.html';
cy.viewport(1440, 1024); cy.viewport(1440, 1024);
cy.visit(url); cy.visit(url);
cy.get('body') cy.get('body').find('#flowchart-URL-11').click();
.find('#flowchart-URL-11')
.click();
cy.location().should(location => { cy.location().should((location) => {
expect(location.href).to.eq('http://localhost:9000/webpackUsage.html'); expect(location.href).to.eq('http://localhost:9000/webpackUsage.html');
}); });
}); });
@@ -92,11 +75,9 @@ describe('Interaction', () => {
const url = 'http://localhost:9000/click_security_loose.html'; const url = 'http://localhost:9000/click_security_loose.html';
cy.viewport(1440, 1024); cy.viewport(1440, 1024);
cy.visit(url); cy.visit(url);
cy.get('body') cy.get('body').find('g[id="flowchart-2URL-15"]').click();
.find('g[id="flowchart-2URL-15"]')
.click();
cy.location().should(location => { cy.location().should((location) => {
expect(location.href).to.eq('http://localhost:9000/webpackUsage.html'); expect(location.href).to.eq('http://localhost:9000/webpackUsage.html');
}); });
}); });
@@ -105,11 +86,9 @@ describe('Interaction', () => {
const url = 'http://localhost:9000/click_security_loose.html'; const url = 'http://localhost:9000/click_security_loose.html';
cy.viewport(1440, 1024); cy.viewport(1440, 1024);
cy.visit(url); cy.visit(url);
cy.get('body') cy.get('body').find('rect#cl1').click({ force: true });
.find('rect#cl1')
.click({ force: true });
cy.location().should(location => { cy.location().should((location) => {
expect(location.href).to.eq('http://localhost:9000/webpackUsage.html'); expect(location.href).to.eq('http://localhost:9000/webpackUsage.html');
}); });
}); });
@@ -117,11 +96,9 @@ describe('Interaction', () => {
const url = 'http://localhost:9000/click_security_loose.html'; const url = 'http://localhost:9000/click_security_loose.html';
cy.viewport(1440, 1024); cy.viewport(1440, 1024);
cy.visit(url); cy.visit(url);
cy.get('body') cy.get('body').find('text#cl1-text').click({ force: true });
.find('text#cl1-text')
.click({ force: true });
cy.location().should(location => { cy.location().should((location) => {
expect(location.href).to.eq('http://localhost:9000/webpackUsage.html'); expect(location.href).to.eq('http://localhost:9000/webpackUsage.html');
}); });
}); });
@@ -129,9 +106,7 @@ describe('Interaction', () => {
const url = 'http://localhost:9000/click_security_loose.html'; const url = 'http://localhost:9000/click_security_loose.html';
cy.viewport(1440, 1024); cy.viewport(1440, 1024);
cy.visit(url); cy.visit(url);
cy.get('body') cy.get('body').find('rect#cl2').click({ force: true });
.find('rect#cl2')
.click({ force: true });
cy.get('.created-by-gant-click').should('have.text', 'Clicked By Gant cl2'); cy.get('.created-by-gant-click').should('have.text', 'Clicked By Gant cl2');
}); });
@@ -139,9 +114,7 @@ describe('Interaction', () => {
const url = 'http://localhost:9000/click_security_loose.html'; const url = 'http://localhost:9000/click_security_loose.html';
cy.viewport(1440, 1024); cy.viewport(1440, 1024);
cy.visit(url); cy.visit(url);
cy.get('body') cy.get('body').find('rect#cl3').click({ force: true });
.find('rect#cl3')
.click({ force: true });
cy.get('.created-by-gant-click').should('have.text', 'Clicked By Gant test1 test2 test3'); cy.get('.created-by-gant-click').should('have.text', 'Clicked By Gant test1 test2 test3');
}); });
@@ -150,9 +123,7 @@ describe('Interaction', () => {
const url = 'http://localhost:9000/click_security_loose.html'; const url = 'http://localhost:9000/click_security_loose.html';
cy.viewport(1440, 1024); cy.viewport(1440, 1024);
cy.visit(url); cy.visit(url);
cy.get('body') cy.get('body').find('text#cl2-text').click({ force: true });
.find('text#cl2-text')
.click({ force: true });
cy.get('.created-by-gant-click').should('have.text', 'Clicked By Gant cl2'); cy.get('.created-by-gant-click').should('have.text', 'Clicked By Gant cl2');
}); });
@@ -160,13 +131,10 @@ describe('Interaction', () => {
const url = 'http://localhost:9000/click_security_loose.html'; const url = 'http://localhost:9000/click_security_loose.html';
cy.viewport(1440, 1024); cy.viewport(1440, 1024);
cy.visit(url); cy.visit(url);
cy.get('body') cy.get('body').find('text#cl3-text').click({ force: true });
.find('text#cl3-text')
.click({ force: true });
cy.get('.created-by-gant-click').should('have.text', 'Clicked By Gant test1 test2 test3'); cy.get('.created-by-gant-click').should('have.text', 'Clicked By Gant test1 test2 test3');
}); });
}); });
describe('Interaction - security level tight', () => { describe('Interaction - security level tight', () => {
@@ -174,9 +142,7 @@ describe('Interaction', () => {
const url = 'http://localhost:9000/click_security_strict.html'; const url = 'http://localhost:9000/click_security_strict.html';
cy.viewport(1440, 1024); cy.viewport(1440, 1024);
cy.visit(url); cy.visit(url);
cy.get('body') cy.get('body').find('g#flowchart-Function-2').click();
.find('g#flowchart-Function-2')
.click();
cy.get('.created-by-click').should('not.exist'); cy.get('.created-by-click').should('not.exist');
// cy.get('.created-by-click').should('not.have.text', 'Clicked By Flow'); // cy.get('.created-by-click').should('not.have.text', 'Clicked By Flow');
@@ -185,9 +151,7 @@ describe('Interaction', () => {
const url = 'http://localhost:9000/click_security_strict.html'; const url = 'http://localhost:9000/click_security_strict.html';
cy.viewport(1440, 1024); cy.viewport(1440, 1024);
cy.visit(url); cy.visit(url);
cy.get('body') cy.get('body').find('g[id="flowchart-1Function-6"]').click();
.find('g[id="flowchart-1Function-6"]')
.click();
// cy.get('.created-by-click').should('not.have.text', 'Clicked By Flow'); // cy.get('.created-by-click').should('not.have.text', 'Clicked By Flow');
cy.get('.created-by-click').should('not.exist'); cy.get('.created-by-click').should('not.exist');
@@ -196,11 +160,9 @@ describe('Interaction', () => {
const url = 'http://localhost:9000/click_security_strict.html'; const url = 'http://localhost:9000/click_security_strict.html';
cy.viewport(1440, 1024); cy.viewport(1440, 1024);
cy.visit(url); cy.visit(url);
cy.get('body') cy.get('body').find('g#flowchart-URL-3').click();
.find('g#flowchart-URL-3')
.click();
cy.location().should(location => { cy.location().should((location) => {
expect(location.href).to.eq('http://localhost:9000/webpackUsage.html'); expect(location.href).to.eq('http://localhost:9000/webpackUsage.html');
}); });
}); });
@@ -208,11 +170,9 @@ describe('Interaction', () => {
const url = 'http://localhost:9000/click_security_strict.html'; const url = 'http://localhost:9000/click_security_strict.html';
cy.viewport(1440, 1024); cy.viewport(1440, 1024);
cy.visit(url); cy.visit(url);
cy.get('body') cy.get('body').find('g[id="flowchart-2URL-7"]').click();
.find('g[id="flowchart-2URL-7"]')
.click();
cy.location().should(location => { cy.location().should((location) => {
expect(location.href).to.eq('http://localhost:9000/webpackUsage.html'); expect(location.href).to.eq('http://localhost:9000/webpackUsage.html');
}); });
}); });
@@ -221,11 +181,9 @@ describe('Interaction', () => {
const url = 'http://localhost:9000/click_security_strict.html'; const url = 'http://localhost:9000/click_security_strict.html';
cy.viewport(1440, 1024); cy.viewport(1440, 1024);
cy.visit(url); cy.visit(url);
cy.get('body') cy.get('body').find('rect#cl1').click({ force: true });
.find('rect#cl1')
.click({ force: true });
cy.location().should(location => { cy.location().should((location) => {
expect(location.href).to.eq('http://localhost:9000/webpackUsage.html'); expect(location.href).to.eq('http://localhost:9000/webpackUsage.html');
}); });
}); });
@@ -233,11 +191,9 @@ describe('Interaction', () => {
const url = 'http://localhost:9000/click_security_strict.html'; const url = 'http://localhost:9000/click_security_strict.html';
cy.viewport(1440, 1024); cy.viewport(1440, 1024);
cy.visit(url); cy.visit(url);
cy.get('body') cy.get('body').find('text#cl1-text').click({ force: true });
.find('text#cl1-text')
.click({ force: true });
cy.location().should(location => { cy.location().should((location) => {
expect(location.href).to.eq('http://localhost:9000/webpackUsage.html'); expect(location.href).to.eq('http://localhost:9000/webpackUsage.html');
}); });
}); });
@@ -245,23 +201,19 @@ describe('Interaction', () => {
const url = 'http://localhost:9000/click_security_strict.html'; const url = 'http://localhost:9000/click_security_strict.html';
cy.viewport(1440, 1024); cy.viewport(1440, 1024);
cy.visit(url); cy.visit(url);
cy.get('body') cy.get('body').find('rect#cl2').click({ force: true });
.find('rect#cl2')
.click({ force: true });
// cy.get('.created-by-gant-click').should('not.have.text', 'Clicked By Gant cl2'); // cy.get('.created-by-gant-click').should('not.have.text', 'Clicked By Gant cl2');
cy.get('.created-by-gant-click').should('not.exist') cy.get('.created-by-gant-click').should('not.exist');
}); });
it('should handle a click on a task with a bound function', () => { it('should handle a click on a task with a bound function', () => {
const url = 'http://localhost:9000/click_security_strict.html'; const url = 'http://localhost:9000/click_security_strict.html';
cy.viewport(1440, 1024); cy.viewport(1440, 1024);
cy.visit(url); cy.visit(url);
cy.get('body') cy.get('body').find('text#cl2-text').click({ force: true });
.find('text#cl2-text')
.click({ force: true });
// cy.get('.created-by-gant-click').should('not.have.text', 'Clicked By Gant cl2'); // cy.get('.created-by-gant-click').should('not.have.text', 'Clicked By Gant cl2');
cy.get('.created-by-gant-click').should('not.exist') cy.get('.created-by-gant-click').should('not.exist');
}); });
}); });
@@ -270,9 +222,7 @@ describe('Interaction', () => {
const url = 'http://localhost:9000/click_security_other.html'; const url = 'http://localhost:9000/click_security_other.html';
cy.viewport(1440, 1024); cy.viewport(1440, 1024);
cy.visit(url); cy.visit(url);
cy.get('body') cy.get('body').find('g#flowchart-Function-2').click();
.find('g#flowchart-Function-2')
.click();
// cy.get('.created-by-click').should('not.have.text', 'Clicked By Flow'); // cy.get('.created-by-click').should('not.have.text', 'Clicked By Flow');
cy.get('.created-by-click').should('not.exist'); cy.get('.created-by-click').should('not.exist');
@@ -281,9 +231,7 @@ describe('Interaction', () => {
const url = 'http://localhost:9000/click_security_other.html'; const url = 'http://localhost:9000/click_security_other.html';
cy.viewport(1440, 1024); cy.viewport(1440, 1024);
cy.visit(url); cy.visit(url);
cy.get('body') cy.get('body').find('g[id="flowchart-1Function-6"]').click();
.find('g[id="flowchart-1Function-6"]')
.click();
cy.get('.created-by-click').should('not.exist'); cy.get('.created-by-click').should('not.exist');
cy.get('.created-by-click').should('not.exist'); cy.get('.created-by-click').should('not.exist');
@@ -292,11 +240,9 @@ describe('Interaction', () => {
const url = 'http://localhost:9000/click_security_other.html'; const url = 'http://localhost:9000/click_security_other.html';
cy.viewport(1440, 1024); cy.viewport(1440, 1024);
cy.visit(url); cy.visit(url);
cy.get('body') cy.get('body').find('g#flowchart-URL-3').click();
.find('g#flowchart-URL-3')
.click();
cy.location().should(location => { cy.location().should((location) => {
expect(location.href).to.eq('http://localhost:9000/webpackUsage.html'); expect(location.href).to.eq('http://localhost:9000/webpackUsage.html');
}); });
}); });
@@ -305,9 +251,7 @@ describe('Interaction', () => {
const url = 'http://localhost:9000/click_security_other.html'; const url = 'http://localhost:9000/click_security_other.html';
cy.viewport(1440, 1024); cy.viewport(1440, 1024);
cy.visit(url); cy.visit(url);
cy.get('body') cy.get('body').find('rect#cl2').click({ force: true });
.find('rect#cl2')
.click({ force: true });
cy.get('.created-by-gant-click').should('not.exist'); cy.get('.created-by-gant-click').should('not.exist');
}); });
@@ -315,9 +259,7 @@ describe('Interaction', () => {
const url = 'http://localhost:9000/click_security_other.html'; const url = 'http://localhost:9000/click_security_other.html';
cy.viewport(1440, 1024); cy.viewport(1440, 1024);
cy.visit(url); cy.visit(url);
cy.get('body') cy.get('body').find('text#cl2-text').click({ force: true });
.find('text#cl2-text')
.click({ force: true });
cy.get('.created-by-gant-click').should('not.exist'); cy.get('.created-by-gant-click').should('not.exist');
}); });

View File

@@ -1,22 +1,19 @@
/* eslint-env jest */
describe('Rerendering', () => { describe('Rerendering', () => {
it('should be able to render after an error has occured', () => { it('should be able to render after an error has occured', () => {
const url = 'http://localhost:9000/render-after-error.html'; const url = 'http://localhost:9000/render-after-error.html';
cy.viewport(1440, 1024); cy.viewport(1440, 1024);
cy.visit(url); cy.visit(url);
cy.get('#graphDiv').should('exist'); cy.get('#graphDiv').should('exist');
}); });
it('should be able to render and rerender a graph via API', () => { it('should be able to render and rerender a graph via API', () => {
const url = 'http://localhost:9000/rerender.html'; const url = 'http://localhost:9000/rerender.html';
cy.viewport(1440, 1024); cy.viewport(1440, 1024);
cy.visit(url); cy.visit(url);
cy.get('#graph [id^=flowchart-A]').should('have.text', 'XMas'); cy.get('#graph [id^=flowchart-A]').should('have.text', 'XMas');
cy.get('body') cy.get('body').find('#rerender').click({ force: true });
.find('#rerender')
.click({ force: true });
cy.get('#graph [id^=flowchart-A]').should('have.text', 'Saturday'); cy.get('#graph [id^=flowchart-A]').should('have.text', 'Saturday');
}); });
}); });

View File

@@ -1,20 +1,15 @@
/* eslint-env jest */
describe('Sequencediagram', () => { describe('Sequencediagram', () => {
it('should render a simple sequence diagrams', () => { it('should render a simple sequence diagrams', () => {
const url = 'http://localhost:9000/webpackUsage.html'; const url = 'http://localhost:9000/webpackUsage.html';
cy.visit(url); cy.visit(url);
cy.get('body') cy.get('body').find('svg').should('have.length', 1);
.find('svg')
.should('have.length', 1);
}); });
it('should handle html escapings properly', () => { it('should handle html escapings properly', () => {
const url = 'http://localhost:9000/webpackUsage.html?test-html-escaping=true'; const url = 'http://localhost:9000/webpackUsage.html?test-html-escaping=true';
cy.visit(url); cy.visit(url);
cy.get('body') cy.get('body').find('svg').should('have.length', 1);
.find('svg')
.should('have.length', 1);
cy.get('g.label > foreignobject > div').should('not.contain.text', '<b>'); cy.get('g.label > foreignobject > div').should('not.contain.text', '<b>');
}); });

View File

@@ -1,72 +1,113 @@
/* eslint-env jest */
import { mermaidUrl } from '../../helpers/util.js'; import { mermaidUrl } from '../../helpers/util.js';
/* eslint-disable */
describe('XSS', () => { describe('XSS', () => {
it('should handle xss in tags', () => { it('should handle xss in tags', () => {
const str = 'eyJjb2RlIjoiXG5ncmFwaCBMUlxuICAgICAgQi0tPkQoPGltZyBvbmVycm9yPWxvY2F0aW9uPWBqYXZhc2NyaXB0XFx1MDAzYXhzc0F0dGFja1xcdTAwMjhkb2N1bWVudC5kb21haW5cXHUwMDI5YCBzcmM9eD4pOyIsIm1lcm1haWQiOnsidGhlbWUiOiJkZWZhdWx0In19'; const str =
'eyJjb2RlIjoiXG5ncmFwaCBMUlxuICAgICAgQi0tPkQoPGltZyBvbmVycm9yPWxvY2F0aW9uPWBqYXZhc2NyaXB0XFx1MDAzYXhzc0F0dGFja1xcdTAwMjhkb2N1bWVudC5kb21haW5cXHUwMDI5YCBzcmM9eD4pOyIsIm1lcm1haWQiOnsidGhlbWUiOiJkZWZhdWx0In19';
const url = mermaidUrl(str,{}, true); const url = mermaidUrl(str, {}, true);
cy.visit(url); cy.visit(url);
cy.wait(1000).then(()=>{ cy.wait(1000).then(() => {
cy.get('.mermaid').should('exist'); cy.get('.mermaid').should('exist');
}); });
cy.get('svg') cy.get('svg');
}) });
it('should not allow tags in the css', () => { it('should not allow tags in the css', () => {
const str = 'eyJjb2RlIjoiJSV7aW5pdDogeyAnZm9udEZhbWlseSc6ICdcXFwiPjwvc3R5bGU-PGltZyBzcmM9eCBvbmVycm9yPXhzc0F0dGFjaygpPid9IH0lJVxuZ3JhcGggTFJcbiAgICAgQSAtLT4gQiIsIm1lcm1haWQiOnsidGhlbWUiOiJkZWZhdWx0IiwiZmxvd2NoYXJ0Ijp7Imh0bWxMYWJlbHMiOmZhbHNlfX0sInVwZGF0ZUVkaXRvciI6ZmFsc2V9'; const str =
'eyJjb2RlIjoiJSV7aW5pdDogeyAnZm9udEZhbWlseSc6ICdcXFwiPjwvc3R5bGU-PGltZyBzcmM9eCBvbmVycm9yPXhzc0F0dGFjaygpPid9IH0lJVxuZ3JhcGggTFJcbiAgICAgQSAtLT4gQiIsIm1lcm1haWQiOnsidGhlbWUiOiJkZWZhdWx0IiwiZmxvd2NoYXJ0Ijp7Imh0bWxMYWJlbHMiOmZhbHNlfX0sInVwZGF0ZUVkaXRvciI6ZmFsc2V9';
const url = mermaidUrl(str,{ const url = mermaidUrl(
"theme": "default", str,
"flowchart": { {
"htmlMode": false theme: 'default',
} flowchart: {
}, true); htmlMode: false,
},
},
true
);
cy.visit(url); cy.visit(url);
cy.wait(1000).then(()=>{ cy.wait(1000).then(() => {
cy.get('#the-malware').should('not.exist'); cy.get('#the-malware').should('not.exist');
}); });
});
})
it('should handle xss in tags in non-html mode', () => { it('should handle xss in tags in non-html mode', () => {
const str = 'eyJjb2RlIjoiXG5ncmFwaCBMUlxuICAgICAgQi0tPkQoPGltZyBvbmVycm9yPWxvY2F0aW9uPWBqYXZhc2NyaXB0XFx1MDAzYXhzc0F0dGFja1xcdTAwMjhkb2N1bWVudC5kb21haW5cXHUwMDI5YCBzcmM9eD4pOyIsIm1lcm1haWQiOnsidGhlbWUiOiJkZWZhdWx0IiwiZmxvd2NoYXJ0Ijp7Imh0bWxMYWJlbHMiOmZhbHNlfX19'; const str =
'eyJjb2RlIjoiXG5ncmFwaCBMUlxuICAgICAgQi0tPkQoPGltZyBvbmVycm9yPWxvY2F0aW9uPWBqYXZhc2NyaXB0XFx1MDAzYXhzc0F0dGFja1xcdTAwMjhkb2N1bWVudC5kb21haW5cXHUwMDI5YCBzcmM9eD4pOyIsIm1lcm1haWQiOnsidGhlbWUiOiJkZWZhdWx0IiwiZmxvd2NoYXJ0Ijp7Imh0bWxMYWJlbHMiOmZhbHNlfX19';
const url = mermaidUrl(str,{ const url = mermaidUrl(
"theme": "default", str,
"flowchart": { {
"htmlMode": false theme: 'default',
} flowchart: {
}, true); htmlMode: false,
},
},
true
);
cy.visit(url); cy.visit(url);
cy.wait(1000) cy.wait(1000);
cy.get('#the-malware').should('not.exist'); cy.get('#the-malware').should('not.exist');
}) });
it('should not allow changing the __proto__ attribute using config', () => { it('should not allow changing the __proto__ attribute using config', () => {
cy.visit('http://localhost:9000/xss2.html'); cy.visit('http://localhost:9000/xss2.html');
cy.wait(1000); cy.wait(1000);
cy.get('#the-malware').should('not.exist'); cy.get('#the-malware').should('not.exist');
}) });
it('should not allow maniplulating htmlLabels into a false positive', () => { it('should not allow maniplulating htmlLabels into a false positive', () => {
cy.visit('http://localhost:9000/xss4.html'); cy.visit('http://localhost:9000/xss4.html');
cy.wait(1000); cy.wait(1000);
cy.get('#the-malware').should('not.exist'); cy.get('#the-malware').should('not.exist');
}) });
it('should not allow maniplulating antiscript to run javascript', () => { it('should not allow maniplulating antiscript to run javascript', () => {
cy.visit('http://localhost:9000/xss5.html'); cy.visit('http://localhost:9000/xss5.html');
cy.wait(1000); cy.wait(1000);
cy.get('#the-malware').should('not.exist'); cy.get('#the-malware').should('not.exist');
}) });
it('should not allow maniplulating antiscript to run javascript using onerror', () => { it('should not allow maniplulating antiscript to run javascript using onerror', () => {
cy.visit('http://localhost:9000/xss6.html'); cy.visit('http://localhost:9000/xss6.html');
cy.wait(1000); cy.wait(1000);
cy.get('#the-malware').should('not.exist'); cy.get('#the-malware').should('not.exist');
}) });
it('should not allow maniplulating antiscript to run javascript using onerror in state diagrams with dagre wrapper', () => {
}) cy.visit('http://localhost:9000/xss8.html');
cy.wait(1000);
cy.get('#the-malware').should('not.exist');
});
it('should not allow maniplulating antiscript to run javascript using onerror in state diagrams with dagre d3', () => {
cy.visit('http://localhost:9000/xss9.html');
cy.wait(1000);
cy.get('#the-malware').should('not.exist');
});
it('should not allow maniplulating antiscript to run javascript using onerror in state diagrams with dagre d3', () => {
cy.visit('http://localhost:9000/xss10.html');
cy.wait(1000);
cy.get('#the-malware').should('not.exist');
});
it('should not allow maniplulating antiscript to run javascript using onerror in state diagrams with dagre d3', () => {
cy.visit('http://localhost:9000/xss11.html');
cy.wait(1000);
cy.get('#the-malware').should('not.exist');
});
it('should not allow maniplulating antiscript to run javascript using onerror in state diagrams with dagre d3', () => {
cy.visit('http://localhost:9000/xss12.html');
cy.wait(1000);
cy.get('#the-malware').should('not.exist');
});
it('should not allow maniplulating antiscript to run javascript using onerror in state diagrams with dagre d3', () => {
cy.visit('http://localhost:9000/xss13.html');
cy.wait(1000);
cy.get('#the-malware').should('not.exist');
});
it('should not allow maniplulating antiscript to run javascript iframes in class diagrams', () => {
cy.visit('http://localhost:9000/xss14.html');
cy.wait(1000);
cy.get('#the-malware').should('not.exist');
});
});

View File

@@ -1,10 +1,8 @@
/* eslint-env jest */
import { imgSnapshotTest } from '../../helpers/util'; import { imgSnapshotTest } from '../../helpers/util';
describe('Class diagram V2', () => { describe('Class diagram V2', () => {
it('0: should render a simple class diagram', () => {
it('0: should render a simple class diagram', () => { imgSnapshotTest(
imgSnapshotTest( `
`
classDiagram-v2 classDiagram-v2
classA -- classB : Inheritance classA -- classB : Inheritance
@@ -13,10 +11,10 @@ describe('Class diagram V2', () => {
classB -- classD classB -- classD
`, `,
{logLevel : 1, flowchart: { "htmlLabels": false },} { logLevel: 1, flowchart: { htmlLabels: false } }
); );
cy.get('svg'); cy.get('svg');
}); });
it('1: should render a simple class diagram', () => { it('1: should render a simple class diagram', () => {
imgSnapshotTest( imgSnapshotTest(
@@ -47,7 +45,7 @@ describe('Class diagram V2', () => {
test() test()
} }
`, `,
{logLevel : 1, flowchart: { "htmlLabels": false },} { logLevel: 1, flowchart: { htmlLabels: false } }
); );
cy.get('svg'); cy.get('svg');
}); });
@@ -76,8 +74,7 @@ describe('Class diagram V2', () => {
test() test()
} }
`, `,
{logLevel : 1, flowchart: { "htmlLabels": false },} { logLevel: 1, flowchart: { htmlLabels: false } }
); );
cy.get('svg'); cy.get('svg');
}); });
@@ -95,7 +92,7 @@ describe('Class diagram V2', () => {
Class01 : +int publicGorilla Class01 : +int publicGorilla
Class01 : #int protectedMarmoset Class01 : #int protectedMarmoset
`, `,
{logLevel : 1, flowchart: { "htmlLabels": false },} { logLevel: 1, flowchart: { htmlLabels: false } }
); );
cy.get('svg'); cy.get('svg');
}); });
@@ -103,7 +100,7 @@ describe('Class diagram V2', () => {
it('should render multiple class diagrams', () => { it('should render multiple class diagrams', () => {
imgSnapshotTest( imgSnapshotTest(
[ [
` `
classDiagram-v2 classDiagram-v2
Class01 "1" <|--|> "*" AveryLongClass : Cool Class01 "1" <|--|> "*" AveryLongClass : Cool
&lt;&lt;interface&gt;&gt; Class01 &lt;&lt;interface&gt;&gt; Class01
@@ -125,7 +122,7 @@ describe('Class diagram V2', () => {
test() test()
} }
`, `,
` `
classDiagram-v2 classDiagram-v2
Class01 "1" <|--|> "*" AveryLongClass : Cool Class01 "1" <|--|> "*" AveryLongClass : Cool
&lt;&lt;interface&gt;&gt; Class01 &lt;&lt;interface&gt;&gt; Class01
@@ -148,7 +145,7 @@ describe('Class diagram V2', () => {
} }
`, `,
], ],
{logLevel : 1, flowchart: { "htmlLabels": false },} { logLevel: 1, flowchart: { htmlLabels: false } }
); );
cy.get('svg'); cy.get('svg');
}); });
@@ -178,7 +175,7 @@ describe('Class diagram V2', () => {
test() test()
} }
`, `,
{logLevel : 1, flowchart: { "htmlLabels": false },} { logLevel: 1, flowchart: { htmlLabels: false } }
); );
cy.get('svg'); cy.get('svg');
}); });
@@ -190,7 +187,7 @@ describe('Class diagram V2', () => {
Class01 <|-- AveryLongClass : Cool Class01 <|-- AveryLongClass : Cool
Class01 : someMethod()* Class01 : someMethod()*
`, `,
{logLevel : 1, flowchart: { "htmlLabels": false },} { logLevel: 1, flowchart: { htmlLabels: false } }
); );
cy.get('svg'); cy.get('svg');
}); });
@@ -202,7 +199,7 @@ describe('Class diagram V2', () => {
Class01 <|-- AveryLongClass : Cool Class01 <|-- AveryLongClass : Cool
Class01 : someMethod()$ Class01 : someMethod()$
`, `,
{logLevel : 1, flowchart: { "htmlLabels": false },} { logLevel: 1, flowchart: { htmlLabels: false } }
); );
cy.get('svg'); cy.get('svg');
}); });
@@ -222,7 +219,7 @@ describe('Class diagram V2', () => {
test() test()
} }
`, `,
{logLevel : 1, flowchart: { "htmlLabels": false },} { logLevel: 1, flowchart: { htmlLabels: false } }
); );
cy.get('svg'); cy.get('svg');
}); });
@@ -243,7 +240,7 @@ describe('Class diagram V2', () => {
test() test()
} }
`, `,
{logLevel : 1, flowchart: { "htmlLabels": false },} { logLevel: 1, flowchart: { htmlLabels: false } }
); );
cy.get('svg'); cy.get('svg');
}); });
@@ -265,7 +262,7 @@ describe('Class diagram V2', () => {
} }
link Class01 "google.com" "A Tooltip" link Class01 "google.com" "A Tooltip"
`, `,
{logLevel : 1, flowchart: { "htmlLabels": false },} { logLevel: 1, flowchart: { htmlLabels: false } }
); );
cy.get('svg'); cy.get('svg');
}); });
@@ -287,7 +284,7 @@ describe('Class diagram V2', () => {
} }
callback Class01 "functionCall" "A Tooltip" callback Class01 "functionCall" "A Tooltip"
`, `,
{logLevel : 1, flowchart: { "htmlLabels": false },} { logLevel: 1, flowchart: { htmlLabels: false } }
); );
cy.get('svg'); cy.get('svg');
}); });
@@ -302,7 +299,7 @@ describe('Class diagram V2', () => {
testArray() bool[] testArray() bool[]
} }
`, `,
{logLevel : 1, flowchart: { "htmlLabels": false },} { logLevel: 1, flowchart: { htmlLabels: false } }
); );
cy.get('svg'); cy.get('svg');
}); });
@@ -318,7 +315,7 @@ describe('Class diagram V2', () => {
testArray() bool[] testArray() bool[]
} }
`, `,
{logLevel : 1, flowchart: { "htmlLabels": false },} { logLevel: 1, flowchart: { htmlLabels: false } }
); );
cy.get('svg'); cy.get('svg');
}); });
@@ -336,7 +333,7 @@ describe('Class diagram V2', () => {
cssClass "Class10" exClass2 cssClass "Class10" exClass2
`, `,
{logLevel : 1, flowchart: { "htmlLabels": false },} { logLevel: 1, flowchart: { htmlLabels: false } }
); );
cy.get('svg'); cy.get('svg');
}); });
@@ -352,7 +349,7 @@ describe('Class diagram V2', () => {
testArray() bool[] testArray() bool[]
} }
`, `,
{logLevel : 1, flowchart: { "htmlLabels": false },} { logLevel: 1, flowchart: { htmlLabels: false } }
); );
cy.get('svg'); cy.get('svg');
}); });
@@ -366,7 +363,118 @@ describe('Class diagram V2', () => {
cssClass "Class10, class20" exClass2 cssClass "Class10, class20" exClass2
`, `,
{logLevel : 1, flowchart: { "htmlLabels": false },} { logLevel: 1, flowchart: { htmlLabels: false } }
);
cy.get('svg');
});
it('16a: should render a simple class diagram with static field', () => {
imgSnapshotTest(
`
classDiagram-v2
class Foo {
+String bar$
}
`,
{ logLevel: 1, flowchart: { htmlLabels: false } }
);
cy.get('svg');
});
it('16b: should handle the direction statemnent with TB', () => {
imgSnapshotTest(
`
classDiagram
direction TB
class Student {
-idCard : IdCard
}
class IdCard{
-id : int
-name : string
}
class Bike{
-id : int
-name : string
}
Student "1" --o "1" IdCard : carries
Student "1" --o "1" Bike : rides
`,
{ logLevel: 1, flowchart: { htmlLabels: false } }
);
cy.get('svg');
});
it('18: should handle the direction statemnent with LR', () => {
imgSnapshotTest(
`
classDiagram
direction LR
class Student {
-idCard : IdCard
}
class IdCard{
-id : int
-name : string
}
class Bike{
-id : int
-name : string
}
Student "1" --o "1" IdCard : carries
Student "1" --o "1" Bike : rides
`,
{ logLevel: 1, flowchart: { htmlLabels: false } }
);
cy.get('svg');
});
it('17a: should handle the direction statemnent with BT', () => {
imgSnapshotTest(
`
classDiagram
direction BT
class Student {
-idCard : IdCard
}
class IdCard{
-id : int
-name : string
}
class Bike{
-id : int
-name : string
}
Student "1" --o "1" IdCard : carries
Student "1" --o "1" Bike : rides
`,
{ logLevel: 1, flowchart: { htmlLabels: false } }
);
cy.get('svg');
});
it('17b: should handle the direction statemment with RL', () => {
imgSnapshotTest(
`
classDiagram
direction RL
class Student {
-idCard : IdCard
}
class IdCard{
-id : int
-name : string
}
class Bike{
-id : int
-name : string
}
Student "1" --o "1" IdCard : carries
Student "1" --o "1" Bike : rides
`,
{ logLevel: 1, flowchart: { htmlLabels: false } }
); );
cy.get('svg'); cy.get('svg');
}); });

View File

@@ -1,406 +1,410 @@
/* eslint-env jest */ import { imgSnapshotTest, renderGraph } from '../../helpers/util';
import { imgSnapshotTest, renderGraph } from '../../helpers/util';
describe('Class diagram', () => {
describe('Class diagram', () => { it('1: should render a simple class diagram', () => {
it('1: should render a simple class diagram', () => { imgSnapshotTest(
imgSnapshotTest( `
` classDiagram
classDiagram Class01 <|-- AveryLongClass : Cool
Class01 <|-- AveryLongClass : Cool &lt;&lt;interface&gt;&gt; Class01
&lt;&lt;interface&gt;&gt; Class01 Class03 *-- Class04
Class03 *-- Class04 Class05 o-- Class06
Class05 o-- Class06 Class07 .. Class08
Class07 .. Class08 Class09 --> C2 : Where am i?
Class09 --> C2 : Where am i? Class09 --* C3
Class09 --* C3 Class09 --|> Class07
Class09 --|> Class07 Class12 <|.. Class08
Class12 <|.. Class08 Class11 ..>Class12
Class11 ..>Class12 Class07 : equals()
Class07 : equals() Class07 : Object[] elementData
Class07 : Object[] elementData Class01 : size()
Class01 : size() Class01 : int chimp
Class01 : int chimp Class01 : int gorilla
Class01 : int gorilla Class01 : -int privateChimp
Class01 : -int privateChimp Class01 : +int publicGorilla
Class01 : +int publicGorilla Class01 : #int protectedMarmoset
Class01 : #int protectedMarmoset Class08 <--> C2: Cool label
Class08 <--> C2: Cool label class Class10 {
class Class10 { &lt;&lt;service&gt;&gt;
&lt;&lt;service&gt;&gt; int id
int id test()
test() }
} `,
`, { logLevel: 1 }
{logLevel : 1} );
); cy.get('svg');
cy.get('svg'); });
});
it('2: should render a simple class diagrams with cardinality', () => {
it('2: should render a simple class diagrams with cardinality', () => { imgSnapshotTest(
imgSnapshotTest( `
` classDiagram
classDiagram Class01 "1" <|--|> "*" AveryLongClass : Cool
Class01 "1" <|--|> "*" AveryLongClass : Cool &lt;&lt;interface&gt;&gt; Class01
&lt;&lt;interface&gt;&gt; Class01 Class03 "1" *-- "*" Class04
Class03 "1" *-- "*" Class04 Class05 "1" o-- "many" Class06
Class05 "1" o-- "many" Class06 Class07 "1" .. "*" Class08
Class07 "1" .. "*" Class08 Class09 "1" --> "*" C2 : Where am i?
Class09 "1" --> "*" C2 : Where am i? Class09 "*" --* "*" C3
Class09 "*" --* "*" C3 Class09 "1" --|> "1" Class07
Class09 "1" --|> "1" Class07 Class07 : equals()
Class07 : equals() Class07 : Object[] elementData
Class07 : Object[] elementData Class01 : size()
Class01 : size() Class01 : int chimp
Class01 : int chimp Class01 : int gorilla
Class01 : int gorilla Class08 "1" <--> "*" C2: Cool label
Class08 "1" <--> "*" C2: Cool label class Class10 {
class Class10 { &lt;&lt;service&gt;&gt;
&lt;&lt;service&gt;&gt; int id
int id test()
test() }
} `,
`, {}
{} );
); cy.get('svg');
cy.get('svg'); });
});
it('3: should render a simple class diagram with different visibilities', () => {
it('3: should render a simple class diagram with different visibilities', () => { imgSnapshotTest(
imgSnapshotTest( `
` classDiagram
classDiagram Class01 <|-- AveryLongClass : Cool
Class01 <|-- AveryLongClass : Cool &lt;&lt;interface&gt;&gt; Class01
&lt;&lt;interface&gt;&gt; Class01 Class01 : -privateMethod()
Class01 : -privateMethod() Class01 : +publicMethod()
Class01 : +publicMethod() Class01 : #protectedMethod()
Class01 : #protectedMethod() Class01 : -int privateChimp
Class01 : -int privateChimp Class01 : +int publicGorilla
Class01 : +int publicGorilla Class01 : #int protectedMarmoset
Class01 : #int protectedMarmoset `,
`, {}
{} );
); cy.get('svg');
cy.get('svg'); });
});
it('4: should render a simple class diagram with comments', () => {
it('4: should render a simple class diagram with comments', () => { imgSnapshotTest(
imgSnapshotTest( `
` classDiagram
classDiagram %% this is a comment
%% this is a comment Class01 <|-- AveryLongClass : Cool
Class01 <|-- AveryLongClass : Cool &lt;&lt;interface&gt;&gt; Class01
&lt;&lt;interface&gt;&gt; Class01 Class03 *-- Class04
Class03 *-- Class04 Class05 o-- Class06
Class05 o-- Class06 Class07 .. Class08
Class07 .. Class08 Class09 --> C2 : Where am i?
Class09 --> C2 : Where am i? Class09 --* C3
Class09 --* C3 Class09 --|> Class07
Class09 --|> Class07 Class07 : equals()
Class07 : equals() Class07 : Object[] elementData
Class07 : Object[] elementData Class01 : size()
Class01 : size() Class01 : int chimp
Class01 : int chimp Class01 : int gorilla
Class01 : int gorilla Class08 <--> C2: Cool label
Class08 <--> C2: Cool label class Class10 {
class Class10 { &lt;&lt;service&gt;&gt;
&lt;&lt;service&gt;&gt; int id
int id test()
test() }
} `,
`, {}
{} );
); cy.get('svg');
cy.get('svg'); });
});
it('5: should render a simple class diagram with abstract method', () => {
it('5: should render a simple class diagram with abstract method', () => { imgSnapshotTest(
imgSnapshotTest( `
` classDiagram
classDiagram Class01 <|-- AveryLongClass : Cool
Class01 <|-- AveryLongClass : Cool Class01 : someMethod()*
Class01 : someMethod()* `,
`, {}
{} );
); cy.get('svg');
cy.get('svg'); });
});
it('6: should render a simple class diagram with static method', () => {
it('6: should render a simple class diagram with static method', () => { imgSnapshotTest(
imgSnapshotTest( `
` classDiagram
classDiagram Class01 <|-- AveryLongClass : Cool
Class01 <|-- AveryLongClass : Cool Class01 : someMethod()$
Class01 : someMethod()$ `,
`, {}
{} );
); cy.get('svg');
cy.get('svg'); });
});
it('7: should render a simple class diagram with Generic class', () => {
it('7: should render a simple class diagram with Generic class', () => { imgSnapshotTest(
imgSnapshotTest( `
` classDiagram
classDiagram class Class01~T~
class Class01~T~ Class01 : size()
Class01 : size() Class01 : int chimp
Class01 : int chimp Class01 : int gorilla
Class01 : int gorilla Class08 <--> C2: Cool label
Class08 <--> C2: Cool label class Class10~T~ {
class Class10~T~ { &lt;&lt;service&gt;&gt;
&lt;&lt;service&gt;&gt; int id
int id test()
test() }
} `,
`, {}
{} );
); cy.get('svg');
cy.get('svg'); });
});
it('8: should render a simple class diagram with Generic class and relations', () => {
it('8: should render a simple class diagram with Generic class and relations', () => { imgSnapshotTest(
imgSnapshotTest( `
` classDiagram
classDiagram Class01~T~ <|-- AveryLongClass : Cool
Class01~T~ <|-- AveryLongClass : Cool Class03~T~ *-- Class04~T~
Class03~T~ *-- Class04~T~ Class01 : size()
Class01 : size() Class01 : int chimp
Class01 : int chimp Class01 : int gorilla
Class01 : int gorilla Class08 <--> C2: Cool label
Class08 <--> C2: Cool label class Class10~T~ {
class Class10~T~ { &lt;&lt;service&gt;&gt;
&lt;&lt;service&gt;&gt; int id
int id test()
test() }
} `,
`, {}
{} );
); cy.get('svg');
cy.get('svg'); });
});
it('9: should render a simple class diagram with clickable link', () => {
it('9: should render a simple class diagram with clickable link', () => { imgSnapshotTest(
imgSnapshotTest( `
` classDiagram
classDiagram Class01~T~ <|-- AveryLongClass : Cool
Class01~T~ <|-- AveryLongClass : Cool Class03~T~ *-- Class04~T~
Class03~T~ *-- Class04~T~ Class01 : size()
Class01 : size() Class01 : int chimp
Class01 : int chimp Class01 : int gorilla
Class01 : int gorilla Class08 <--> C2: Cool label
Class08 <--> C2: Cool label class Class10~T~ {
class Class10~T~ { &lt;&lt;service&gt;&gt;
&lt;&lt;service&gt;&gt; int id
int id test()
test() }
} link Class01 "google.com" "A Tooltip"
link Class01 "google.com" "A Tooltip" `,
`, {}
{} );
); cy.get('svg');
cy.get('svg'); });
});
it('10: should render a simple class diagram with clickable callback', () => {
it('10: should render a simple class diagram with clickable callback', () => { imgSnapshotTest(
imgSnapshotTest( `
` classDiagram
classDiagram Class01~T~ <|-- AveryLongClass : Cool
Class01~T~ <|-- AveryLongClass : Cool Class03~T~ *-- Class04~T~
Class03~T~ *-- Class04~T~ Class01 : size()
Class01 : size() Class01 : int chimp
Class01 : int chimp Class01 : int gorilla
Class01 : int gorilla Class08 <--> C2: Cool label
Class08 <--> C2: Cool label class Class10~T~ {
class Class10~T~ { &lt;&lt;service&gt;&gt;
&lt;&lt;service&gt;&gt; int id
int id test()
test() }
} callback Class01 "functionCall" "A Tooltip"
callback Class01 "functionCall" "A Tooltip" `,
`, {}
{} );
); cy.get('svg');
cy.get('svg'); });
});
it('11: should render a simple class diagram with return type on method', () => {
it('11: should render a simple class diagram with return type on method', () => { imgSnapshotTest(
imgSnapshotTest( `
` classDiagram
classDiagram class Class10~T~ {
class Class10~T~ { int[] id
int[] id test(int[] ids) bool
test(int[] ids) bool testArray() bool[]
testArray() bool[] }
} `,
`, {}
{} );
); cy.get('svg');
cy.get('svg'); });
});
it('12: should render a simple class diagram with generic types', () => {
it('12: should render a simple class diagram with generic types', () => { imgSnapshotTest(
imgSnapshotTest( `
` classDiagram
classDiagram class Class10~T~ {
class Class10~T~ { int[] id
int[] id List~int~ ids
List~int~ ids test(List~int~ ids) List~bool~
test(List~int~ ids) List~bool~ testArray() bool[]
testArray() bool[] }
} `,
`, {}
{} );
); cy.get('svg');
cy.get('svg'); });
});
it('13: should render a simple class diagram with css classes applied', () => {
it('13: should render a simple class diagram with css classes applied', () => { imgSnapshotTest(
imgSnapshotTest( `
` classDiagram
classDiagram class Class10 {
class Class10 { int[] id
int[] id List~int~ ids
List~int~ ids test(List~int~ ids) List~bool~
test(List~int~ ids) List~bool~ testArray() bool[]
testArray() bool[] }
}
class Class10:::exClass2
cssClass "Class10" exClass `,
`, {}
{} );
); cy.get('svg');
cy.get('svg'); });
});
it('14: should render a simple class diagram with css classes applied directly', () => {
it('14: should render a simple class diagram with css classes applied directly', () => { imgSnapshotTest(
imgSnapshotTest( `
` classDiagram
classDiagram class Class10:::exClass2 {
class Class10:::exClass { int[] id
int[] id List~int~ ids
List~int~ ids test(List~int~ ids) List~bool~
test(List~int~ ids) List~bool~ testArray() bool[]
testArray() bool[] }
} `,
`, {}
{} );
); cy.get('svg');
cy.get('svg'); });
});
it('15: should render a simple class diagram with css classes applied two multiple classes', () => {
it('15: should render a simple class diagram with css classes applied two multiple classes', () => { imgSnapshotTest(
imgSnapshotTest( `
` classDiagram
classDiagram class Class10
class Class10 class Class20
class Class20
cssClass "Class10, Class20" exClass2
cssClass "Class10, class20" exClass class Class20:::exClass2
`, `,
{} {}
); );
cy.get('svg'); cy.get('svg');
}); });
it('16: should render multiple class diagrams', () => { it('16: should render multiple class diagrams', () => {
imgSnapshotTest( imgSnapshotTest(
[ [
` `
classDiagram classDiagram
Class01 "1" <|--|> "*" AveryLongClass : Cool Class01 "1" <|--|> "*" AveryLongClass : Cool
&lt;&lt;interface&gt;&gt; Class01 &lt;&lt;interface&gt;&gt; Class01
Class03 "1" *-- "*" Class04 Class03 "1" *-- "*" Class04
Class05 "1" o-- "many" Class06 Class05 "1" o-- "many" Class06
Class07 "1" .. "*" Class08 Class07 "1" .. "*" Class08
Class09 "1" --> "*" C2 : Where am i? Class09 "1" --> "*" C2 : Where am i?
Class09 "*" --* "*" C3 Class09 "*" --* "*" C3
Class09 "1" --|> "1" Class07 Class09 "1" --|> "1" Class07
Class07 : equals() Class07 : equals()
Class07 : Object[] elementData Class07 : Object[] elementData
Class01 : size() Class01 : size()
Class01 : int chimp Class01 : int chimp
Class01 : int gorilla Class01 : int gorilla
Class08 "1" <--> "*" C2: Cool label Class08 "1" <--> "*" C2: Cool label
class Class10 { class Class10 {
&lt;&lt;service&gt;&gt; &lt;&lt;service&gt;&gt;
int id int id
test() test()
} }
`, `,
` `
classDiagram classDiagram
Class01 "1" <|--|> "*" AveryLongClass : Cool Class01 "1" <|--|> "*" AveryLongClass : Cool
&lt;&lt;interface&gt;&gt; Class01 &lt;&lt;interface&gt;&gt; Class01
Class03 "1" *-- "*" Class04 Class03 "1" *-- "*" Class04
Class05 "1" o-- "many" Class06 Class05 "1" o-- "many" Class06
Class07 "1" .. "*" Class08 Class07 "1" .. "*" Class08
Class09 "1" --> "*" C2 : Where am i? Class09 "1" --> "*" C2 : Where am i?
Class09 "*" --* "*" C3 Class09 "*" --* "*" C3
Class09 "1" --|> "1" Class07 Class09 "1" --|> "1" Class07
Class07 : equals() Class07 : equals()
Class07 : Object[] elementData Class07 : Object[] elementData
Class01 : size() Class01 : size()
Class01 : int chimp Class01 : int chimp
Class01 : int gorilla Class01 : int gorilla
Class08 "1" <--> "*" C2: Cool label Class08 "1" <--> "*" C2: Cool label
class Class10 { class Class10 {
&lt;&lt;service&gt;&gt; &lt;&lt;service&gt;&gt;
int id int id
test() test()
} }
`, `,
], ],
{} {}
); );
cy.get('svg'); cy.get('svg');
}); });
it('17: should render a class diagram when useMaxWidth is true (default)', () => { // it('17: should render a class diagram when useMaxWidth is true (default)', () => {
renderGraph( // renderGraph(
` // `
classDiagram // classDiagram
Class01 <|-- AveryLongClass : Cool // Class01 <|-- AveryLongClass : Cool
Class01 : size() // Class01 : size()
Class01 : int chimp // Class01 : int chimp
Class01 : int gorilla // Class01 : int gorilla
Class01 : -int privateChimp // Class01 : -int privateChimp
Class01 : +int publicGorilla // Class01 : +int publicGorilla
Class01 : #int protectedMarmoset // Class01 : #int protectedMarmoset
`, // `,
{ class: { useMaxWidth: true } } // { class: { useMaxWidth: true } }
); // );
cy.get('svg') // cy.get('svg')
.should((svg) => { // .should((svg) => {
expect(svg).to.have.attr('width', '100%'); // expect(svg).to.have.attr('width', '100%');
expect(svg).to.have.attr('height', '218'); // const height = parseFloat(svg.attr('height'));
const style = svg.attr('style'); // expect(height).to.be.within(332, 333);
expect(style).to.match(/^max-width: [\d.]+px;$/); // // expect(svg).to.have.attr('height', '218');
const maxWidthValue = parseInt(style.match(/[\d.]+/g).join('')); // const style = svg.attr('style');
// use within because the absolute value can be slightly different depending on the environment ±5% // expect(style).to.match(/^max-width: [\d.]+px;$/);
expect(maxWidthValue).to.be.within(160 * .95, 160 * 1.05); // const maxWidthValue = parseInt(style.match(/[\d.]+/g).join(''));
}); // // use within because the absolute value can be slightly different depending on the environment ±5%
}); // expect(maxWidthValue).to.be.within(203, 204);
// });
it('18: should render a class diagram when useMaxWidth is false', () => { // });
renderGraph(
` // it('18: should render a class diagram when useMaxWidth is false', () => {
classDiagram // renderGraph(
Class01 <|-- AveryLongClass : Cool // `
Class01 : size() // classDiagram
Class01 : int chimp // Class01 <|-- AveryLongClass : Cool
Class01 : int gorilla // Class01 : size()
Class01 : -int privateChimp // Class01 : int chimp
Class01 : +int publicGorilla // Class01 : int gorilla
Class01 : #int protectedMarmoset // Class01 : -int privateChimp
`, // Class01 : +int publicGorilla
{ class: { useMaxWidth: false } } // Class01 : #int protectedMarmoset
); // `,
cy.get('svg') // { class: { useMaxWidth: false } }
.should((svg) => { // );
const width = parseFloat(svg.attr('width')); // cy.get('svg')
// use within because the absolute value can be slightly different depending on the environment ±5% // .should((svg) => {
expect(width).to.be.within(160 * .95, 160 * 1.05); // const width = parseFloat(svg.attr('width'));
expect(svg).to.have.attr('height', '218'); // // use within because the absolute value can be slightly different depending on the environment ±5%
expect(svg).to.not.have.attr('style'); // expect(width).to.be.within(100, 101);
}); // const height = parseFloat(svg.attr('height'));
}); // expect(height).to.be.within(332, 333);
}); // // expect(svg).to.have.attr('height', '332');
// // expect(svg).to.not.have.attr('style');
// });
// });
});

View File

@@ -1,10 +1,9 @@
/* eslint-env jest */
import { imgSnapshotTest } from '../../helpers/util.js'; import { imgSnapshotTest } from '../../helpers/util.js';
describe('Configuration and directives - nodes should be light blue', () => { describe('Configuration and directives - nodes should be light blue', () => {
it('No config - use default', () => { it('No config - use default', () => {
imgSnapshotTest( imgSnapshotTest(
` `
graph TD graph TD
A(Default) --> B[/Another/] A(Default) --> B[/Another/]
A --> C[End] A --> C[End]
@@ -13,13 +12,13 @@ describe('Configuration and directives - nodes should be light blue', () => {
C C
end end
`, `,
{} {}
); );
cy.get('svg'); cy.get('svg');
}); });
it('Settigns from intitialize - nodes should be green', () => { it('Settigns from intitialize - nodes should be green', () => {
imgSnapshotTest( imgSnapshotTest(
` `
graph TD graph TD
A(Forest) --> B[/Another/] A(Forest) --> B[/Another/]
A --> C[End] A --> C[End]
@@ -27,13 +26,13 @@ graph TD
B B
C C
end `, end `,
{theme:'forest'} { theme: 'forest' }
); );
cy.get('svg'); cy.get('svg');
}); });
it('Settings from initialize overriding themeVariable - nodes shold be red', () => { it('Settings from initialize overriding themeVariable - nodes shold be red', () => {
imgSnapshotTest( imgSnapshotTest(
` `
%%{init: { 'theme': 'base', 'themeVariables':{ 'primaryColor': '#ff0000'}}}%% %%{init: { 'theme': 'base', 'themeVariables':{ 'primaryColor': '#ff0000'}}}%%
@@ -45,13 +44,13 @@ graph TD
C C
end end
`, `,
{theme:'base', themeVariables:{ primaryColor: '#ff0000'}, logLevel: 0} { theme: 'base', themeVariables: { primaryColor: '#ff0000' }, logLevel: 0 }
); );
cy.get('svg'); cy.get('svg');
}); });
it('Settings from directive - nodes should be grey', () => { it('Settings from directive - nodes should be grey', () => {
imgSnapshotTest( imgSnapshotTest(
` `
%%{init: { 'logLevel': 0, 'theme': 'neutral'} }%% %%{init: { 'logLevel': 0, 'theme': 'neutral'} }%%
graph TD graph TD
A(Start) --> B[/Another/] A(Start) --> B[/Another/]
@@ -61,14 +60,14 @@ graph TD
C C
end end
`, `,
{} {}
); );
cy.get('svg'); cy.get('svg');
}); });
it('Settings from directive overriding theme variable - nodes should be red', () => { it('Settings from directive overriding theme variable - nodes should be red', () => {
imgSnapshotTest( imgSnapshotTest(
` `
%%{init: {'theme': 'base', 'themeVariables':{ 'primaryColor': '#ff0000'}}}%% %%{init: {'theme': 'base', 'themeVariables':{ 'primaryColor': '#ff0000'}}}%%
graph TD graph TD
A(Start) --> B[/Another/] A(Start) --> B[/Another/]
@@ -78,13 +77,13 @@ graph TD
C C
end end
`, `,
{} {}
); );
cy.get('svg'); cy.get('svg');
}); });
it('Settings from initialize and directive - nodes should be grey', () => { it('Settings from initialize and directive - nodes should be grey', () => {
imgSnapshotTest( imgSnapshotTest(
` `
%%{init: { 'logLevel': 0, 'theme': 'neutral'} }%% %%{init: { 'logLevel': 0, 'theme': 'neutral'} }%%
graph TD graph TD
A(Start) --> B[/Another/] A(Start) --> B[/Another/]
@@ -94,13 +93,13 @@ graph TD
C C
end end
`, `,
{theme:'forest'} { theme: 'forest' }
); );
cy.get('svg'); cy.get('svg');
}); });
it('Theme from initialize, directive overriding theme variable - nodes should be red', () => { it('Theme from initialize, directive overriding theme variable - nodes should be red', () => {
imgSnapshotTest( imgSnapshotTest(
` `
%%{init: {'theme': 'base', 'themeVariables':{ 'primaryColor': '#ff0000'}}}%% %%{init: {'theme': 'base', 'themeVariables':{ 'primaryColor': '#ff0000'}}}%%
graph TD graph TD
A(Start) --> B[/Another/] A(Start) --> B[/Another/]
@@ -110,13 +109,13 @@ graph TD
C C
end end
`, `,
{theme:'base'} { theme: 'base' }
); );
cy.get('svg'); cy.get('svg');
}); });
it('Theme variable from initialize, theme from directive - nodes should be red', () => { it('Theme variable from initialize, theme from directive - nodes should be red', () => {
imgSnapshotTest( imgSnapshotTest(
` `
%%{init: { 'logLevel': 0, 'theme': 'base'} }%% %%{init: { 'logLevel': 0, 'theme': 'base'} }%%
graph TD graph TD
A(Start) --> B[/Another/] A(Start) --> B[/Another/]
@@ -126,16 +125,16 @@ graph TD
C C
end end
`, `,
{themeVariables:{primaryColor: '#ff0000'}} { 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.get('svg');
}); cy.percySnapshot();
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();
});
}); });
}); });
});

View File

@@ -1,4 +1,3 @@
/* eslint-env jest */
import { imgSnapshotTest } from '../../helpers/util'; import { imgSnapshotTest } from '../../helpers/util';
describe('State diagram', () => { describe('State diagram', () => {

View File

@@ -1,14 +1,12 @@
/* eslint-env jest */
import { imgSnapshotTest } from '../../helpers/util'; import { imgSnapshotTest } from '../../helpers/util';
describe('Flowchart', () => { describe('Flowchart', () => {
it('34: testing the label width in percy', () => { it('34: testing the label width in percy', () => {
imgSnapshotTest( imgSnapshotTest(
`graph TD `graph TD
A[Christmas] A[Christmas]
`, `,
{ theme: 'forest' , fontFamily: '"Noto Sans SC", sans-serif' } { theme: 'forest', fontFamily: '"Noto Sans SC", sans-serif' }
); );
}); });
}); });

View File

@@ -1,4 +1,3 @@
/* eslint-env jest */
import { imgSnapshotTest, renderGraph } from '../../helpers/util'; import { imgSnapshotTest, renderGraph } from '../../helpers/util';
describe('Entity Relationship Diagram', () => { describe('Entity Relationship Diagram', () => {
@@ -9,7 +8,7 @@ describe('Entity Relationship Diagram', () => {
CUSTOMER ||--o{ ORDER : places CUSTOMER ||--o{ ORDER : places
ORDER ||--|{ LINE-ITEM : contains ORDER ||--|{ LINE-ITEM : contains
`, `,
{logLevel : 1} { logLevel: 1 }
); );
cy.get('svg'); cy.get('svg');
}); });
@@ -22,7 +21,7 @@ describe('Entity Relationship Diagram', () => {
CUSTOMER ||--o{ ORDER : places CUSTOMER ||--o{ ORDER : places
ORDER ||--|{ LINE-ITEM : contains ORDER ||--|{ LINE-ITEM : contains
`, `,
{logLevel : 1} { logLevel: 1 }
); );
cy.get('svg'); cy.get('svg');
}); });
@@ -34,7 +33,7 @@ describe('Entity Relationship Diagram', () => {
CUSTOMER ||--|{ ADDRESS : "invoiced at" CUSTOMER ||--|{ ADDRESS : "invoiced at"
CUSTOMER ||--|{ ADDRESS : "receives goods at" CUSTOMER ||--|{ ADDRESS : "receives goods at"
`, `,
{logLevel : 1} { logLevel: 1 }
); );
cy.get('svg'); cy.get('svg');
}); });
@@ -47,7 +46,7 @@ describe('Entity Relationship Diagram', () => {
B ||--|{ C : likes B ||--|{ C : likes
C ||--|{ A : likes C ||--|{ A : likes
`, `,
{logLevel : 1} { logLevel: 1 }
); );
cy.get('svg'); cy.get('svg');
}); });
@@ -65,7 +64,7 @@ describe('Entity Relationship Diagram', () => {
PRODUCT-CATEGORY ||--|{ PRODUCT : contains PRODUCT-CATEGORY ||--|{ PRODUCT : contains
PRODUCT ||--o{ ORDER-ITEM : "ordered in" PRODUCT ||--o{ ORDER-ITEM : "ordered in"
`, `,
{logLevel : 1} { logLevel: 1 }
); );
cy.get('svg'); cy.get('svg');
}); });
@@ -73,18 +72,18 @@ describe('Entity Relationship Diagram', () => {
it('should render multiple ER diagrams', () => { it('should render multiple ER diagrams', () => {
imgSnapshotTest( imgSnapshotTest(
[ [
` `
erDiagram erDiagram
CUSTOMER ||--o{ ORDER : places CUSTOMER ||--o{ ORDER : places
ORDER ||--|{ LINE-ITEM : contains ORDER ||--|{ LINE-ITEM : contains
`, `,
` `
erDiagram erDiagram
CUSTOMER ||--o{ ORDER : places CUSTOMER ||--o{ ORDER : places
ORDER ||--|{ LINE-ITEM : contains ORDER ||--|{ LINE-ITEM : contains
` `,
], ],
{logLevel : 1} { logLevel: 1 }
); );
cy.get('svg'); cy.get('svg');
}); });
@@ -97,7 +96,7 @@ describe('Entity Relationship Diagram', () => {
BOOK }|..|{ GENRE : " " BOOK }|..|{ GENRE : " "
AUTHOR }|..|{ GENRE : " " AUTHOR }|..|{ GENRE : " "
`, `,
{logLevel : 1} { logLevel: 1 }
); );
cy.get('svg'); cy.get('svg');
}); });
@@ -111,16 +110,15 @@ describe('Entity Relationship Diagram', () => {
`, `,
{ er: { useMaxWidth: true } } { er: { useMaxWidth: true } }
); );
cy.get('svg') cy.get('svg').should((svg) => {
.should((svg) => { expect(svg).to.have.attr('width', '100%');
expect(svg).to.have.attr('width', '100%'); expect(svg).to.have.attr('height', '465');
expect(svg).to.have.attr('height', '465'); const style = svg.attr('style');
const style = svg.attr('style'); expect(style).to.match(/^max-width: [\d.]+px;$/);
expect(style).to.match(/^max-width: [\d.]+px;$/); const maxWidthValue = parseFloat(style.match(/[\d.]+/g).join(''));
const maxWidthValue = parseFloat(style.match(/[\d.]+/g).join('')); // use within because the absolute value can be slightly different depending on the environment ±5%
// use within because the absolute value can be slightly different depending on the environment ±5% expect(maxWidthValue).to.be.within(140 * 0.95, 140 * 1.05);
expect(maxWidthValue).to.be.within(140 * .95, 140 * 1.05); });
});
}); });
it('should render an ER when useMaxWidth is false', () => { it('should render an ER when useMaxWidth is false', () => {
@@ -132,14 +130,13 @@ describe('Entity Relationship Diagram', () => {
`, `,
{ er: { useMaxWidth: false } } { er: { useMaxWidth: false } }
); );
cy.get('svg') cy.get('svg').should((svg) => {
.should((svg) => { const width = parseFloat(svg.attr('width'));
const width = parseFloat(svg.attr('width')); // use within because the absolute value can be slightly different depending on the environment ±5%
// use within because the absolute value can be slightly different depending on the environment ±5% expect(width).to.be.within(140 * 0.95, 140 * 1.05);
expect(width).to.be.within(140 * .95, 140 * 1.05); expect(svg).to.have.attr('height', '465');
expect(svg).to.have.attr('height', '465'); expect(svg).to.not.have.attr('style');
expect(svg).to.not.have.attr('style'); });
});
}); });
it('should render entities that have no relationships', () => { it('should render entities that have no relationships', () => {
@@ -165,7 +162,7 @@ describe('Entity Relationship Diagram', () => {
AUTHOR }|..|{ BOOK : writes AUTHOR }|..|{ BOOK : writes
BOOK { float price } BOOK { float price }
`, `,
{ logLevel : 1 } { logLevel: 1 }
); );
cy.get('svg'); cy.get('svg');
}); });
@@ -181,9 +178,19 @@ describe('Entity Relationship Diagram', () => {
PRIVATE_FINANCIAL_INSTITUTION ||..|{ EMPLOYEE : employs PRIVATE_FINANCIAL_INSTITUTION ||..|{ EMPLOYEE : employs
EMPLOYEE { bool officer_of_firm } EMPLOYEE { bool officer_of_firm }
`, `,
{ logLevel : 1 } { logLevel: 1 }
); );
cy.get('svg'); cy.get('svg');
}); });
it('should render entities with keys and comments', () => {
renderGraph(
`
erDiagram
BOOK { string title PK "comment"}
`,
{ logLevel: 1 }
);
cy.get('svg');
});
}); });

View File

@@ -1,4 +1,3 @@
/* eslint-env jest */
import { imgSnapshotTest, renderGraph } from '../../helpers/util'; import { imgSnapshotTest, renderGraph } from '../../helpers/util';
describe('Flowchart v2', () => { describe('Flowchart v2', () => {
@@ -29,7 +28,7 @@ describe('Flowchart v2', () => {
); );
}); });
it('3: a link with correct arrowhead to a subgraph', () => { it('3: a link with correct arrowhead to a subgraph', () => {
imgSnapshotTest( imgSnapshotTest(
`flowchart TD `flowchart TD
P1 P1
@@ -69,7 +68,7 @@ describe('Flowchart v2', () => {
`flowchart TD `flowchart TD
a["<strong>Haiya</strong>"]---->b a["<strong>Haiya</strong>"]---->b
`, `,
{htmlLabels: false, flowchart: {htmlLabels: false}} { htmlLabels: false, flowchart: { htmlLabels: false } }
); );
}); });
it('6: should render non-escaped with html labels', () => { it('6: should render non-escaped with html labels', () => {
@@ -77,7 +76,7 @@ describe('Flowchart v2', () => {
`flowchart TD `flowchart TD
a["<strong>Haiya</strong>"]===>b a["<strong>Haiya</strong>"]===>b
`, `,
{htmlLabels: true, flowchart: {htmlLabels: true}, securityLevel: 'loose'} { htmlLabels: true, flowchart: { htmlLabels: true }, securityLevel: 'loose' }
); );
}); });
it('7: should render a flowchart when useMaxWidth is true (default)', () => { it('7: should render a flowchart when useMaxWidth is true (default)', () => {
@@ -91,18 +90,17 @@ describe('Flowchart v2', () => {
`, `,
{ flowchart: { useMaxWidth: true } } { flowchart: { useMaxWidth: true } }
); );
cy.get('svg') cy.get('svg').should((svg) => {
.should((svg) => { expect(svg).to.have.attr('width', '100%');
expect(svg).to.have.attr('width', '100%'); expect(svg).to.have.attr('height');
expect(svg).to.have.attr('height'); // use within because the absolute value can be slightly different depending on the environment ±5%
// use within because the absolute value can be slightly different depending on the environment ±5% const height = parseFloat(svg.attr('height'));
const height = parseFloat(svg.attr('height')); expect(height).to.be.within(446 * 0.95, 446 * 1.05);
expect(height).to.be.within(446 * .95, 446 * 1.05); const style = svg.attr('style');
const style = svg.attr('style'); expect(style).to.match(/^max-width: [\d.]+px;$/);
expect(style).to.match(/^max-width: [\d.]+px;$/); const maxWidthValue = parseFloat(style.match(/[\d.]+/g).join(''));
const maxWidthValue = parseFloat(style.match(/[\d.]+/g).join('')); expect(maxWidthValue).to.be.within(290 * 0.95 - 1, 290 * 1.05);
expect(maxWidthValue).to.be.within(300 * .95-1, 300 * 1.05); });
});
}); });
it('8: should render a flowchart when useMaxWidth is false', () => { it('8: should render a flowchart when useMaxWidth is false', () => {
renderGraph( renderGraph(
@@ -115,15 +113,14 @@ describe('Flowchart v2', () => {
`, `,
{ flowchart: { useMaxWidth: false } } { flowchart: { useMaxWidth: false } }
); );
cy.get('svg') cy.get('svg').should((svg) => {
.should((svg) => { const height = parseFloat(svg.attr('height'));
const height = parseFloat(svg.attr('height')); const width = parseFloat(svg.attr('width'));
const width = parseFloat(svg.attr('width')); // use within because the absolute value can be slightly different depending on the environment ±5%
// use within because the absolute value can be slightly different depending on the environment ±5% expect(height).to.be.within(446 * 0.95, 446 * 1.05);
expect(height).to.be.within(446 * .95, 446 * 1.05); expect(width).to.be.within(290 * 0.95 - 1, 290 * 1.05);
expect(width).to.be.within(300 * .95-1, 300 * 1.05); expect(svg).to.not.have.attr('style');
expect(svg).to.not.have.attr('style'); });
});
}); });
it('V2 - 16: Render Stadium shape', () => { it('V2 - 16: Render Stadium shape', () => {
@@ -141,7 +138,7 @@ describe('Flowchart v2', () => {
class A someclass; class A someclass;
class C someclass; class C someclass;
`, `,
{ flowchart: { htmlLabels: false } , fontFamily: 'courier'} { flowchart: { htmlLabels: false }, fontFamily: 'courier' }
); );
}); });
@@ -156,7 +153,7 @@ describe('Flowchart v2', () => {
b b
end end
`, `,
{htmlLabels: true, flowchart: {htmlLabels: true}, securityLevel: 'loose'} { htmlLabels: true, flowchart: { htmlLabels: true }, securityLevel: 'loose' }
); );
}); });
@@ -171,7 +168,7 @@ describe('Flowchart v2', () => {
b b
end end
`, `,
{htmlLabels: true, flowchart: {htmlLabels: true}, securityLevel: 'loose'} { htmlLabels: true, flowchart: { htmlLabels: true }, securityLevel: 'loose' }
); );
}); });
@@ -192,7 +189,7 @@ describe('Flowchart v2', () => {
B B
end end
`, `,
{htmlLabels: true, flowchart: {htmlLabels: true}, securityLevel: 'loose'} { htmlLabels: true, flowchart: { htmlLabels: true }, securityLevel: 'loose' }
); );
}); });
@@ -222,7 +219,7 @@ describe('Flowchart v2', () => {
routeur --> subnet1 & subnet2 routeur --> subnet1 & subnet2
subnet1 & subnet2 --> nat --> internet subnet1 & subnet2 --> nat --> internet
`, `,
{htmlLabels: true, flowchart: {htmlLabels: true}, securityLevel: 'loose'} { htmlLabels: true, flowchart: { htmlLabels: true }, securityLevel: 'loose' }
); );
}); });
@@ -236,7 +233,7 @@ describe('Flowchart v2', () => {
subcontainer-child--> subcontainer-sibling subcontainer-child--> subcontainer-sibling
end end
`, `,
{htmlLabels: true, flowchart: {htmlLabels: true}, securityLevel: 'loose'} { htmlLabels: true, flowchart: { htmlLabels: true }, securityLevel: 'loose' }
); );
}); });
@@ -258,11 +255,10 @@ end
sub_one --> sub_two sub_one --> sub_two
_one --> b _one --> b
`, `,
{htmlLabels: true, flowchart: {htmlLabels: true}, securityLevel: 'loose'} { htmlLabels: true, flowchart: { htmlLabels: true }, securityLevel: 'loose' }
); );
}); });
it('56: handle nested subgraphs with outgoing links 3', () => { it('56: handle nested subgraphs with outgoing links 3', () => {
imgSnapshotTest( imgSnapshotTest(
`flowchart TB `flowchart TB
@@ -275,7 +271,7 @@ _one --> b
end end
process_B-->|via_AWSBatch|container_Beta process_B-->|via_AWSBatch|container_Beta
`, `,
{htmlLabels: true, flowchart: {htmlLabels: true}, securityLevel: 'loose'} { htmlLabels: true, flowchart: { htmlLabels: true }, securityLevel: 'loose' }
); );
}); });
it('57: handle nested subgraphs with outgoing links 4', () => { it('57: handle nested subgraphs with outgoing links 4', () => {
@@ -288,11 +284,10 @@ subgraph B
b b
end end
`, `,
{htmlLabels: true, flowchart: {htmlLabels: true}, securityLevel: 'loose'} { htmlLabels: true, flowchart: { htmlLabels: true }, securityLevel: 'loose' }
); );
}); });
it('57: handle nested subgraphs with outgoing links 2', () => { it('57: handle nested subgraphs with outgoing links 2', () => {
imgSnapshotTest( imgSnapshotTest(
`flowchart TB `flowchart TB
@@ -310,7 +305,7 @@ end
three --> two three --> two
two --> c2 two --> c2
`, `,
{htmlLabels: true, flowchart: {htmlLabels: true}, securityLevel: 'loose'} { htmlLabels: true, flowchart: { htmlLabels: true }, securityLevel: 'loose' }
); );
}); });
it('57.x: handle nested subgraphs with outgoing links 5', () => { it('57.x: handle nested subgraphs with outgoing links 5', () => {
@@ -326,7 +321,7 @@ flowchart TB
process_A-->|messages|process_C process_A-->|messages|process_C
end end
`, `,
{htmlLabels: true, flowchart: {htmlLabels: true}, securityLevel: 'loose'} { htmlLabels: true, flowchart: { htmlLabels: true }, securityLevel: 'loose' }
); );
}); });
it('58: handle styling with style expressions', () => { it('58: handle styling with style expressions', () => {
@@ -337,7 +332,7 @@ flowchart TB
style id1 fill:#f9f,stroke:#333,stroke-width:4px style id1 fill:#f9f,stroke:#333,stroke-width:4px
style id2 fill:#bbf,stroke:#f66,stroke-width:2px,color:#fff,stroke-dasharray: 5 5 style id2 fill:#bbf,stroke:#f66,stroke-width:2px,color:#fff,stroke-dasharray: 5 5
`, `,
{htmlLabels: true, flowchart: {htmlLabels: true}, securityLevel: 'loose'} { htmlLabels: true, flowchart: { htmlLabels: true }, securityLevel: 'loose' }
); );
}); });
it('59: handle styling of subgraphs and links', () => { it('59: handle styling of subgraphs and links', () => {
@@ -359,7 +354,7 @@ flowchart TD
class T TestSub class T TestSub
linkStyle 0,1 color:orange, stroke: orange; linkStyle 0,1 color:orange, stroke: orange;
`, `,
{htmlLabels: true, flowchart: {htmlLabels: true}, securityLevel: 'loose'} { htmlLabels: true, flowchart: { htmlLabels: true }, securityLevel: 'loose' }
); );
}); });
it('60: handle styling for all node shapes - v2', () => { it('60: handle styling for all node shapes - v2', () => {
@@ -389,7 +384,7 @@ flowchart TD
style M stroke:#ff0000,fill:#ffcccc,color:#ff0000; style M stroke:#ff0000,fill:#ffcccc,color:#ff0000;
style N stroke:#0000ff,fill:#ccccff,color:#0000ff; style N stroke:#0000ff,fill:#ccccff,color:#0000ff;
`, `,
{htmlLabels: true, flowchart: {htmlLabels: true}, securityLevel: 'loose', logLevel:2} { htmlLabels: true, flowchart: { htmlLabels: true }, securityLevel: 'loose', logLevel: 2 }
); );
}); });
it('61: fontawesome icons in edge labels', () => { it('61: fontawesome icons in edge labels', () => {
@@ -398,7 +393,7 @@ flowchart TD
flowchart TD flowchart TD
C -->|fa:fa-car Car| F[fa:fa-car Car] C -->|fa:fa-car Car| F[fa:fa-car Car]
`, `,
{htmlLabels: true, flowchart: {htmlLabels: true}, securityLevel: 'loose'} { htmlLabels: true, flowchart: { htmlLabels: true }, securityLevel: 'loose' }
); );
}); });
it('62: should render styled subgraphs', () => { it('62: should render styled subgraphs', () => {
@@ -432,7 +427,7 @@ flowchart TD
style foo fill:#F99,stroke-width:2px,stroke:#F0F,color:darkred style foo fill:#F99,stroke-width:2px,stroke:#F0F,color:darkred
style bar fill:#999,stroke-width:10px,stroke:#0F0,color:blue style bar fill:#999,stroke-width:10px,stroke:#0F0,color:blue
`, `,
{htmlLabels: true, flowchart: {htmlLabels: true}, securityLevel: 'loose'} { htmlLabels: true, flowchart: { htmlLabels: true }, securityLevel: 'loose' }
); );
}); });
it('63: title on subgraphs should be themable', () => { it('63: title on subgraphs should be themable', () => {
@@ -448,7 +443,7 @@ flowchart TD
end end
A --> B A --> B
`, `,
{htmlLabels: true, flowchart: {htmlLabels: true}, securityLevel: 'loose'} { htmlLabels: true, flowchart: { htmlLabels: true }, securityLevel: 'loose' }
); );
}); });
it('65: text-color from classes', () => { it('65: text-color from classes', () => {
@@ -459,7 +454,7 @@ flowchart TD
Lorem --> Ipsum --> Dolor Lorem --> Ipsum --> Dolor
class Lorem,Dolor dark class Lorem,Dolor dark
`, `,
{htmlLabels: true, flowchart: {htmlLabels: true}, securityLevel: 'loose'} { htmlLabels: true, flowchart: { htmlLabels: true }, securityLevel: 'loose' }
); );
}); });
it('66: More nested subgraph cases (TB)', () => { it('66: More nested subgraph cases (TB)', () => {
@@ -477,7 +472,7 @@ flowchart TB
two --> c2 two --> c2
`, `,
{htmlLabels: true, flowchart: {htmlLabels: true}, securityLevel: 'loose'} { htmlLabels: true, flowchart: { htmlLabels: true }, securityLevel: 'loose' }
); );
}); });
it('67: More nested subgraph cases (RL)', () => { it('67: More nested subgraph cases (RL)', () => {
@@ -495,7 +490,7 @@ flowchart RL
two --> c2 two --> c2
`, `,
{htmlLabels: true, flowchart: {htmlLabels: true}, securityLevel: 'loose'} { htmlLabels: true, flowchart: { htmlLabels: true }, securityLevel: 'loose' }
); );
}); });
it('68: More nested subgraph cases (BT)', () => { it('68: More nested subgraph cases (BT)', () => {
@@ -513,7 +508,7 @@ flowchart BT
two --> c2 two --> c2
`, `,
{htmlLabels: true, flowchart: {htmlLabels: true}, securityLevel: 'loose'} { htmlLabels: true, flowchart: { htmlLabels: true }, securityLevel: 'loose' }
); );
}); });
it('69: More nested subgraph cases (LR)', () => { it('69: More nested subgraph cases (LR)', () => {
@@ -531,7 +526,7 @@ flowchart LR
two --> c2 two --> c2
`, `,
{htmlLabels: true, flowchart: {htmlLabels: true}, securityLevel: 'loose'} { htmlLabels: true, flowchart: { htmlLabels: true }, securityLevel: 'loose' }
); );
}); });
it('70: Handle nested subgraph cases (TB) link out and link between subgraphs', () => { it('70: Handle nested subgraph cases (TB) link out and link between subgraphs', () => {
@@ -547,7 +542,7 @@ flowchart TB
S1 --> S2 S1 --> S2
sub1 --> sub4 sub1 --> sub4
`, `,
{htmlLabels: true, flowchart: {htmlLabels: true}, securityLevel: 'loose'} { htmlLabels: true, flowchart: { htmlLabels: true }, securityLevel: 'loose' }
); );
}); });
it('71: Handle nested subgraph cases (RL) link out and link between subgraphs', () => { it('71: Handle nested subgraph cases (RL) link out and link between subgraphs', () => {
@@ -563,7 +558,7 @@ flowchart RL
S1 --> S2 S1 --> S2
sub1 --> sub4 sub1 --> sub4
`, `,
{htmlLabels: true, flowchart: {htmlLabels: true}, securityLevel: 'loose'} { htmlLabels: true, flowchart: { htmlLabels: true }, securityLevel: 'loose' }
); );
}); });
it('72: Handle nested subgraph cases (BT) link out and link between subgraphs', () => { it('72: Handle nested subgraph cases (BT) link out and link between subgraphs', () => {
@@ -579,7 +574,7 @@ flowchart BT
S1 --> S2 S1 --> S2
sub1 --> sub4 sub1 --> sub4
`, `,
{htmlLabels: true, flowchart: {htmlLabels: true}, securityLevel: 'loose'} { htmlLabels: true, flowchart: { htmlLabels: true }, securityLevel: 'loose' }
); );
}); });
it('74: Handle nested subgraph cases (RL) link out and link between subgraphs', () => { it('74: Handle nested subgraph cases (RL) link out and link between subgraphs', () => {
@@ -595,10 +590,10 @@ flowchart RL
S1 --> S2 S1 --> S2
sub1 --> sub4 sub1 --> sub4
`, `,
{htmlLabels: true, flowchart: {htmlLabels: true}, securityLevel: 'loose'} { htmlLabels: true, flowchart: { htmlLabels: true }, securityLevel: 'loose' }
); );
}); });
it('74: Handle labels for multiple edges from and to the same couple of nodes', () => { it('74: Handle labels for multiple edges from and to the same couple of nodes', () => {
imgSnapshotTest( imgSnapshotTest(
` `
flowchart RL flowchart RL
@@ -607,11 +602,21 @@ flowchart RL
a1 -- l2 --> a2 a1 -- l2 --> a2
end end
`, `,
{htmlLabels: true, flowchart: {htmlLabels: true}, securityLevel: 'loose'} { htmlLabels: true, flowchart: { htmlLabels: true }, securityLevel: 'loose' }
); );
}); });
it('2050: handling of different rendering direction in subgraphs', () => { it('76: handle unicode encoded character with HTML labels true', () => {
imgSnapshotTest(
`flowchart TB
a{{"Lorem 'ipsum' dolor 'sit' amet, 'consectetur' adipiscing 'elit'."}}
--> b{{"Lorem #quot;ipsum#quot; dolor #quot;sit#quot; amet,#quot;consectetur#quot; adipiscing #quot;elit#quot;."}}
`,
{ htmlLabels: true, flowchart: { htmlLabels: true }, securityLevel: 'loose' }
);
});
it('2050: handling of different rendering direction in subgraphs', () => {
imgSnapshotTest( imgSnapshotTest(
` `
flowchart LR flowchart LR
@@ -630,7 +635,7 @@ flowchart RL
A --> TOP --> B A --> TOP --> B
B1 --> B2 B1 --> B2
`, `,
{htmlLabels: true, flowchart: {htmlLabels: true}, securityLevel: 'loose'} { htmlLabels: true, flowchart: { htmlLabels: true }, securityLevel: 'loose' }
); );
}); });
}); });

View File

@@ -1,4 +1,3 @@
/* eslint-env jest */
import { imgSnapshotTest, renderGraph } from '../../helpers/util'; import { imgSnapshotTest, renderGraph } from '../../helpers/util';
describe('Graph', () => { describe('Graph', () => {
@@ -38,7 +37,7 @@ describe('Graph', () => {
C -->|Two| E[iPhone] C -->|Two| E[iPhone]
C -->|Three| F[Car] C -->|Three| F[Car]
`, `,
{fontFamily: 'courier'} { fontFamily: 'courier' }
); );
}); });
@@ -53,7 +52,7 @@ describe('Graph', () => {
C -->|Two| E[\\iPhone\\] C -->|Two| E[\\iPhone\\]
C -->|Three| F[Car] C -->|Three| F[Car]
`, `,
{ fontFamily: 'courier'} { fontFamily: 'courier' }
); );
}); });
@@ -69,7 +68,7 @@ describe('Graph', () => {
classDef processHead fill:#888888,color:white,font-weight:bold,stroke-width:3px,stroke:#001f3f classDef processHead fill:#888888,color:white,font-weight:bold,stroke-width:3px,stroke:#001f3f
class 1A,1B,D,E processHead class 1A,1B,D,E processHead
`, `,
{fontFamily: 'courier'} { fontFamily: 'courier' }
); );
}); });
@@ -98,7 +97,7 @@ describe('Graph', () => {
35(SAM.CommonFA.PopulationFME)-->39(SAM.CommonFA.ChargeDetails) 35(SAM.CommonFA.PopulationFME)-->39(SAM.CommonFA.ChargeDetails)
36(SAM.CommonFA.PremetricCost)-->39(SAM.CommonFA.ChargeDetails) 36(SAM.CommonFA.PremetricCost)-->39(SAM.CommonFA.ChargeDetails)
`, `,
{ fontFamily: 'courier' } { fontFamily: 'courier' }
); );
}); });
@@ -169,7 +168,7 @@ describe('Graph', () => {
9a072290_1ec3_e711_8c5a_005056ad0002-->d6072290_1ec3_e711_8c5a_005056ad0002 9a072290_1ec3_e711_8c5a_005056ad0002-->d6072290_1ec3_e711_8c5a_005056ad0002
9a072290_1ec3_e711_8c5a_005056ad0002-->71082290_1ec3_e711_8c5a_005056ad0002 9a072290_1ec3_e711_8c5a_005056ad0002-->71082290_1ec3_e711_8c5a_005056ad0002
`, `,
{ fontFamily: 'courier' } { fontFamily: 'courier' }
); );
}); });
@@ -178,7 +177,7 @@ describe('Graph', () => {
` `
graph TB;subgraph "number as labels";1;end; graph TB;subgraph "number as labels";1;end;
`, `,
{ fontFamily: 'courier' } { fontFamily: 'courier' }
); );
}); });
@@ -190,7 +189,7 @@ describe('Graph', () => {
a1-->a2 a1-->a2
end end
`, `,
{ fontFamily: 'courier' } { fontFamily: 'courier' }
); );
}); });
@@ -202,7 +201,7 @@ describe('Graph', () => {
a1-->a2 a1-->a2
end end
`, `,
{ fontFamily: 'courier' } { fontFamily: 'courier' }
); );
}); });
@@ -237,7 +236,7 @@ describe('Graph', () => {
style foo fill:#F99,stroke-width:2px,stroke:#F0F,color:darkred style foo fill:#F99,stroke-width:2px,stroke:#F0F,color:darkred
style bar fill:#999,stroke-width:10px,stroke:#0F0,color:blue style bar fill:#999,stroke-width:10px,stroke:#0F0,color:blue
`, `,
{ fontFamily: 'courier' } { fontFamily: 'courier' }
); );
}); });
@@ -339,7 +338,7 @@ describe('Graph', () => {
sid-7CE72B24-E0C1-46D3-8132-8BA66BE05AA7-->sid-4DA958A0-26D9-4D47-93A7-70F39FD7D51A; sid-7CE72B24-E0C1-46D3-8132-8BA66BE05AA7-->sid-4DA958A0-26D9-4D47-93A7-70F39FD7D51A;
sid-7CE72B24-E0C1-46D3-8132-8BA66BE05AA7-->sid-4FC27B48-A6F9-460A-A675-021F5854FE22; sid-7CE72B24-E0C1-46D3-8132-8BA66BE05AA7-->sid-4FC27B48-A6F9-460A-A675-021F5854FE22;
`, `,
{ fontFamily: 'courier' } { fontFamily: 'courier' }
); );
}); });
@@ -357,7 +356,7 @@ describe('Graph', () => {
listUrl: false, listUrl: false,
listId: 'color styling', listId: 'color styling',
fontFamily: 'courier', fontFamily: 'courier',
logLevel: 0 logLevel: 0,
} }
); );
}); });
@@ -379,8 +378,9 @@ describe('Graph', () => {
`, `,
{ {
listUrl: false, listUrl: false,
listId: 'color styling', fontFamily: 'courier', listId: 'color styling',
logLevel: 0 fontFamily: 'courier',
logLevel: 0,
} }
); );
}); });
@@ -395,7 +395,7 @@ describe('Graph', () => {
C -->|Two| E[iPhone] C -->|Two| E[iPhone]
C -->|Three| F[fa:fa-car Car] C -->|Three| F[fa:fa-car Car]
`, `,
{ flowchart: { htmlLabels: false } , fontFamily: 'courier'} { flowchart: { htmlLabels: false }, fontFamily: 'courier' }
); );
}); });
@@ -414,7 +414,7 @@ describe('Graph', () => {
class A someclass; class A someclass;
class C someclass; class C someclass;
`, `,
{ flowchart: { htmlLabels: false } , fontFamily: 'courier'} { flowchart: { htmlLabels: false }, fontFamily: 'courier' }
); );
}); });
@@ -431,7 +431,7 @@ describe('Graph', () => {
linkStyle 1 stroke:DarkGray,stroke-width:2px linkStyle 1 stroke:DarkGray,stroke-width:2px
linkStyle 2 stroke:DarkGray,stroke-width:2px linkStyle 2 stroke:DarkGray,stroke-width:2px
`, `,
{ flowchart: { htmlLabels: false } , fontFamily: 'courier'} { flowchart: { htmlLabels: false }, fontFamily: 'courier' }
); );
}); });
@@ -440,7 +440,7 @@ describe('Graph', () => {
`graph LR `graph LR
a --> b --> c a --> b --> c
`, `,
{ flowchart: { htmlLabels: false } , fontFamily: 'courier'} { flowchart: { htmlLabels: false }, fontFamily: 'courier' }
); );
}); });
@@ -449,7 +449,7 @@ describe('Graph', () => {
`graph LR `graph LR
a --> b & c--> d a --> b & c--> d
`, `,
{ flowchart: { htmlLabels: false } , fontFamily: 'courier'} { flowchart: { htmlLabels: false }, fontFamily: 'courier' }
); );
}); });
@@ -459,7 +459,7 @@ describe('Graph', () => {
A[ h ] -- hello --> B[" test "]:::exClass & C --> D; A[ h ] -- hello --> B[" test "]:::exClass & C --> D;
classDef exClass background:#bbb,border:1px solid red; classDef exClass background:#bbb,border:1px solid red;
`, `,
{ flowchart: { htmlLabels: false } , fontFamily: 'courier'} { flowchart: { htmlLabels: false }, fontFamily: 'courier' }
); );
}); });
@@ -481,7 +481,7 @@ describe('Graph', () => {
click B testClick "click test" click B testClick "click test"
classDef someclass fill:#f96; classDef someclass fill:#f96;
class A someclass;`, class A someclass;`,
{ flowchart: { htmlLabels: false } , fontFamily: 'courier'} { flowchart: { htmlLabels: false }, fontFamily: 'courier' }
); );
}); });
@@ -522,7 +522,7 @@ describe('Graph', () => {
linkStyle 1 stroke:greenyellow,stroke-width:2px linkStyle 1 stroke:greenyellow,stroke-width:2px
style C fill:greenyellow,stroke:green,stroke-width:4px style C fill:greenyellow,stroke:green,stroke-width:4px
`, `,
{ flowchart: { htmlLabels: false } , fontFamily: 'courier'} { flowchart: { htmlLabels: false }, fontFamily: 'courier' }
); );
}); });
@@ -545,7 +545,7 @@ describe('Graph', () => {
click F "javascript:alert('test')" "script test" click F "javascript:alert('test')" "script test"
`, `,
{ securityLevel: 'loose', fontFamily: 'courier' } { securityLevel: 'loose', fontFamily: 'courier' }
); );
}); });
it('26: Set text color of nodes and links according to styles when html labels are enabled', () => { it('26: Set text color of nodes and links according to styles when html labels are enabled', () => {
@@ -584,7 +584,7 @@ describe('Graph', () => {
click B "index.html#link-clicked" "link test" click B "index.html#link-clicked" "link test"
click D testClick "click test" click D testClick "click test"
`, `,
{ flowchart: { htmlLabels: false } , fontFamily: 'courier'} { flowchart: { htmlLabels: false }, fontFamily: 'courier' }
); );
}); });
@@ -616,7 +616,7 @@ describe('Graph', () => {
class A myClass1 class A myClass1
class D myClass2 class D myClass2
`, `,
{ flowchart: { htmlLabels: false } , fontFamily: 'courier'} { flowchart: { htmlLabels: false }, fontFamily: 'courier' }
); );
}); });
@@ -640,7 +640,7 @@ describe('Graph', () => {
classDef redBg fill:#622; classDef redBg fill:#622;
classDef whiteTxt color: white; classDef whiteTxt color: white;
`, `,
{ flowchart: { htmlLabels: false } , fontFamily: 'courier'} { flowchart: { htmlLabels: false }, fontFamily: 'courier' }
); );
}); });
@@ -652,7 +652,7 @@ describe('Graph', () => {
eat --> sleep eat --> sleep
work --> eat work --> eat
`, `,
{ flowchart: { htmlLabels: false } , fontFamily: 'courier'} { flowchart: { htmlLabels: false }, fontFamily: 'courier' }
); );
}); });
@@ -671,7 +671,7 @@ describe('Graph', () => {
class A someclass; class A someclass;
class C someclass; class C someclass;
`, `,
{ flowchart: { htmlLabels: false } , fontFamily: 'courier'} { flowchart: { htmlLabels: false }, fontFamily: 'courier' }
); );
}); });
@@ -694,7 +694,7 @@ describe('Graph', () => {
`graph TD `graph TD
A[Christmas] A[Christmas]
`, `,
{ } {}
); );
}); });
@@ -712,7 +712,7 @@ describe('Graph', () => {
C -----> E4 C -----> E4
C ======> E5 C ======> E5
`, `,
{ } {}
); );
}); });
it('36: should render escaped without html labels', () => { it('36: should render escaped without html labels', () => {
@@ -720,7 +720,7 @@ describe('Graph', () => {
`graph TD `graph TD
a["<strong>Haiya</strong>"]-->b a["<strong>Haiya</strong>"]-->b
`, `,
{htmlLabels: false, flowchart: {htmlLabels: false}} { htmlLabels: false, flowchart: { htmlLabels: false } }
); );
}); });
it('37: should render non-escaped with html labels', () => { it('37: should render non-escaped with html labels', () => {
@@ -728,7 +728,7 @@ describe('Graph', () => {
`graph TD `graph TD
a["<strong>Haiya</strong>"]-->b a["<strong>Haiya</strong>"]-->b
`, `,
{htmlLabels: true, flowchart: {htmlLabels: true}, securityLevel: 'loose'} { htmlLabels: true, flowchart: { htmlLabels: true }, securityLevel: 'loose' }
); );
}); });
it('38: should render a flowchart when useMaxWidth is true (default)', () => { it('38: should render a flowchart when useMaxWidth is true (default)', () => {
@@ -742,18 +742,17 @@ describe('Graph', () => {
`, `,
{ flowchart: { useMaxWidth: true } } { flowchart: { useMaxWidth: true } }
); );
cy.get('svg') cy.get('svg').should((svg) => {
.should((svg) => { expect(svg).to.have.attr('width', '100%');
expect(svg).to.have.attr('width', '100%'); expect(svg).to.have.attr('height');
expect(svg).to.have.attr('height'); // use within because the absolute value can be slightly different depending on the environment ±5%
// use within because the absolute value can be slightly different depending on the environment ±5% const height = parseFloat(svg.attr('height'));
const height = parseFloat(svg.attr('height')); expect(height).to.be.within(446 * 0.95, 446 * 1.05);
expect(height).to.be.within(446 * .95, 446 * 1.05); const style = svg.attr('style');
const style = svg.attr('style'); expect(style).to.match(/^max-width: [\d.]+px;$/);
expect(style).to.match(/^max-width: [\d.]+px;$/); const maxWidthValue = parseFloat(style.match(/[\d.]+/g).join(''));
const maxWidthValue = parseFloat(style.match(/[\d.]+/g).join('')); expect(maxWidthValue).to.be.within(300 * 0.95, 300 * 1.05);
expect(maxWidthValue).to.be.within(300 * .95, 300 * 1.05); });
});
}); });
it('39: should render a flowchart when useMaxWidth is false', () => { it('39: should render a flowchart when useMaxWidth is false', () => {
renderGraph( renderGraph(
@@ -766,15 +765,14 @@ describe('Graph', () => {
`, `,
{ flowchart: { useMaxWidth: false } } { flowchart: { useMaxWidth: false } }
); );
cy.get('svg') cy.get('svg').should((svg) => {
.should((svg) => { const height = parseFloat(svg.attr('height'));
const height = parseFloat(svg.attr('height')); const width = parseFloat(svg.attr('width'));
const width = parseFloat(svg.attr('width')); // use within because the absolute value can be slightly different depending on the environment ±5%
// use within because the absolute value can be slightly different depending on the environment ±5% expect(height).to.be.within(446 * 0.95, 446 * 1.05);
expect(height).to.be.within(446 * .95, 446 * 1.05); expect(width).to.be.within(300 * 0.95, 300 * 1.05);
expect(width).to.be.within(300 * .95, 300 * 1.05); expect(svg).to.not.have.attr('style');
expect(svg).to.not.have.attr('style'); });
});
}); });
it('58: handle styling with style expressions', () => { it('58: handle styling with style expressions', () => {
imgSnapshotTest( imgSnapshotTest(
@@ -784,7 +782,7 @@ describe('Graph', () => {
style id1 fill:#f9f,stroke:#333,stroke-width:4px style id1 fill:#f9f,stroke:#333,stroke-width:4px
style id2 fill:#bbf,stroke:#f66,stroke-width:2px,color:#fff,stroke-dasharray: 5 5 style id2 fill:#bbf,stroke:#f66,stroke-width:2px,color:#fff,stroke-dasharray: 5 5
`, `,
{htmlLabels: true, flowchart: {htmlLabels: true}, securityLevel: 'loose'} { htmlLabels: true, flowchart: { htmlLabels: true }, securityLevel: 'loose' }
); );
}); });
it('60: handle styling for all node shapes', () => { it('60: handle styling for all node shapes', () => {
@@ -808,7 +806,7 @@ describe('Graph', () => {
style I stroke:#ff0000,fill:#ffcccc,color:#ff0000 style I stroke:#ff0000,fill:#ffcccc,color:#ff0000
style J stroke:#0000ff,fill:#ccccff,color:#0000ff style J stroke:#0000ff,fill:#ccccff,color:#0000ff
`, `,
{htmlLabels: true, flowchart: {htmlLabels: true}, securityLevel: 'loose'} { htmlLabels: true, flowchart: { htmlLabels: true }, securityLevel: 'loose' }
); );
}); });
it('61: fontawesome icons in edge labels', () => { it('61: fontawesome icons in edge labels', () => {
@@ -817,7 +815,7 @@ describe('Graph', () => {
graph TD graph TD
C -->|fa:fa-car Car| F[fa:fa-car Car] C -->|fa:fa-car Car| F[fa:fa-car Car]
`, `,
{htmlLabels: true, flowchart: {htmlLabels: true}, securityLevel: 'loose'} { htmlLabels: true, flowchart: { htmlLabels: true }, securityLevel: 'loose' }
); );
}); });
it('62: fontawesome icons in edge labels', () => { it('62: fontawesome icons in edge labels', () => {
@@ -829,7 +827,7 @@ graph TD
end end
style bar fill:#999,stroke-width:10px,stroke:#0F0,color:blue style bar fill:#999,stroke-width:10px,stroke:#0F0,color:blue
`, `,
{htmlLabels: true, flowchart: {htmlLabels: true}, securityLevel: 'loose'} { htmlLabels: true, flowchart: { htmlLabels: true }, securityLevel: 'loose' }
); );
}); });
it('63: fontawesome icons in edge labels', () => { it('63: fontawesome icons in edge labels', () => {
@@ -863,7 +861,7 @@ graph TD
style foo fill:#F99,stroke-width:2px,stroke:#F0F,color:darkred style foo fill:#F99,stroke-width:2px,stroke:#F0F,color:darkred
style bar fill:#999,stroke-width:10px,stroke:#0F0,color:blue style bar fill:#999,stroke-width:10px,stroke:#0F0,color:blue
`, `,
{htmlLabels: true, flowchart: {htmlLabels: true}, securityLevel: 'loose'} { htmlLabels: true, flowchart: { htmlLabels: true }, securityLevel: 'loose' }
); );
}); });
it('64: fontawesome icons in edge labels', () => { it('64: fontawesome icons in edge labels', () => {
@@ -879,7 +877,7 @@ graph TD
end end
A --> B A --> B
`, `,
{htmlLabels: true, flowchart: {htmlLabels: true}, securityLevel: 'loose'} { htmlLabels: true, flowchart: { htmlLabels: true }, securityLevel: 'loose' }
); );
}); });
it('65: text-color from classes', () => { it('65: text-color from classes', () => {
@@ -890,7 +888,7 @@ graph TD
Lorem --> Ipsum --> Dolor Lorem --> Ipsum --> Dolor
class Lorem,Dolor dark class Lorem,Dolor dark
`, `,
{htmlLabels: true, flowchart: {htmlLabels: true}, securityLevel: 'loose'} { htmlLabels: true, flowchart: { htmlLabels: true }, securityLevel: 'loose' }
); );
}); });
}); });

View File

@@ -1,10 +1,9 @@
/* eslint-env jest */
import { imgSnapshotTest, renderGraph } from '../../helpers/util.js'; import { imgSnapshotTest, renderGraph } from '../../helpers/util.js';
describe('Gantt diagram', () => { describe('Gantt diagram', () => {
beforeEach(()=>{ beforeEach(() => {
cy.clock((new Date('1010-10-10')).getTime()) cy.clock(new Date('1010-10-10').getTime());
}) });
it('should render a gantt chart', () => { it('should render a gantt chart', () => {
imgSnapshotTest( imgSnapshotTest(
` `
@@ -199,18 +198,17 @@ describe('Gantt diagram', () => {
`, `,
{ gantt: { useMaxWidth: true } } { gantt: { useMaxWidth: true } }
); );
cy.get('svg') cy.get('svg').should((svg) => {
.should((svg) => { expect(svg).to.have.attr('width', '100%');
expect(svg).to.have.attr('width', '100%'); expect(svg).to.have.attr('height');
expect(svg).to.have.attr('height'); // use within because the absolute value can be slightly different depending on the environment ±5%
// use within because the absolute value can be slightly different depending on the environment ±5% const height = parseFloat(svg.attr('height'));
const height = parseFloat(svg.attr('height')); expect(height).to.be.within(484 * 0.95, 484 * 1.05);
expect(height).to.be.within(484 * .95, 484 * 1.05); const style = svg.attr('style');
const style = svg.attr('style'); expect(style).to.match(/^max-width: [\d.]+px;$/);
expect(style).to.match(/^max-width: [\d.]+px;$/); const maxWidthValue = parseFloat(style.match(/[\d.]+/g).join(''));
const maxWidthValue = parseFloat(style.match(/[\d.]+/g).join('')); expect(maxWidthValue).to.be.within(984 * 0.95, 984 * 1.05);
expect(maxWidthValue).to.be.within(984 * .95, 984 * 1.05); });
});
}); });
it('should render a gantt diagram when useMaxWidth is false', () => { it('should render a gantt diagram when useMaxWidth is false', () => {
@@ -248,17 +246,16 @@ describe('Gantt diagram', () => {
`, `,
{ gantt: { useMaxWidth: false } } { gantt: { useMaxWidth: false } }
); );
cy.get('svg') cy.get('svg').should((svg) => {
.should((svg) => { const height = parseFloat(svg.attr('height'));
const height = parseFloat(svg.attr('height')); const width = parseFloat(svg.attr('width'));
const width = parseFloat(svg.attr('width')); // use within because the absolute value can be slightly different depending on the environment ±5%
// use within because the absolute value can be slightly different depending on the environment ±5% expect(height).to.be.within(484 * 0.95, 484 * 1.05);
expect(height).to.be.within(484 * .95, 484 * 1.05); expect(width).to.be.within(984 * 0.95, 984 * 1.05);
expect(width).to.be.within(984 * .95, 984 * 1.05); expect(svg).to.not.have.attr('style');
expect(svg).to.not.have.attr('style'); });
});
}); });
it('should render a gantt diagram with data labels at the top when topAxis is true', () => { it('should render a gantt diagram with data labels at the top when topAxis is true', () => {
imgSnapshotTest( imgSnapshotTest(
` `
gantt gantt

View File

@@ -1,4 +1,3 @@
/* eslint-env jest */
import { imgSnapshotTest } from '../../helpers/util.js'; import { imgSnapshotTest } from '../../helpers/util.js';
describe('Sequencediagram', () => { describe('Sequencediagram', () => {

View File

@@ -1,4 +1,3 @@
/* eslint-env jest */
import { imgSnapshotTest } from '../../helpers/util.js'; import { imgSnapshotTest } from '../../helpers/util.js';
describe('Sequencediagram', () => { describe('Sequencediagram', () => {

View File

@@ -1,4 +1,3 @@
/* eslint-env jest */
import { imgSnapshotTest, renderGraph } from '../../helpers/util.js'; import { imgSnapshotTest, renderGraph } from '../../helpers/util.js';
describe('User journey diagram', () => { describe('User journey diagram', () => {
@@ -40,17 +39,16 @@ section Checkout from website
`, `,
{ journey: { useMaxWidth: true } } { journey: { useMaxWidth: true } }
); );
cy.get('svg') cy.get('svg').should((svg) => {
.should((svg) => { expect(svg).to.have.attr('width', '100%');
expect(svg).to.have.attr('width', '100%'); expect(svg).to.have.attr('height');
expect(svg).to.have.attr('height'); const height = parseFloat(svg.attr('height'));
const height = parseFloat(svg.attr('height')); expect(height).to.eq(565);
expect(height).to.eq(565); const style = svg.attr('style');
const style = svg.attr('style'); expect(style).to.match(/^max-width: [\d.]+px;$/);
expect(style).to.match(/^max-width: [\d.]+px;$/); const maxWidthValue = parseFloat(style.match(/[\d.]+/g).join(''));
const maxWidthValue = parseFloat(style.match(/[\d.]+/g).join('')); expect(maxWidthValue).to.eq(700);
expect(maxWidthValue).to.eq(700); });
});
}); });
it('should render a user journey diagram when useMaxWidth is false', () => { it('should render a user journey diagram when useMaxWidth is false', () => {

View File

@@ -1,4 +1,3 @@
/* eslint-env jest */
import { imgSnapshotTest, renderGraph } from '../../helpers/util.js'; import { imgSnapshotTest, renderGraph } from '../../helpers/util.js';
describe('Pie Chart', () => { describe('Pie Chart', () => {
@@ -47,17 +46,16 @@ describe('Pie Chart', () => {
`, `,
{ pie: { useMaxWidth: true } } { pie: { useMaxWidth: true } }
); );
cy.get('svg') cy.get('svg').should((svg) => {
.should((svg) => { expect(svg).to.have.attr('width', '100%');
expect(svg).to.have.attr('width', '100%'); expect(svg).to.have.attr('height');
expect(svg).to.have.attr('height'); const height = parseFloat(svg.attr('height'));
const height = parseFloat(svg.attr('height')); expect(height).to.eq(450);
expect(height).to.eq(450); const style = svg.attr('style');
const style = svg.attr('style'); expect(style).to.match(/^max-width: [\d.]+px;$/);
expect(style).to.match(/^max-width: [\d.]+px;$/); const maxWidthValue = parseFloat(style.match(/[\d.]+/g).join(''));
const maxWidthValue = parseFloat(style.match(/[\d.]+/g).join('')); expect(maxWidthValue).to.eq(984);
expect(maxWidthValue).to.eq(984); });
});
}); });
it('should render a pie diagram when useMaxWidth is false', () => { it('should render a pie diagram when useMaxWidth is false', () => {
renderGraph( renderGraph(
@@ -69,13 +67,12 @@ describe('Pie Chart', () => {
`, `,
{ pie: { useMaxWidth: false } } { pie: { useMaxWidth: false } }
); );
cy.get('svg') cy.get('svg').should((svg) => {
.should((svg) => { const height = parseFloat(svg.attr('height'));
const height = parseFloat(svg.attr('height')); const width = parseFloat(svg.attr('width'));
const width = parseFloat(svg.attr('width')); expect(height).to.eq(450);
expect(height).to.eq(450); expect(width).to.eq(984);
expect(width).to.eq(984); expect(svg).to.not.have.attr('style');
expect(svg).to.not.have.attr('style'); });
});
}); });
}); });

View File

@@ -1,4 +1,3 @@
/* eslint-env jest */
import { imgSnapshotTest, renderGraph } from '../../helpers/util.js'; import { imgSnapshotTest, renderGraph } from '../../helpers/util.js';
describe('Requirement diagram', () => { describe('Requirement diagram', () => {

View File

@@ -29,7 +29,7 @@ context('Sequence diagram', () => {
Alice -->> John: Parallel message 2 Alice -->> John: Parallel message 2
end end
`, `,
{sequence:{actorFontFamily:'courier'}} { sequence: { actorFontFamily: 'courier' } }
); );
}); });
it('should handle different line breaks', () => { it('should handle different line breaks', () => {
@@ -71,7 +71,7 @@ context('Sequence diagram', () => {
`, `,
{} {}
); );
}) });
it('should render loops with a slight margin', () => { it('should render loops with a slight margin', () => {
imgSnapshotTest( imgSnapshotTest(
` `
@@ -147,7 +147,7 @@ context('Sequence diagram', () => {
A->>Bob: Hola A->>Bob: Hola
Bob-->A: Pasten ! Bob-->A: Pasten !
`, `,
{logLevel: 0} { logLevel: 0 }
); );
}); });
it('should wrap (inline) long actor descriptions', () => { it('should wrap (inline) long actor descriptions', () => {
@@ -158,7 +158,7 @@ context('Sequence diagram', () => {
A->>Bob: Hola A->>Bob: Hola
Bob-->A: Pasten ! Bob-->A: Pasten !
`, `,
{logLevel: 0} { logLevel: 0 }
); );
}); });
it('should wrap (directive) long actor descriptions', () => { it('should wrap (directive) long actor descriptions', () => {
@@ -173,6 +173,18 @@ context('Sequence diagram', () => {
{} {}
); );
}); });
it('should be possible to use actor symbols instead of boxes', () => {
imgSnapshotTest(
`
sequenceDiagram
actor Alice
actor Bob
Alice->>Bob: Hi Bob
Bob->>Alice: Hi Alice
`,
{}
);
});
it('should render long notes left of actor', () => { it('should render long notes left of actor', () => {
imgSnapshotTest( imgSnapshotTest(
` `
@@ -515,17 +527,17 @@ context('Sequence diagram', () => {
}); });
it('should render with an init directive', () => { it('should render with an init directive', () => {
imgSnapshotTest( imgSnapshotTest(
`%%{init: { "theme": "dark", 'config': { "fontFamily": "Menlo", "fontSize": 18, "fontWeight": 400, "wrap": true }}}%% `%%{init: { "theme": "dark", 'config': { "fontFamily": "Menlo", "fontSize": 18, "fontWeight": 400, "wrap": true }}}%%
sequenceDiagram sequenceDiagram
Alice->>Bob: Hello Bob, how are you? If you are not available right now, I can leave you a message. Please get back to me as soon as you can! Alice->>Bob: Hello Bob, how are you? If you are not available right now, I can leave you a message. Please get back to me as soon as you can!
Note left of Alice: Bob thinks Note left of Alice: Bob thinks
Bob->>Alice: Fine!`, Bob->>Alice: Fine!`,
{} {}
) );
}); });
}); });
context('directives', () => { context('directives', () => {
it('should override config with directive settings', () => { it('should override config with directive settings', () => {
imgSnapshotTest( imgSnapshotTest(
` `
%%{init: { "config": { "mirrorActors": true }}}%% %%{init: { "config": { "mirrorActors": true }}}%%
@@ -534,10 +546,13 @@ context('Sequence diagram', () => {
note left of Alice: config set to mirrorActors: false<br/>directive set to mirrorActors: true note left of Alice: config set to mirrorActors: false<br/>directive set to mirrorActors: true
Bob->>Alice: Short as well Bob->>Alice: Short as well
`, `,
{ logLevel:0, sequence: { mirrorActors: false, noteFontSize: 18, noteFontFamily: 'Arial' } } {
logLevel: 0,
sequence: { mirrorActors: false, noteFontSize: 18, noteFontFamily: 'Arial' },
}
); );
}); });
it('should override config with directive settings', () => { it('should override config with directive settings', () => {
imgSnapshotTest( imgSnapshotTest(
` `
%%{init: { "config": { "mirrorActors": false, "wrap": true }}}%% %%{init: { "config": { "mirrorActors": false, "wrap": true }}}%%
@@ -546,7 +561,53 @@ context('Sequence diagram', () => {
note left of Alice: config: mirrorActors=true<br/>directive: mirrorActors=false note left of Alice: config: mirrorActors=true<br/>directive: mirrorActors=false
Bob->>Alice: Short as well Bob->>Alice: Short as well
`, `,
{ logLevel:0, sequence: { mirrorActors: true, noteFontSize: 18, noteFontFamily: 'Arial' } } { logLevel: 0, sequence: { mirrorActors: true, noteFontSize: 18, noteFontFamily: 'Arial' } }
);
});
});
context('links', () => {
it('should support actor links and properties EXPERIMENTAL: USE WITH CAUTION', () => {
//Be aware that the syntax for "properties" is likely to be changed.
imgSnapshotTest(
`
%%{init: { "config": { "mirrorActors": true, "forceMenus": true }}}%%
sequenceDiagram
participant a as Alice
participant j as John
note right of a: Hello world!
properties a: {"class": "internal-service-actor", "type": "@clock"}
properties j: {"class": "external-service-actor", "type": "@computer"}
links a: {"Repo": "https://www.contoso.com/repo", "Swagger": "https://www.contoso.com/swagger"}
links j: {"Repo": "https://www.contoso.com/repo"}
links a: {"Dashboard": "https://www.contoso.com/dashboard", "On-Call": "https://www.contoso.com/oncall"}
link a: Contacts @ https://contacts.contoso.com/?contact=alice@contoso.com
a->>j: Hello John, how are you?
j-->>a: Great!
`,
{ logLevel: 0, sequence: { mirrorActors: true, noteFontSize: 18, noteFontFamily: 'Arial' } }
);
});
it('should support actor links and properties when not mirrored EXPERIMENTAL: USE WITH CAUTION', () => {
//Be aware that the syntax for "properties" is likely to be changed.
imgSnapshotTest(
`
%%{init: { "config": { "mirrorActors": false, "forceMenus": true, "wrap": true }}}%%
sequenceDiagram
participant a as Alice
participant j as John
note right of a: Hello world!
properties a: {"class": "internal-service-actor", "type": "@clock"}
properties j: {"class": "external-service-actor", "type": "@computer"}
links a: {"Repo": "https://www.contoso.com/repo", "Swagger": "https://www.contoso.com/swagger"}
links j: {"Repo": "https://www.contoso.com/repo"}
links a: {"Dashboard": "https://www.contoso.com/dashboard", "On-Call": "https://www.contoso.com/oncall"}
a->>j: Hello John, how are you?
j-->>a: Great!
`,
{
logLevel: 0,
sequence: { mirrorActors: false, noteFontSize: 18, noteFontFamily: 'Arial' },
}
); );
}); });
}); });
@@ -579,18 +640,17 @@ context('Sequence diagram', () => {
`, `,
{ sequence: { useMaxWidth: true } } { sequence: { useMaxWidth: true } }
); );
cy.get('svg') cy.get('svg').should((svg) => {
.should((svg) => { expect(svg).to.have.attr('width', '100%');
expect(svg).to.have.attr('width', '100%'); expect(svg).to.have.attr('height');
expect(svg).to.have.attr('height'); const height = parseFloat(svg.attr('height'));
const height = parseFloat(svg.attr('height')); expect(height).to.be.within(920, 960);
expect(height).to.eq(920); const style = svg.attr('style');
const style = svg.attr('style'); expect(style).to.match(/^max-width: [\d.]+px;$/);
expect(style).to.match(/^max-width: [\d.]+px;$/); const maxWidthValue = parseFloat(style.match(/[\d.]+/g).join(''));
const maxWidthValue = parseFloat(style.match(/[\d.]+/g).join('')); // use within because the absolute value can be slightly different depending on the environment ±5%
// use within because the absolute value can be slightly different depending on the environment ±5% expect(maxWidthValue).to.be.within(820 * 0.95, 820 * 1.05);
expect(maxWidthValue).to.be.within(820 * .95, 820 * 1.05); });
});
}); });
it('should render a sequence diagram when useMaxWidth is false', () => { it('should render a sequence diagram when useMaxWidth is false', () => {
renderGraph( renderGraph(
@@ -620,15 +680,14 @@ context('Sequence diagram', () => {
`, `,
{ sequence: { useMaxWidth: false } } { sequence: { useMaxWidth: false } }
); );
cy.get('svg') cy.get('svg').should((svg) => {
.should((svg) => { const height = parseFloat(svg.attr('height'));
const height = parseFloat(svg.attr('height')); const width = parseFloat(svg.attr('width'));
const width = parseFloat(svg.attr('width')); expect(height).to.be.within(920, 960);
expect(height).to.eq(920); // use within because the absolute value can be slightly different depending on the environment ±5%
// use within because the absolute value can be slightly different depending on the environment ±5% expect(width).to.be.within(820 * 0.95, 820 * 1.05);
expect(width).to.be.within(820 * .95, 820 * 1.05); expect(svg).to.not.have.attr('style');
expect(svg).to.not.have.attr('style'); });
});
}); });
}); });
}); });

View File

@@ -1,4 +1,3 @@
/* eslint-env jest */
import { imgSnapshotTest, renderGraph } from '../../helpers/util'; import { imgSnapshotTest, renderGraph } from '../../helpers/util';
describe('State diagram', () => { describe('State diagram', () => {
@@ -351,7 +350,7 @@ describe('State diagram', () => {
imgSnapshotTest( imgSnapshotTest(
` `
stateDiagram-v2 stateDiagram-v2
state "Long state name" as NotShooting { state "Long state name 2" as NotShooting {
a-->b a-->b
} }
`, `,
@@ -360,6 +359,18 @@ stateDiagram-v2
} }
); );
}); });
it('v2 state label with names in it', () => {
imgSnapshotTest(
`
stateDiagram-v2
Yswsii: Your state with spaces in it
[*] --> Yswsii
`,
{
logLevel: 0,
}
);
});
it('v2 Simplest composite state', () => { it('v2 Simplest composite state', () => {
imgSnapshotTest( imgSnapshotTest(
` `
@@ -369,7 +380,8 @@ stateDiagram-v2
} }
`, `,
{ {
logLevel: 0, fontFamily: 'courier' logLevel: 0,
fontFamily: 'courier',
} }
); );
}); });
@@ -381,7 +393,8 @@ stateDiagram-v2
a --> b: Stop a --> b: Stop
`, `,
{ {
logLevel: 0, fontFamily: 'courier', logLevel: 0,
fontFamily: 'courier',
} }
); );
}); });
@@ -394,7 +407,8 @@ stateDiagram-v2
note right of MyState : I am a rightie note right of MyState : I am a rightie
`, `,
{ {
logLevel: 0, fontFamily: 'courier', logLevel: 0,
fontFamily: 'courier',
} }
); );
}); });
@@ -414,7 +428,8 @@ stateDiagram-v2
A --> C A --> C
`, `,
{ {
logLevel: 0, fontFamily: 'courier', logLevel: 0,
fontFamily: 'courier',
} }
); );
}); });
@@ -433,7 +448,8 @@ stateDiagram-v2
sub1 --> sub4 sub1 --> sub4
`, `,
{ {
logLevel: 0, fontFamily: 'courier', logLevel: 0,
fontFamily: 'courier',
} }
); );
}); });
@@ -447,18 +463,17 @@ stateDiagram-v2
`, `,
{ state: { useMaxWidth: true } } { state: { useMaxWidth: true } }
); );
cy.get('svg') cy.get('svg').should((svg) => {
.should((svg) => { expect(svg).to.have.attr('width', '100%');
expect(svg).to.have.attr('width', '100%'); expect(svg).to.have.attr('height');
expect(svg).to.have.attr('height'); const height = parseFloat(svg.attr('height'));
const height = parseFloat(svg.attr('height')); expect(height).to.be.within(177, 178);
expect(height).to.eq(177); const style = svg.attr('style');
const style = svg.attr('style'); expect(style).to.match(/^max-width: [\d.]+px;$/);
expect(style).to.match(/^max-width: [\d.]+px;$/); const maxWidthValue = parseFloat(style.match(/[\d.]+/g).join(''));
const maxWidthValue = parseFloat(style.match(/[\d.]+/g).join('')); // use within because the absolute value can be slightly different depending on the environment ±5%
// use within because the absolute value can be slightly different depending on the environment ±5% expect(maxWidthValue).to.be.within(135 * 0.95, 135 * 1.05);
expect(maxWidthValue).to.be.within(135 * .95, 135 * 1.05); });
});
}); });
it('v2 should render a state diagram when useMaxWidth is false', () => { it('v2 should render a state diagram when useMaxWidth is false', () => {
renderGraph( renderGraph(
@@ -470,14 +485,13 @@ stateDiagram-v2
`, `,
{ state: { useMaxWidth: false } } { state: { useMaxWidth: false } }
); );
cy.get('svg') cy.get('svg').should((svg) => {
.should((svg) => { const height = parseFloat(svg.attr('height'));
const height = parseFloat(svg.attr('height')); const width = parseFloat(svg.attr('width'));
const width = parseFloat(svg.attr('width')); expect(height).to.be.within(177, 178);
expect(height).to.eq(177); // use within because the absolute value can be slightly different depending on the environment ±5%
// use within because the absolute value can be slightly different depending on the environment ±5% expect(width).to.be.within(135 * 0.95, 135 * 1.05);
expect(width).to.be.within(135 * .95, 135 * 1.05); expect(svg).to.not.have.attr('style');
expect(svg).to.not.have.attr('style'); });
});
}); });
}); });

View File

@@ -1,4 +1,3 @@
/* eslint-env jest */
import { imgSnapshotTest, renderGraph } from '../../helpers/util'; import { imgSnapshotTest, renderGraph } from '../../helpers/util';
describe('State diagram', () => { describe('State diagram', () => {
@@ -315,7 +314,8 @@ describe('State diagram', () => {
} }
`, `,
{ {
logLevel: 0, fontFamily: 'courier' logLevel: 0,
fontFamily: 'courier',
} }
); );
}); });
@@ -328,7 +328,8 @@ describe('State diagram', () => {
} }
`, `,
{ {
logLevel: 0, fontFamily: 'courier' logLevel: 0,
fontFamily: 'courier',
} }
); );
}); });
@@ -340,7 +341,8 @@ describe('State diagram', () => {
a --> b: Stop a --> b: Stop
`, `,
{ {
logLevel: 0, fontFamily: 'courier' logLevel: 0,
fontFamily: 'courier',
} }
); );
}); });
@@ -353,20 +355,19 @@ describe('State diagram', () => {
`, `,
{ state: { useMaxWidth: true } } { state: { useMaxWidth: true } }
); );
cy.get('svg') cy.get('svg').should((svg) => {
.should((svg) => { expect(svg).to.have.attr('width', '100%');
expect(svg).to.have.attr('width', '100%'); expect(svg).to.have.attr('height');
expect(svg).to.have.attr('height'); const height = parseFloat(svg.attr('height'));
const height = parseFloat(svg.attr('height')); expect(height).to.be.within(176, 178);
expect(height).to.be.within(176,178); const style = svg.attr('style');
const style = svg.attr('style'); expect(style).to.match(/^max-width: [\d.]+px;$/);
expect(style).to.match(/^max-width: [\d.]+px;$/); const maxWidthValue = parseFloat(style.match(/[\d.]+/g).join(''));
const maxWidthValue = parseFloat(style.match(/[\d.]+/g).join('')); // use within because the absolute value can be slightly different depending on the environment ±5%
// use within because the absolute value can be slightly different depending on the environment ±5% // Todo investigate difference
// Todo investigate difference // expect(maxWidthValue).to.be.within(112 * .95, 112 * 1.05);
// expect(maxWidthValue).to.be.within(112 * .95, 112 * 1.05); expect(maxWidthValue).to.be.within(130, 140);
expect(maxWidthValue).to.be.within(130, 140); });
});
}); });
it('should render a state diagram when useMaxWidth is false', () => { it('should render a state diagram when useMaxWidth is false', () => {
renderGraph( renderGraph(
@@ -377,17 +378,16 @@ describe('State diagram', () => {
`, `,
{ state: { useMaxWidth: false } } { state: { useMaxWidth: false } }
); );
cy.get('svg') cy.get('svg').should((svg) => {
.should((svg) => { const height = parseFloat(svg.attr('height'));
const height = parseFloat(svg.attr('height')); const width = parseFloat(svg.attr('width'));
const width = parseFloat(svg.attr('width')); expect(height).to.be.within(176, 178);
expect(height).to.be.within(176,178); // use within because the absolute value can be slightly different depending on the environment ±5%
// use within because the absolute value can be slightly different depending on the environment ±5% // Todo investigate difference
// Todo investigate difference // expect(width).to.be.within(112 * .95, 112 * 1.05);
// expect(width).to.be.within(112 * .95, 112 * 1.05); expect(width).to.be.within(130, 140);
expect(width).to.be.within(130, 140);
expect(svg).to.not.have.attr('style'); expect(svg).to.not.have.attr('style');
}); });
}); });
}); });

View File

@@ -1,12 +1,11 @@
/* eslint-env jest */
import { imgSnapshotTest } from '../../helpers/util.js'; import { imgSnapshotTest } from '../../helpers/util.js';
describe('Pie Chart', () => { describe('Pie Chart', () => {
// beforeEach(()=>{ // beforeEach(()=>{
// cy.clock((new Date('2014-06-09')).getTime()); // cy.clock((new Date('2014-06-09')).getTime());
// }); // });
['default', 'forest', 'dark', 'neutral'].forEach(theme=>{ ['default', 'forest', 'dark', 'neutral'].forEach((theme) => {
describe(theme, () => { describe(theme, () => {
it('should render a pie diagram', () => { it('should render a pie diagram', () => {
imgSnapshotTest( imgSnapshotTest(
@@ -16,7 +15,7 @@ describe('Pie Chart', () => {
"Ice-Hockey" : 80 "Ice-Hockey" : 80
"Football" : 90 "Football" : 90
`, `,
{theme} { theme }
); );
cy.get('svg'); cy.get('svg');
}); });
@@ -39,7 +38,7 @@ describe('Pie Chart', () => {
G G
end end
`, `,
{theme} { theme }
); );
cy.get('svg'); cy.get('svg');
}); });
@@ -62,7 +61,7 @@ describe('Pie Chart', () => {
G G
end end
`, `,
{theme} { theme }
); );
cy.get('svg'); cy.get('svg');
}); });
@@ -88,7 +87,7 @@ describe('Pie Chart', () => {
`, `,
{theme} { theme }
); );
cy.get('svg'); cy.get('svg');
}); });
@@ -135,10 +134,10 @@ describe('Pie Chart', () => {
classM ..|> classN : Realization classM ..|> classN : Realization
classO .. classP : Link(Dashed) classO .. classP : Link(Dashed)
`, `,
{theme} { theme }
); );
cy.get('svg'); cy.get('svg');
}); });
it('should render a state diagram', () => { it('should render a state diagram', () => {
imgSnapshotTest( imgSnapshotTest(
` `
@@ -167,10 +166,10 @@ stateDiagram
Active --> SomethingElse Active --> SomethingElse
note right of SomethingElse : This is the note to the right. note right of SomethingElse : This is the note to the right.
`, `,
{theme} { theme }
); );
cy.get('svg'); cy.get('svg');
}); });
it('should render a state diagram (v2)', () => { it('should render a state diagram (v2)', () => {
imgSnapshotTest( imgSnapshotTest(
` `
@@ -199,10 +198,10 @@ stateDiagram-v2
Active --> SomethingElse2 Active --> SomethingElse2
note right of SomethingElse2 : This is the note to the right. note right of SomethingElse2 : This is the note to the right.
`, `,
{theme} { theme }
); );
cy.get('svg'); cy.get('svg');
}); });
it('should render a er diagram', () => { it('should render a er diagram', () => {
imgSnapshotTest( imgSnapshotTest(
` `
@@ -217,10 +216,10 @@ erDiagram
PRODUCT ||--o{ ORDER-ITEM : "ordered in" PRODUCT ||--o{ ORDER-ITEM : "ordered in"
`, `,
{theme} { theme }
); );
cy.get('svg'); cy.get('svg');
}); });
it('should render a user journey diagram', () => { it('should render a user journey diagram', () => {
imgSnapshotTest( imgSnapshotTest(
` `
@@ -235,12 +234,12 @@ erDiagram
Go downstairs: 5: Me Go downstairs: 5: Me
Sit down: 5: Me Sit down: 5: Me
`, `,
{theme} { theme }
); );
cy.get('svg'); cy.get('svg');
}); });
it('should render a gantt diagram', () => { it('should render a gantt diagram', () => {
cy.clock((new Date('2014-01-06')).getTime()); cy.clock(new Date('2014-01-06').getTime());
imgSnapshotTest( imgSnapshotTest(
` `
gantt gantt
@@ -271,10 +270,10 @@ erDiagram
Add gantt diagram to demo page :20h Add gantt diagram to demo page :20h
Add another diagram to demo page :48h Add another diagram to demo page :48h
`, `,
{theme} { theme }
); );
cy.get('svg'); cy.get('svg');
}); });
}); });
}); });
}); });

View File

@@ -30,30 +30,29 @@ if (location.href.match('test-html-escaping')) {
code = code3; code = code3;
} }
mermaid.initialize({ mermaid.initialize({
theme: 'default', theme: 'default',
// fontFamily: '"Lucida Console", Monaco, monospace', // fontFamily: '"Lucida Console", Monaco, monospace',
startOnLoad: false, startOnLoad: false,
securityLevel: 'loose', securityLevel: 'loose',
flowchart: { flowchart: {
htmlLabels: true htmlLabels: true,
}, },
gantt: { gantt: {
axisFormatter: [ axisFormatter: [
[ [
'%Y-%m-%d', '%Y-%m-%d',
d => { (d) => {
return d.getDay() === 1; return d.getDay() === 1;
} },
] ],
] ],
} },
}); });
mermaid.render( mermaid.render(
'the-id-of-the-svg', 'the-id-of-the-svg',
code, code,
svg => { (svg) => {
console.log(svg); console.log(svg);
const elem = document.querySelector('#graph-to-be'); const elem = document.querySelector('#graph-to-be');
elem.innerHTML = svg; elem.innerHTML = svg;

View File

@@ -74,7 +74,7 @@ stateDiagram-v2
A --> D: asd123 A --> D: asd123
</div> </div>
</div> </div>
<div class="mermaid" style="width: 50%; height: 40%;"> <div class="mermaid2" style="width: 50%; height: 40%;">
%% this does not produce the desired result %% this does not produce the desired result
flowchart TB flowchart TB
subgraph container_Beta subgraph container_Beta
@@ -88,24 +88,13 @@ flowchart TB
</div> </div>
<div class="mermaid" style="width: 50%; height: 40%;"> <div class="mermaid" style="width: 50%; height: 40%;">
%%{init: {'theme': 'base', 'themeVariables': { 'primaryColor': '#ff0000'}}}%% flowchart TB
flowchart TB a{{"Lorem 'ipsum' dolor 'sit' amet, 'consectetur' adipiscing 'elit'."}}
b-->B --> b{{"Lorem #quot;ipsum#quot; dolor #quot;sit#quot; amet,#quot;consectetur#quot; adipiscing #quot;elit#quot;."}}
a-->c
subgraph O
A
end
subgraph B
c
end
subgraph A
a
b
B
end
</div> </div>
<div class="mermaid" style="width: 50%; height: 50%;"> <div class="mermaid2" style="width: 50%; height: 50%;">
flowchart TB flowchart TB
internet internet
nat nat
@@ -130,7 +119,7 @@ flowchart TB
routeur --> subnet1 & subnet2 routeur --> subnet1 & subnet2
subnet1 & subnet2 --> nat --> internet subnet1 & subnet2 --> nat --> internet
</div> </div>
<div class="mermaid" style="width: 50%; height: 50%;"> <div class="mermaid2" style="width: 50%; height: 50%;">
flowchart TD flowchart TD
subgraph one[One] subgraph one[One]
@@ -145,7 +134,7 @@ end
sub_one --> two sub_one --> two
</div> </div>
<div class="mermaid" style="width: 50%; height: 50%;"> <div class="mermaid2" style="width: 50%; height: 50%;">
flowchart TD flowchart TD
subgraph one[One] subgraph one[One]
@@ -174,7 +163,7 @@ _one --> b
// arrowMarkerAbsolute: true, // arrowMarkerAbsolute: true,
// themeCSS: '.edgePath .path {stroke: red;} .arrowheadPath {fill: red;}', // themeCSS: '.edgePath .path {stroke: red;} .arrowheadPath {fill: red;}',
logLevel: 0, logLevel: 0,
flowchart: { curve: 'cardinal', "htmlLabels": false }, flowchart: { curve: 'cardinal', "htmlLabels": true },
// gantt: { axisFormat: '%m/%d/%Y' }, // gantt: { axisFormat: '%m/%d/%Y' },
sequence: { actorMargin: 50, showSequenceNumbers: true }, sequence: { actorMargin: 50, showSequenceNumbers: true },
// sequenceDiagram: { actorMargin: 300 } // deprecated // sequenceDiagram: { actorMargin: 300 } // deprecated

View File

@@ -13,6 +13,7 @@
/* background:#333; */ /* background:#333; */
font-family: 'Arial'; font-family: 'Arial';
/* font-size: 18px !important; */ /* font-size: 18px !important; */
width: 100%;
} }
h1 { color: grey;} h1 { color: grey;}
.mermaid2,.mermaid3 { .mermaid2,.mermaid3 {
@@ -25,89 +26,27 @@
</head> </head>
<body> <body>
<div>info below</div> <div>info below</div>
<div class="flex"> <div class="flex flex-wrap">
<div class="mermaid3" style="width: 100%; height: 20%;">
stateDiagram-v2
state S1 {
sub1 -->sub2
}
state S2 {
sub4
}
S1 --> S2
sub1 --> sub4
</div>
<div class="mermaid3" style="width: 100%; height: 20%;">
stateDiagram
state CompositeState {
YourState123456789012345123456789123456789012345123456789123456789012345123456789123456789012345123456789 --> MyState:a label
}
</div>
<div class="mermaid3" style="width: 100%; height: 20%;">
flowchart
subgraph CompositeState
subgraph AnotherCompositeStateCompositeStateCompositeStateCompositeState
YourState --a label--> MyState
end
end
</div>
<div class="mermaid" style="width: 100%; height: 20%;"> <div class="mermaid" style="width: 100%; height: 20%;">
graph TD
A["<img src=`https://via.placeholder.com/64/`>"]
</div>
<div class="mermaid2" style="width: 100%; height: 20%;">
flowchart TD
Link --> b
click Link href "&#x6A&#x61&#x76&#x61&#x73&#x63&#x72&#x69&#x70&#x74&#x3A&#x61&#x6C&#x65&#x72&#x74&#x28&#x27&#x58&#x53&#x53&#x27&#x29" "Tooltip for
Amet"
</div>
<div class="mermaid2" style="width: 100%; height: 20%;">
stateDiagram-v2 stateDiagram-v2
state CS { [*] --> S1
state ACS { state "Some long name" as S1
YourState
}
}
</div>
<div class="mermaid2" style="width: 100%; height: 20%;">
stateDiagram-v2
[*] --> Active
state Active { </div>
[*] --> NumLockOff
NumLockOff --> NumLockOn : EvNumLockPressed
NumLockOn --> NumLockOff : EvNumLockPressed
--
[*] --> CapsLockOff
CapsLockOff --> CapsLockOn : EvCapsLockPressed
CapsLockOn --> CapsLockOff : EvCapsLockPressed
}
state SomethingElse {
A --> B
B --> A
}
Active --> SomethingElse
note right of SomethingElse : This is the note to the right.
SomethingElse --> [*] </div>
<script src="./mermaid.js"></script> <script src="./mermaid.js"></script>
<script> <script>
mermaid.parseError = function (err, hash) { mermaid.parseError = function (err, hash) {
// console.error('Mermaid error: ', err); // console.error('Mermaid error: ', err);
}; };
mermaid.initialize({ mermaid.initialize({
theme: 'base', // theme: 'dark',
theme: 'forest',
arrowMarkerAbsolute: true, arrowMarkerAbsolute: true,
// themeCSS: '.edgePath .path {stroke: red;} .arrowheadPath {fill: red;}', // themeCSS: '.edgePath .path {stroke: red;} .arrowheadPath {fill: red;}',
logLevel: 2, logLevel: 2,
flowchart: { nodeSpacing: 10, curve: 'cardinal', htmlLabels: true }, flowchart: { nodeSpacing: 10, curve: 'cardinal', htmlLabels: false },
htmlLabels: true,
// gantt: { axisFormat: '%m/%d/%Y' }, // gantt: { axisFormat: '%m/%d/%Y' },
sequence: { actorFontFamily: 'courier',actorMargin: 50, showSequenceNumbers: false }, sequence: { actorFontFamily: 'courier',actorMargin: 50, showSequenceNumbers: false },
// sequenceDiagram: { actorMargin: 300 } // deprecated // sequenceDiagram: { actorMargin: 300 } // deprecated
@@ -121,7 +60,7 @@ YourState
logLevel:0, logLevel:0,
fontSize: 18, fontSize: 18,
curve: 'cardinal', curve: 'cardinal',
securityLevel: 'loose', securityLevel: 'strict',
// themeVariables: {relationLabelColor: 'red'} // themeVariables: {relationLabelColor: 'red'}
}); });
function callback(){alert('It worked');} function callback(){alert('It worked');}

View File

@@ -2,11 +2,10 @@ import { Base64 } from 'js-base64';
import mermaid2 from '../../src/mermaid'; import mermaid2 from '../../src/mermaid';
/** /**
* ##contentLoaded * ##contentLoaded Callback function that is called when page is loaded. This functions fetches
* Callback function that is called when page is loaded. This functions fetches configuration for mermaid rendering and * configuration for mermaid rendering and calls init for rendering the mermaid diagrams on the page.
* calls init for rendering the mermaid diagrams on the page.
*/ */
const contentLoaded = function() { const contentLoaded = function () {
let pos = document.location.href.indexOf('?graph='); let pos = document.location.href.indexOf('?graph=');
if (pos > 0) { if (pos > 0) {
pos = pos + 7; pos = pos + 7;
@@ -38,8 +37,12 @@ const contentLoaded = function() {
} }
}; };
/**
* @param current
* @param update
*/
function merge(current, update) { function merge(current, update) {
Object.keys(update).forEach(function(key) { Object.keys(update).forEach(function (key) {
// if update[key] exist, and it's not a string or array, // if update[key] exist, and it's not a string or array,
// we go in one level deeper // we go in one level deeper
if ( if (
@@ -58,7 +61,7 @@ function merge(current, update) {
return current; return current;
} }
const contentLoadedApi = function() { const contentLoadedApi = function () {
let pos = document.location.href.indexOf('?graph='); let pos = document.location.href.indexOf('?graph=');
if (pos > 0) { if (pos > 0) {
pos = pos + 7; pos = pos + 7;
@@ -125,7 +128,7 @@ if (typeof document !== 'undefined') {
*/ */
window.addEventListener( window.addEventListener(
'load', 'load',
function() { function () {
if (this.location.href.match('xss.html')) { if (this.location.href.match('xss.html')) {
this.console.log('Using api'); this.console.log('Using api');
contentLoadedApi(); contentLoadedApi();

105
cypress/platform/xss10.html Normal file
View File

@@ -0,0 +1,105 @@
<html>
<head>
<link
href="https://fonts.googleapis.com/css?family=Montserrat&display=swap"
rel="stylesheet"
/>
<link href="https://unpkg.com/tailwindcss@^1.0/dist/tailwind.min.css" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<link href="https://fonts.googleapis.com/css?family=Noto+Sans+SC&display=swap" rel="stylesheet">
<style>
body {
/* background: rgb(221, 208, 208); */
/* background:#333; */
font-family: 'Arial';
/* font-size: 18px !important; */
}
h1 { color: grey;}
.mermaid2 {
display: none;
}
.mermaid svg {
/* font-size: 18px !important; */
}
.malware {
position: fixed;
bottom:0;
left:0;
right:0;
height: 150px;
background: red;
color: black;
display: flex;
display: flex;
justify-content: center;
align-items: center;
font-family: monospace;
font-size: 72px;
}
</style>
</head>
<body>
<div>Security check</div>
<div class="flex">
<div id="diagram" class="mermaid"></div>
<div id="res" class=""></div>
<script src="./mermaid.js"></script>
<script>
mermaid.parseError = function (err, hash) {
// console.error('Mermaid error: ', err);
};
mermaid.initialize({
theme: 'forest',
arrowMarkerAbsolute: true,
// themeCSS: '.edgePath .path {stroke: red;} .arrowheadPath {fill: red;}',
logLevel: 0,
state: {
defaultRenderer: 'dagre-d3',
},
flowchart: {
// defaultRenderer: 'dagre-wrapper',
nodeSpacing: 10, curve: 'cardinal', htmlLabels: true
},
htmlLabels: true,
// gantt: { axisFormat: '%m/%d/%Y' },
sequence: { actorFontFamily: 'courier',actorMargin: 50, showSequenceNumbers: false },
// sequenceDiagram: { actorMargin: 300 } // deprecated
// fontFamily: '"times", sans-serif',
// fontFamily: 'courier',
fontSize: 18,
curve: 'basis',
securityLevel: 'antiscript',
startOnLoad: false,
secure: ['secure', 'securityLevel', 'startOnLoad', 'maxTextSize']
// themeVariables: {relationLabelColor: 'red'}
});
function callback(){alert('It worked');}
function xssAttack(){
const div = document.createElement('div')
div.id = 'the-malware'
div.className = 'malware'
div.innerHTML = 'XSS Succeeded'
document.getElementsByTagName('body')[0].appendChild(div);
throw new Error('XSS Succeded');
}
var diagram = "classDiagram\n"
diagram += "class Square~<img/src";
diagram += "='1'/onerror=xssAttack()>~{\n";
diagram += "id A\n";
diagram += "}";
// var diagram = "stateDiagram-v2\n";
// diagram += "<img/src='1'/onerror"
// diagram += "=xssAttack()> --> B";
console.log(diagram);
// document.querySelector('#diagram').innerHTML = diagram;
mermaid.render('diagram', diagram, (res) => {
console.log(res);
document.querySelector('#res').innerHTML = res;
});
</script>
</body>
</html>

103
cypress/platform/xss11.html Normal file
View File

@@ -0,0 +1,103 @@
<html>
<head>
<link
href="https://fonts.googleapis.com/css?family=Montserrat&display=swap"
rel="stylesheet"
/>
<link href="https://unpkg.com/tailwindcss@^1.0/dist/tailwind.min.css" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<link href="https://fonts.googleapis.com/css?family=Noto+Sans+SC&display=swap" rel="stylesheet">
<style>
body {
/* background: rgb(221, 208, 208); */
/* background:#333; */
font-family: 'Arial';
/* font-size: 18px !important; */
}
h1 { color: grey;}
.mermaid2 {
display: none;
}
.mermaid svg {
/* font-size: 18px !important; */
}
.malware {
position: fixed;
bottom:0;
left:0;
right:0;
height: 150px;
background: red;
color: black;
display: flex;
display: flex;
justify-content: center;
align-items: center;
font-family: monospace;
font-size: 72px;
}
</style>
</head>
<body>
<div>Security check</div>
<div class="flex">
<div id="diagram" class="mermaid"></div>
<div id="res" class=""></div>
<script src="./mermaid.js"></script>
<script>
mermaid.parseError = function (err, hash) {
// console.error('Mermaid error: ', err);
};
mermaid.initialize({
theme: 'forest',
arrowMarkerAbsolute: true,
// themeCSS: '.edgePath .path {stroke: red;} .arrowheadPath {fill: red;}',
logLevel: 0,
state: {
defaultRenderer: 'dagre-d3',
},
flowchart: {
// defaultRenderer: 'dagre-wrapper',
nodeSpacing: 10, curve: 'cardinal', htmlLabels: true
},
htmlLabels: true,
// gantt: { axisFormat: '%m/%d/%Y' },
sequence: { actorFontFamily: 'courier',actorMargin: 50, showSequenceNumbers: false },
// sequenceDiagram: { actorMargin: 300 } // deprecated
// fontFamily: '"times", sans-serif',
// fontFamily: 'courier',
fontSize: 18,
curve: 'basis',
securityLevel: 'antiscript',
startOnLoad: false,
secure: ['secure', 'securityLevel', 'startOnLoad', 'maxTextSize']
// themeVariables: {relationLabelColor: 'red'}
});
function callback(){alert('It worked');}
function xssAttack(){
const div = document.createElement('div')
div.id = 'the-malware'
div.className = 'malware'
div.innerHTML = 'XSS Succeeded'
document.getElementsByTagName('body')[0].appendChild(div);
throw new Error('XSS Succeded');
}
var diagram = "stateDiagram-v2\n"
diagram += "s2 : This is a state description<img/src";
diagram += "='1'/onerror=xssAttack()>";
// var diagram = "stateDiagram-v2\n";
// diagram += "<img/src='1'/onerror"
// diagram += "=xssAttack()> --> B";
console.log(diagram);
// document.querySelector('#diagram').innerHTML = diagram;
mermaid.render('diagram', diagram, (res) => {
console.log(res);
document.querySelector('#res').innerHTML = res;
});
</script>
</body>
</html>

103
cypress/platform/xss12.html Normal file
View File

@@ -0,0 +1,103 @@
<html>
<head>
<link
href="https://fonts.googleapis.com/css?family=Montserrat&display=swap"
rel="stylesheet"
/>
<link href="https://unpkg.com/tailwindcss@^1.0/dist/tailwind.min.css" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<link href="https://fonts.googleapis.com/css?family=Noto+Sans+SC&display=swap" rel="stylesheet">
<style>
body {
/* background: rgb(221, 208, 208); */
/* background:#333; */
font-family: 'Arial';
/* font-size: 18px !important; */
}
h1 { color: grey;}
.mermaid2 {
display: none;
}
.mermaid svg {
/* font-size: 18px !important; */
}
.malware {
position: fixed;
bottom:0;
left:0;
right:0;
height: 150px;
background: red;
color: black;
display: flex;
display: flex;
justify-content: center;
align-items: center;
font-family: monospace;
font-size: 72px;
}
</style>
</head>
<body>
<div>Security check</div>
<div class="flex">
<div id="diagram" class="mermaid"></div>
<div id="res" class=""></div>
<script src="./mermaid.js"></script>
<script>
mermaid.parseError = function (err, hash) {
// console.error('Mermaid error: ', err);
};
mermaid.initialize({
theme: 'forest',
arrowMarkerAbsolute: true,
// themeCSS: '.edgePath .path {stroke: red;} .arrowheadPath {fill: red;}',
logLevel: 0,
state: {
defaultRenderer: 'dagre-d3',
},
flowchart: {
// defaultRenderer: 'dagre-wrapper',
nodeSpacing: 10, curve: 'cardinal', htmlLabels: true
},
htmlLabels: true,
// gantt: { axisFormat: '%m/%d/%Y' },
sequence: { actorFontFamily: 'courier',actorMargin: 50, showSequenceNumbers: false },
// sequenceDiagram: { actorMargin: 300 } // deprecated
// fontFamily: '"times", sans-serif',
// fontFamily: 'courier',
fontSize: 18,
curve: 'basis',
securityLevel: 'antiscript',
startOnLoad: false,
secure: ['secure', 'securityLevel', 'startOnLoad', 'maxTextSize']
// themeVariables: {relationLabelColor: 'red'}
});
function callback(){alert('It worked');}
function xssAttack(){
const div = document.createElement('div')
div.id = 'the-malware'
div.className = 'malware'
div.innerHTML = 'XSS Succeeded'
document.getElementsByTagName('body')[0].appendChild(div);
throw new Error('XSS Succeded');
}
var diagram = "stateDiagram-v2\n"
diagram += "s2 : A<img/src";
diagram += "='1'/onerror=xssAttack()>";
// var diagram = "stateDiagram-v2\n";
// diagram += "<img/src='1'/onerror"
// diagram += "=xssAttack()> --> B";
console.log(diagram);
// document.querySelector('#diagram').innerHTML = diagram;
mermaid.render('diagram', diagram, (res) => {
console.log(res);
document.querySelector('#res').innerHTML = res;
});
</script>
</body>
</html>

103
cypress/platform/xss13.html Normal file
View File

@@ -0,0 +1,103 @@
<html>
<head>
<link
href="https://fonts.googleapis.com/css?family=Montserrat&display=swap"
rel="stylesheet"
/>
<link href="https://unpkg.com/tailwindcss@^1.0/dist/tailwind.min.css" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<link href="https://fonts.googleapis.com/css?family=Noto+Sans+SC&display=swap" rel="stylesheet">
<style>
body {
/* background: rgb(221, 208, 208); */
/* background:#333; */
font-family: 'Arial';
/* font-size: 18px !important; */
}
h1 { color: grey;}
.mermaid2 {
display: none;
}
.mermaid svg {
/* font-size: 18px !important; */
}
.malware {
position: fixed;
bottom:0;
left:0;
right:0;
height: 150px;
background: red;
color: black;
display: flex;
display: flex;
justify-content: center;
align-items: center;
font-family: monospace;
font-size: 72px;
}
</style>
</head>
<body>
<div>Security check</div>
<div class="flex">
<div id="diagram" class="mermaid"></div>
<div id="res" class=""></div>
<script src="./mermaid.js"></script>
<script>
mermaid.parseError = function (err, hash) {
// console.error('Mermaid error: ', err);
};
mermaid.initialize({
theme: 'forest',
arrowMarkerAbsolute: true,
// themeCSS: '.edgePath .path {stroke: red;} .arrowheadPath {fill: red;}',
logLevel: 0,
state: {
defaultRenderer: 'dagre-d3',
},
flowchart: {
// defaultRenderer: 'dagre-wrapper',
nodeSpacing: 10, curve: 'cardinal', htmlLabels: true
},
htmlLabels: true,
// gantt: { axisFormat: '%m/%d/%Y' },
sequence: { actorFontFamily: 'courier',actorMargin: 50, showSequenceNumbers: false },
// sequenceDiagram: { actorMargin: 300 } // deprecated
// fontFamily: '"times", sans-serif',
// fontFamily: 'courier',
fontSize: 18,
curve: 'basis',
securityLevel: 'antiscript',
startOnLoad: false,
secure: ['secure', 'securityLevel', 'startOnLoad', 'maxTextSize']
// themeVariables: {relationLabelColor: 'red'}
});
function callback(){alert('It worked');}
function xssAttack(){
const div = document.createElement('div')
div.id = 'the-malware'
div.className = 'malware'
div.innerHTML = 'XSS Succeeded'
document.getElementsByTagName('body')[0].appendChild(div);
throw new Error('XSS Succeded');
}
var diagram = "stateDiagram-v2\n"
diagram += "if_state --> False: if n < 0<img/src";
diagram += "='1'/onerror=xssAttack()>";
// var diagram = "stateDiagram-v2\n";
// diagram += "<img/src='1'/onerror"
// diagram += "=xssAttack()> --> B";
console.log(diagram);
// document.querySelector('#diagram').innerHTML = diagram;
mermaid.render('diagram', diagram, (res) => {
console.log(res);
document.querySelector('#res').innerHTML = res;
});
</script>
</body>
</html>

104
cypress/platform/xss14.html Normal file
View File

@@ -0,0 +1,104 @@
<html>
<head>
<link
href="https://fonts.googleapis.com/css?family=Montserrat&display=swap"
rel="stylesheet"
/>
<link href="https://unpkg.com/tailwindcss@^1.0/dist/tailwind.min.css" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<link href="https://fonts.googleapis.com/css?family=Noto+Sans+SC&display=swap" rel="stylesheet">
<style>
body {
/* background: rgb(221, 208, 208); */
/* background:#333; */
font-family: 'Arial';
/* font-size: 18px !important; */
}
h1 { color: grey;}
.mermaid2 {
display: none;
}
.mermaid svg {
/* font-size: 18px !important; */
}
.malware {
position: fixed;
bottom:0;
left:0;
right:0;
height: 150px;
background: red;
color: black;
display: flex;
display: flex;
justify-content: center;
align-items: center;
font-family: monospace;
font-size: 72px;
}
</style>
</head>
<body>
<div>Security check</div>
<div class="flex">
<div id="diagram" class="mermaid"></div>
<div id="res" class=""></div>
<script src="./mermaid.js"></script>
<script>
mermaid.parseError = function (err, hash) {
// console.error('Mermaid error: ', err);
};
mermaid.initialize({
theme: 'forest',
arrowMarkerAbsolute: true,
// themeCSS: '.edgePath .path {stroke: red;} .arrowheadPath {fill: red;}',
logLevel: 0,
state: {
defaultRenderer: 'dagre-d3',
},
flowchart: {
// defaultRenderer: 'dagre-wrapper',
nodeSpacing: 10, curve: 'cardinal', htmlLabels: true
},
htmlLabels: true,
// gantt: { axisFormat: '%m/%d/%Y' },
sequence: { actorFontFamily: 'courier',actorMargin: 50, showSequenceNumbers: false },
// sequenceDiagram: { actorMargin: 300 } // deprecated
// fontFamily: '"times", sans-serif',
// fontFamily: 'courier',
fontSize: 18,
curve: 'basis',
securityLevel: 'antiscript',
startOnLoad: false,
secure: ['secure', 'securityLevel', 'startOnLoad', 'maxTextSize']
// themeVariables: {relationLabelColor: 'red'}
});
function callback(){alert('It worked');}
function xssAttack(){
const div = document.createElement('div')
div.id = 'the-malware'
div.className = 'malware'
div.innerHTML = 'XSS Succeeded'
document.getElementsByTagName('body')[0].appendChild(div);
throw new Error('XSS Succeded');
}
var diagram = "classDiagram\n"
diagram += "classA <-- classB : <ifr";
diagram += "ame/srcdoc='<scr";
diagram += "ipt>parent.xssAttack(`XSS`)</";
diagram += "script>'>";
// var diagram = "stateDiagram-v2\n";
// diagram += "<img/src='1'/onerror"
// diagram += "=xssAttack()> --> B";
console.log(diagram);
// document.querySelector('#diagram').innerHTML = diagram;
mermaid.render('diagram', diagram, (res) => {
console.log(res);
document.querySelector('#res').innerHTML = res;
});
</script>
</body>
</html>

View File

@@ -38,6 +38,19 @@
graph LR graph LR
A --> B A --> B
</div> </div>
<div class="mermaid">
%%{init: { 'theme':'base', '__proto__': {'polluted': 'asdf'}} }%%
%%{init: { 'theme':'base', '__proto__': {'polluted': 'asdf'}} }%%
graph LR
A --> B
</div>
<div class="mermaid">
%%{init: { 'prototype': {'__proto__': {'polluted': 'test'}}} }%%
%%{init: { 'prototype': {'__proto__': {'polluted': 'test'}}} }%%
sequenceDiagram
Alice->>Bob: Hi Bob
Bob->>Alice: Hi Alice
</div>
<script src="./mermaid.js"></script> <script src="./mermaid.js"></script>
<script> <script>
mermaid.initialize({ mermaid.initialize({

View File

@@ -0,0 +1,99 @@
<html>
<head>
<link
href="https://fonts.googleapis.com/css?family=Montserrat&display=swap"
rel="stylesheet"
/>
<link href="https://unpkg.com/tailwindcss@^1.0/dist/tailwind.min.css" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<link href="https://fonts.googleapis.com/css?family=Noto+Sans+SC&display=swap" rel="stylesheet">
<style>
body {
/* background: rgb(221, 208, 208); */
/* background:#333; */
font-family: 'Arial';
/* font-size: 18px !important; */
}
h1 { color: grey;}
.mermaid2 {
display: none;
}
.mermaid svg {
/* font-size: 18px !important; */
}
.malware {
position: fixed;
bottom:0;
left:0;
right:0;
height: 150px;
background: red;
color: black;
display: flex;
display: flex;
justify-content: center;
align-items: center;
font-family: monospace;
font-size: 72px;
}
</style>
</head>
<body>
<div>Security check</div>
<div class="flex">
<div id="diagram" class="mermaid"></div>
<div id="res" class=""></div>
<script src="./mermaid.js"></script>
<script>
mermaid.parseError = function (err, hash) {
// console.error('Mermaid error: ', err);
};
mermaid.initialize({
theme: 'forest',
arrowMarkerAbsolute: true,
// themeCSS: '.edgePath .path {stroke: red;} .arrowheadPath {fill: red;}',
logLevel: 0,
state: {
defaultRenderer: 'dagre-d3',
},
flowchart: {
// defaultRenderer: 'dagre-wrapper',
nodeSpacing: 10, curve: 'cardinal', htmlLabels: true
},
htmlLabels: true,
// gantt: { axisFormat: '%m/%d/%Y' },
sequence: { actorFontFamily: 'courier',actorMargin: 50, showSequenceNumbers: false },
// sequenceDiagram: { actorMargin: 300 } // deprecated
// fontFamily: '"times", sans-serif',
// fontFamily: 'courier',
fontSize: 18,
curve: 'basis',
securityLevel: 'antiscript',
startOnLoad: false,
secure: ['secure', 'securityLevel', 'startOnLoad', 'maxTextSize']
// themeVariables: {relationLabelColor: 'red'}
});
function callback(){alert('It worked');}
function xssAttack(){
const div = document.createElement('div')
div.id = 'the-malware'
div.className = 'malware'
div.innerHTML = 'XSS Succeeded'
document.getElementsByTagName('body')[0].appendChild(div);
throw new Error('XSS Succeded');
}
var diagram = "graph LR\n";
diagram += " B(<a href='<";
diagram += "script></";
diagram += "script>Javascript:xssAttack`1`'>Click)";
// diagram += "script\u003aalert\u0028document.domain\u0029\` src=x>\"\);\n";
console.log(diagram);
// document.querySelector('#diagram').innerHTML = diagram;
mermaid.render('diagram', diagram, (res) => {
console.log(res);
document.querySelector('#res').innerHTML = res;
});
</script>
</body>
</html>

View File

@@ -0,0 +1,99 @@
<html>
<head>
<link
href="https://fonts.googleapis.com/css?family=Montserrat&display=swap"
rel="stylesheet"
/>
<link href="https://unpkg.com/tailwindcss@^1.0/dist/tailwind.min.css" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<link href="https://fonts.googleapis.com/css?family=Noto+Sans+SC&display=swap" rel="stylesheet">
<style>
body {
/* background: rgb(221, 208, 208); */
/* background:#333; */
font-family: 'Arial';
/* font-size: 18px !important; */
}
h1 { color: grey;}
.mermaid2 {
display: none;
}
.mermaid svg {
/* font-size: 18px !important; */
}
.malware {
position: fixed;
bottom:0;
left:0;
right:0;
height: 150px;
background: red;
color: black;
display: flex;
display: flex;
justify-content: center;
align-items: center;
font-family: monospace;
font-size: 72px;
}
</style>
</head>
<body>
<div>Security check</div>
<div class="flex">
<div id="diagram" class="mermaid"></div>
<div id="res" class=""></div>
<script src="./mermaid.js"></script>
<script>
mermaid.parseError = function (err, hash) {
// console.error('Mermaid error: ', err);
};
mermaid.initialize({
theme: 'forest',
arrowMarkerAbsolute: true,
// themeCSS: '.edgePath .path {stroke: red;} .arrowheadPath {fill: red;}',
logLevel: 0,
state: {
defaultRenderer: 'dagre-wrapper',
},
flowchart: {
// defaultRenderer: 'dagre-wrapper',
nodeSpacing: 10, curve: 'cardinal', htmlLabels: true
},
htmlLabels: true,
// gantt: { axisFormat: '%m/%d/%Y' },
sequence: { actorFontFamily: 'courier',actorMargin: 50, showSequenceNumbers: false },
// sequenceDiagram: { actorMargin: 300 } // deprecated
// fontFamily: '"times", sans-serif',
// fontFamily: 'courier',
fontSize: 18,
curve: 'basis',
securityLevel: 'antiscript',
startOnLoad: false,
secure: ['secure', 'securityLevel', 'startOnLoad', 'maxTextSize']
// themeVariables: {relationLabelColor: 'red'}
});
function callback(){alert('It worked');}
function xssAttack(){
const div = document.createElement('div')
div.id = 'the-malware'
div.className = 'malware'
div.innerHTML = 'XSS Succeeded'
document.getElementsByTagName('body')[0].appendChild(div);
throw new Error('XSS Succeded');
}
var diagram = "stateDiagram-v2\n";
diagram += "<img/src='1'/onerror=xssAttack()> --> B";
// diagram += "script\u003aalert\u0028document.domain\u0029\` src=x>\"\);\n";
console.log(diagram);
// document.querySelector('#diagram').innerHTML = diagram;
mermaid.render('diagram', diagram, (res) => {
console.log(res);
document.querySelector('#res').innerHTML = res;
});
</script>
</body>
</html>

View File

@@ -0,0 +1,99 @@
<html>
<head>
<link
href="https://fonts.googleapis.com/css?family=Montserrat&display=swap"
rel="stylesheet"
/>
<link href="https://unpkg.com/tailwindcss@^1.0/dist/tailwind.min.css" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<link href="https://fonts.googleapis.com/css?family=Noto+Sans+SC&display=swap" rel="stylesheet">
<style>
body {
/* background: rgb(221, 208, 208); */
/* background:#333; */
font-family: 'Arial';
/* font-size: 18px !important; */
}
h1 { color: grey;}
.mermaid2 {
display: none;
}
.mermaid svg {
/* font-size: 18px !important; */
}
.malware {
position: fixed;
bottom:0;
left:0;
right:0;
height: 150px;
background: red;
color: black;
display: flex;
display: flex;
justify-content: center;
align-items: center;
font-family: monospace;
font-size: 72px;
}
</style>
</head>
<body>
<div>Security check</div>
<div class="flex">
<div id="diagram" class="mermaid"></div>
<div id="res" class=""></div>
<script src="./mermaid.js"></script>
<script>
mermaid.parseError = function (err, hash) {
// console.error('Mermaid error: ', err);
};
mermaid.initialize({
theme: 'forest',
arrowMarkerAbsolute: true,
// themeCSS: '.edgePath .path {stroke: red;} .arrowheadPath {fill: red;}',
logLevel: 0,
state: {
defaultRenderer: 'dagre-d3',
},
flowchart: {
// defaultRenderer: 'dagre-wrapper',
nodeSpacing: 10, curve: 'cardinal', htmlLabels: true
},
htmlLabels: true,
// gantt: { axisFormat: '%m/%d/%Y' },
sequence: { actorFontFamily: 'courier',actorMargin: 50, showSequenceNumbers: false },
// sequenceDiagram: { actorMargin: 300 } // deprecated
// fontFamily: '"times", sans-serif',
// fontFamily: 'courier',
fontSize: 18,
curve: 'basis',
securityLevel: 'antiscript',
startOnLoad: false,
secure: ['secure', 'securityLevel', 'startOnLoad', 'maxTextSize']
// themeVariables: {relationLabelColor: 'red'}
});
function callback(){alert('It worked');}
function xssAttack(){
const div = document.createElement('div')
div.id = 'the-malware'
div.className = 'malware'
div.innerHTML = 'XSS Succeeded'
document.getElementsByTagName('body')[0].appendChild(div);
throw new Error('XSS Succeded');
}
var diagram = "stateDiagram-v2\n";
diagram += "<img/src='1'/onerror=xssAttack()> --> B";
// diagram += "script\u003aalert\u0028document.domain\u0029\` src=x>\"\);\n";
console.log(diagram);
// document.querySelector('#diagram').innerHTML = diagram;
mermaid.render('diagram', diagram, (res) => {
console.log(res);
document.querySelector('#res').innerHTML = res;
});
</script>
</body>
</html>

View File

@@ -16,8 +16,7 @@
// // `config` is the resolved Cypress config // // `config` is the resolved Cypress config
// } // }
module.exports = (on, config) => { module.exports = (on, config) => {
// `on` is used to hook into various events Cypress emits // `on` is used to hook into various events Cypress emits
// `config` is the resolved Cypress config // `config` is the resolved Cypress config
}; };

Some files were not shown because too many files have changed in this diff Show More