mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-08-21 17:26:45 +02:00
Compare commits
1 Commits
release/10
...
update-lin
Author | SHA1 | Date | |
---|---|---|---|
![]() |
b50eb13746 |
@@ -38,21 +38,14 @@ module.exports = {
|
|||||||
'lodash',
|
'lodash',
|
||||||
'unicorn',
|
'unicorn',
|
||||||
],
|
],
|
||||||
ignorePatterns: [
|
|
||||||
// this file is automatically generated by `pnpm run --filter mermaid types:build-config`
|
|
||||||
'packages/mermaid/src/config.type.ts',
|
|
||||||
],
|
|
||||||
rules: {
|
rules: {
|
||||||
curly: 'error',
|
curly: 'error',
|
||||||
'no-console': 'error',
|
'no-console': 'error',
|
||||||
'no-prototype-builtins': 'off',
|
'no-prototype-builtins': 'off',
|
||||||
'no-unused-vars': 'off',
|
'no-unused-vars': 'off',
|
||||||
'cypress/no-async-tests': 'off',
|
'cypress/no-async-tests': 'off',
|
||||||
'@typescript-eslint/consistent-type-imports': 'error',
|
|
||||||
'@typescript-eslint/no-explicit-any': 'warn',
|
|
||||||
'@typescript-eslint/no-floating-promises': 'error',
|
'@typescript-eslint/no-floating-promises': 'error',
|
||||||
'@typescript-eslint/no-misused-promises': 'error',
|
'@typescript-eslint/no-misused-promises': 'error',
|
||||||
'@typescript-eslint/no-unused-vars': 'warn',
|
|
||||||
'@typescript-eslint/ban-ts-comment': [
|
'@typescript-eslint/ban-ts-comment': [
|
||||||
'error',
|
'error',
|
||||||
{
|
{
|
||||||
@@ -130,14 +123,6 @@ module.exports = {
|
|||||||
files: ['*.{ts,tsx}'],
|
files: ['*.{ts,tsx}'],
|
||||||
plugins: ['tsdoc'],
|
plugins: ['tsdoc'],
|
||||||
rules: {
|
rules: {
|
||||||
'no-restricted-syntax': [
|
|
||||||
'error',
|
|
||||||
{
|
|
||||||
selector: 'TSEnumDeclaration',
|
|
||||||
message:
|
|
||||||
'Prefer using TypeScript union types over TypeScript enum, since TypeScript enums have a bunch of issues, see https://dev.to/dvddpl/whats-the-problem-with-typescript-enums-2okj',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
'tsdoc/syntax': 'error',
|
'tsdoc/syntax': 'error',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
5
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
5
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
@@ -17,9 +17,6 @@ body:
|
|||||||
- Use a clear and concise title
|
- Use a clear and concise title
|
||||||
- Fill out the text fields with as much detail as possible.
|
- Fill out the text fields with as much detail as possible.
|
||||||
- Never be shy to give us screenshots and/or code samples. It will help!
|
- Never be shy to give us screenshots and/or code samples. It will help!
|
||||||
|
|
||||||
There is a chance that the bug is already fixed in the git `develop` branch, but is not released yet.
|
|
||||||
So please check in [Live Editor - Develop](https://develop.git.mermaid.live) before raising an issue.
|
|
||||||
- type: textarea
|
- type: textarea
|
||||||
attributes:
|
attributes:
|
||||||
label: Description
|
label: Description
|
||||||
@@ -46,7 +43,7 @@ body:
|
|||||||
attributes:
|
attributes:
|
||||||
label: Code Sample
|
label: Code Sample
|
||||||
description: |-
|
description: |-
|
||||||
If applicable, add the code sample or a link to the [Live Editor - Develop](https://develop.git.mermaid.live).
|
If applicable, add the code sample or a link to the [Live Editor](https://mermaid.live).
|
||||||
Any text pasted here will be rendered as a Code block.
|
Any text pasted here will be rendered as a Code block.
|
||||||
render: text
|
render: text
|
||||||
- type: textarea
|
- type: textarea
|
||||||
|
8
.github/ISSUE_TEMPLATE/config.yml
vendored
8
.github/ISSUE_TEMPLATE/config.yml
vendored
@@ -7,14 +7,8 @@ contact_links:
|
|||||||
url: https://join.slack.com/t/mermaid-talk/shared_invite/enQtNzc4NDIyNzk4OTAyLWVhYjQxOTI2OTg4YmE1ZmJkY2Y4MTU3ODliYmIwOTY3NDJlYjA0YjIyZTdkMDMyZTUwOGI0NjEzYmEwODcwOTE
|
url: https://join.slack.com/t/mermaid-talk/shared_invite/enQtNzc4NDIyNzk4OTAyLWVhYjQxOTI2OTg4YmE1ZmJkY2Y4MTU3ODliYmIwOTY3NDJlYjA0YjIyZTdkMDMyZTUwOGI0NjEzYmEwODcwOTE
|
||||||
about: Join our Community on Slack for Help and a casual chat.
|
about: Join our Community on Slack for Help and a casual chat.
|
||||||
- name: Documentation
|
- name: Documentation
|
||||||
url: https://mermaid.js.org
|
url: https://mermaid-js.github.io
|
||||||
about: Read our documentation for all that Mermaid.js can offer.
|
about: Read our documentation for all that Mermaid.js can offer.
|
||||||
- name: Live Editor
|
- name: Live Editor
|
||||||
url: https://mermaid.live
|
url: https://mermaid.live
|
||||||
about: Try the live editor to preview graphs in no time.
|
about: Try the live editor to preview graphs in no time.
|
||||||
- name: Live Editor - Develop
|
|
||||||
url: https://develop.git.mermaid.live
|
|
||||||
about: Try unreleased changes in the develop branch.
|
|
||||||
- name: Live Editor - Next
|
|
||||||
url: https://next.git.mermaid.live
|
|
||||||
about: Try unreleased changes in the next branch.
|
|
||||||
|
44
.github/lychee.toml
vendored
44
.github/lychee.toml
vendored
@@ -1,44 +0,0 @@
|
|||||||
############################# Display #############################
|
|
||||||
|
|
||||||
# Verbose program output
|
|
||||||
# Accepts log level: "error", "warn", "info", "debug", "trace"
|
|
||||||
verbose = "debug"
|
|
||||||
|
|
||||||
# Don't show interactive progress bar while checking links.
|
|
||||||
no_progress = true
|
|
||||||
|
|
||||||
############################# Cache ###############################
|
|
||||||
|
|
||||||
# Enable link caching. This can be helpful to avoid checking the same links on
|
|
||||||
# multiple runs.
|
|
||||||
cache = true
|
|
||||||
|
|
||||||
# Discard all cached requests older than this duration.
|
|
||||||
max_cache_age = "1d"
|
|
||||||
|
|
||||||
############################# Requests ############################
|
|
||||||
|
|
||||||
# Comma-separated list of accepted status codes for valid links.
|
|
||||||
accept = [200, 429]
|
|
||||||
|
|
||||||
############################# Exclusions ##########################
|
|
||||||
|
|
||||||
# Exclude URLs and mail addresses from checking (supports regex).
|
|
||||||
exclude = [
|
|
||||||
# Network error: Forbidden
|
|
||||||
"https://codepen.io",
|
|
||||||
|
|
||||||
# Timeout error, maybe Twitter has anti-bot defenses against GitHub's CI servers?
|
|
||||||
"https://twitter.com/mermaidjs_",
|
|
||||||
|
|
||||||
# Don't check files that are generated during the build via `pnpm docs:code`
|
|
||||||
'packages/mermaid/src/docs/config/setup/*',
|
|
||||||
|
|
||||||
# Ignore slack invite
|
|
||||||
"https://join.slack.com/"
|
|
||||||
]
|
|
||||||
|
|
||||||
# Exclude all private IPs from checking.
|
|
||||||
# Equivalent to setting `exclude_private`, `exclude_link_local`, and
|
|
||||||
# `exclude_loopback` to true.
|
|
||||||
exclude_all_private = true
|
|
7
.github/pr-labeler.yml
vendored
7
.github/pr-labeler.yml
vendored
@@ -1,4 +1,3 @@
|
|||||||
'Type: Bug / Error': ['bug/*', fix/*]
|
'Type: Bug / Error': 'bug/*'
|
||||||
'Type: Enhancement': ['feature/*', 'feat/*']
|
'Type: Enhancement': 'feature/*'
|
||||||
'Type: Other': ['other/*', 'chore/*', 'test/*', 'refactor/*']
|
'Type: Other': 'other/*'
|
||||||
'Area: Documentation': ['docs/*']
|
|
||||||
|
4
.github/pull_request_template.md
vendored
4
.github/pull_request_template.md
vendored
@@ -13,6 +13,6 @@ Describe the way your implementation works or what design decisions you made if
|
|||||||
Make sure you
|
Make sure you
|
||||||
|
|
||||||
- [ ] :book: have read the [contribution guidelines](https://github.com/mermaid-js/mermaid/blob/develop/CONTRIBUTING.md)
|
- [ ] :book: have read the [contribution guidelines](https://github.com/mermaid-js/mermaid/blob/develop/CONTRIBUTING.md)
|
||||||
- [ ] :computer: have added necessary unit/e2e tests.
|
- [ ] :computer: have added unit/e2e tests (if appropriate)
|
||||||
- [ ] :notebook: have added documentation. Make sure [`MERMAID_RELEASE_VERSION`](https://github.com/mermaid-js/mermaid/blob/develop/packages/mermaid/src/docs/community/development.md#3-update-documentation) is used for all new features.
|
- [ ] :notebook: have added documentation (if appropriate)
|
||||||
- [ ] :bookmark: targeted `develop` branch
|
- [ ] :bookmark: targeted `develop` branch
|
||||||
|
15
.github/release-drafter.yml
vendored
15
.github/release-drafter.yml
vendored
@@ -1,27 +1,14 @@
|
|||||||
name-template: '$NEXT_PATCH_VERSION'
|
name-template: '$NEXT_PATCH_VERSION'
|
||||||
tag-template: '$NEXT_PATCH_VERSION'
|
tag-template: '$NEXT_PATCH_VERSION'
|
||||||
categories:
|
categories:
|
||||||
- title: '🚨 **Breaking Changes**'
|
|
||||||
labels:
|
|
||||||
- 'Breaking Change'
|
|
||||||
- title: '🚀 Features'
|
- title: '🚀 Features'
|
||||||
labels:
|
labels:
|
||||||
- 'Type: Enhancement'
|
- 'Type: Enhancement'
|
||||||
- 'feature' # deprecated, new PRs shouldn't have this
|
|
||||||
- title: '🐛 Bug Fixes'
|
- title: '🐛 Bug Fixes'
|
||||||
labels:
|
labels:
|
||||||
- 'Type: Bug / Error'
|
- 'Type: Bug / Error'
|
||||||
- 'fix' # deprecated, new PRs shouldn't have this
|
|
||||||
- title: '🧰 Maintenance'
|
- title: '🧰 Maintenance'
|
||||||
labels:
|
label: 'Type: Other'
|
||||||
- 'Type: Other'
|
|
||||||
- 'chore' # deprecated, new PRs shouldn't have this
|
|
||||||
- title: '⚡️ Performance'
|
|
||||||
labels:
|
|
||||||
- 'Type: Performance'
|
|
||||||
- title: '📚 Documentation'
|
|
||||||
labels:
|
|
||||||
- 'Area: Documentation'
|
|
||||||
change-template: '- $TITLE (#$NUMBER) @$AUTHOR'
|
change-template: '- $TITLE (#$NUMBER) @$AUTHOR'
|
||||||
sort-by: title
|
sort-by: title
|
||||||
sort-direction: ascending
|
sort-direction: ascending
|
||||||
|
12
.github/workflows/build-docs.yml
vendored
12
.github/workflows/build-docs.yml
vendored
@@ -1,18 +1,14 @@
|
|||||||
name: Build Vitepress docs
|
name: Build Vitepress docs
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- master
|
|
||||||
- release/*
|
|
||||||
pull_request:
|
pull_request:
|
||||||
merge_group:
|
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-docs:
|
# Build job
|
||||||
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
@@ -29,9 +25,5 @@ jobs:
|
|||||||
- name: Install Packages
|
- name: Install Packages
|
||||||
run: pnpm install --frozen-lockfile
|
run: pnpm install --frozen-lockfile
|
||||||
|
|
||||||
- name: Verify release verion
|
|
||||||
if: ${{ github.event_name == 'push' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/release')) }}
|
|
||||||
run: pnpm --filter mermaid run docs:verify-version
|
|
||||||
|
|
||||||
- name: Run Build
|
- name: Run Build
|
||||||
run: pnpm --filter mermaid run docs:build:vitepress
|
run: pnpm --filter mermaid run docs:build:vitepress
|
||||||
|
3
.github/workflows/build.yml
vendored
3
.github/workflows/build.yml
vendored
@@ -2,7 +2,6 @@ name: Build
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
push: {}
|
push: {}
|
||||||
merge_group:
|
|
||||||
pull_request:
|
pull_request:
|
||||||
types:
|
types:
|
||||||
- opened
|
- opened
|
||||||
@@ -13,7 +12,7 @@ permissions:
|
|||||||
contents: read
|
contents: read
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-mermaid:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
|
2
.github/workflows/check-readme-in-sync.yml
vendored
2
.github/workflows/check-readme-in-sync.yml
vendored
@@ -14,7 +14,7 @@ permissions:
|
|||||||
contents: read
|
contents: read
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
check-readme:
|
check:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
|
7
.github/workflows/checks.yml
vendored
7
.github/workflows/checks.yml
vendored
@@ -1,16 +1,15 @@
|
|||||||
on:
|
on:
|
||||||
push:
|
push: {}
|
||||||
merge_group:
|
|
||||||
pull_request:
|
pull_request:
|
||||||
types:
|
types:
|
||||||
- opened
|
- opened
|
||||||
- synchronize
|
- synchronize
|
||||||
- ready_for_review
|
- ready_for_review
|
||||||
|
|
||||||
name: Static analysis on Test files
|
name: Static analysis
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
check-tests:
|
test:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
name: check tests
|
name: check tests
|
||||||
if: github.repository_owner == 'mermaid-js'
|
if: github.repository_owner == 'mermaid-js'
|
||||||
|
2
.github/workflows/e2e-applitools.yml
vendored
2
.github/workflows/e2e-applitools.yml
vendored
@@ -19,7 +19,7 @@ env:
|
|||||||
USE_APPLI: ${{ secrets.APPLITOOLS_API_KEY && 'true' || '' }}
|
USE_APPLI: ${{ secrets.APPLITOOLS_API_KEY && 'true' || '' }}
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
e2e-applitools:
|
test:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
|
14
.github/workflows/e2e.yml
vendored
14
.github/workflows/e2e.yml
vendored
@@ -1,15 +1,12 @@
|
|||||||
name: E2E
|
name: E2E
|
||||||
|
|
||||||
on:
|
on: [push, pull_request]
|
||||||
push:
|
|
||||||
pull_request:
|
|
||||||
merge_group:
|
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
e2e:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
@@ -45,18 +42,15 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
|
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
|
||||||
VITEST_COVERAGE: true
|
VITEST_COVERAGE: true
|
||||||
CYPRESS_COMMIT: ${{ github.sha }}
|
|
||||||
- name: Upload Coverage to Codecov
|
- name: Upload Coverage to Codecov
|
||||||
uses: codecov/codecov-action@v3
|
uses: codecov/codecov-action@v3
|
||||||
# Run step only pushes to develop and pull_requests
|
if: steps.cypress.conclusion == 'success'
|
||||||
if: ${{ steps.cypress.conclusion == 'success' && (github.event_name == 'pull_request' || github.ref == 'refs/heads/develop')}}
|
|
||||||
with:
|
with:
|
||||||
files: coverage/cypress/lcov.info
|
files: coverage/cypress/lcov.info
|
||||||
flags: e2e
|
flags: e2e
|
||||||
name: mermaid-codecov
|
name: mermaid-codecov
|
||||||
fail_ci_if_error: false
|
fail_ci_if_error: true
|
||||||
verbose: true
|
verbose: true
|
||||||
token: 6845cc80-77ee-4e17-85a1-026cd95e0766
|
|
||||||
- name: Upload Artifacts
|
- name: Upload Artifacts
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3
|
||||||
if: ${{ failure() && steps.cypress.conclusion == 'failure' }}
|
if: ${{ failure() && steps.cypress.conclusion == 'failure' }}
|
||||||
|
7
.github/workflows/link-checker.yml
vendored
7
.github/workflows/link-checker.yml
vendored
@@ -20,7 +20,7 @@ on:
|
|||||||
- cron: '30 8 * * *'
|
- cron: '30 8 * * *'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
link-checker:
|
linkChecker:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
permissions:
|
permissions:
|
||||||
# lychee only uses the GITHUB_TOKEN to avoid rate-limiting
|
# lychee only uses the GITHUB_TOKEN to avoid rate-limiting
|
||||||
@@ -39,7 +39,10 @@ jobs:
|
|||||||
uses: lycheeverse/lychee-action@v1.8.0
|
uses: lycheeverse/lychee-action@v1.8.0
|
||||||
with:
|
with:
|
||||||
args: >-
|
args: >-
|
||||||
--config .github/lychee.toml
|
--verbose
|
||||||
|
--no-progress
|
||||||
|
--cache
|
||||||
|
--max-cache-age 1d
|
||||||
packages/mermaid/src/docs/**/*.md
|
packages/mermaid/src/docs/**/*.md
|
||||||
README.md
|
README.md
|
||||||
README.zh-CN.md
|
README.zh-CN.md
|
||||||
|
30
.github/workflows/lint.yml
vendored
30
.github/workflows/lint.yml
vendored
@@ -1,8 +1,7 @@
|
|||||||
name: Lint
|
name: Lint
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push: {}
|
||||||
merge_group:
|
|
||||||
pull_request:
|
pull_request:
|
||||||
types:
|
types:
|
||||||
- opened
|
- opened
|
||||||
@@ -53,33 +52,6 @@ jobs:
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Verify `./src/config.type.ts` is in sync with `./src/schemas/config.schema.yaml`
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
if ! pnpm run --filter mermaid types:verify-config; then
|
|
||||||
ERROR_MESSAGE='Running `pnpm run --filter mermaid types:verify-config` failed.'
|
|
||||||
ERROR_MESSAGE+=' This should be fixed by running'
|
|
||||||
ERROR_MESSAGE+=' `pnpm run --filter mermaid types:build-config`'
|
|
||||||
ERROR_MESSAGE+=' on your local machine.'
|
|
||||||
echo "::error title=Lint failure::${ERROR_MESSAGE}"
|
|
||||||
# make sure to return an error exitcode so that GitHub actions shows a red-cross
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Verify no circular dependencies
|
|
||||||
working-directory: ./packages/mermaid
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
if ! pnpm run --filter mermaid checkCircle; then
|
|
||||||
ERROR_MESSAGE='Circular dependency detected.'
|
|
||||||
ERROR_MESSAGE+=' This should be fixed by removing the circular dependency.'
|
|
||||||
ERROR_MESSAGE+=' Run `pnpm run --filter mermaid checkCircle` on your local machine'
|
|
||||||
ERROR_MESSAGE+=' to see the circular dependency.'
|
|
||||||
echo "::error title=Lint failure::${ERROR_MESSAGE}"
|
|
||||||
# make sure to return an error exitcode so that GitHub actions shows a red-cross
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Verify Docs
|
- name: Verify Docs
|
||||||
id: verifyDocs
|
id: verifyDocs
|
||||||
working-directory: ./packages/mermaid
|
working-directory: ./packages/mermaid
|
||||||
|
@@ -1,15 +1,11 @@
|
|||||||
name: Validate PR Labeler Configuration
|
name: Validate PR Labeler Configuration
|
||||||
on:
|
on:
|
||||||
push:
|
push: {}
|
||||||
paths:
|
|
||||||
- .github/workflows/pr-labeler-config-validator.yml
|
|
||||||
- .github/workflows/pr-labeler.yml
|
|
||||||
- .github/pr-labeler.yml
|
|
||||||
pull_request:
|
pull_request:
|
||||||
paths:
|
types:
|
||||||
- .github/workflows/pr-labeler-config-validator.yml
|
- opened
|
||||||
- .github/workflows/pr-labeler.yml
|
- synchronize
|
||||||
- .github/pr-labeler.yml
|
- ready_for_review
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
pr-labeler:
|
pr-labeler:
|
||||||
|
6
.github/workflows/publish-docs.yml
vendored
6
.github/workflows/publish-docs.yml
vendored
@@ -19,7 +19,7 @@ concurrency:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
# Build job
|
# Build job
|
||||||
build-docs:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
@@ -48,11 +48,11 @@ jobs:
|
|||||||
path: packages/mermaid/src/vitepress/.vitepress/dist
|
path: packages/mermaid/src/vitepress/.vitepress/dist
|
||||||
|
|
||||||
# Deployment job
|
# Deployment job
|
||||||
deploy-docs:
|
deploy:
|
||||||
environment:
|
environment:
|
||||||
name: github-pages
|
name: github-pages
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: build-docs
|
needs: build
|
||||||
steps:
|
steps:
|
||||||
- name: Deploy to GitHub Pages
|
- name: Deploy to GitHub Pages
|
||||||
id: deployment
|
id: deployment
|
||||||
|
@@ -6,7 +6,7 @@ on:
|
|||||||
- 'release/**'
|
- 'release/**'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
publish-preview:
|
publish:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
|
15
.github/workflows/test.yml
vendored
15
.github/workflows/test.yml
vendored
@@ -1,12 +1,12 @@
|
|||||||
name: Unit Tests
|
name: Unit Tests
|
||||||
|
|
||||||
on: [push, pull_request, merge_group]
|
on: [push, pull_request]
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
unit-test:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
@@ -43,12 +43,15 @@ jobs:
|
|||||||
|
|
||||||
- name: Upload Coverage to Codecov
|
- name: Upload Coverage to Codecov
|
||||||
uses: codecov/codecov-action@v3
|
uses: codecov/codecov-action@v3
|
||||||
# Run step only pushes to develop and pull_requests
|
|
||||||
if: ${{ github.event_name == 'pull_request' || github.ref == 'refs/heads/develop' }}
|
|
||||||
with:
|
with:
|
||||||
files: ./coverage/vitest/lcov.info
|
files: ./coverage/vitest/lcov.info
|
||||||
flags: unit
|
flags: unit
|
||||||
name: mermaid-codecov
|
name: mermaid-codecov
|
||||||
fail_ci_if_error: false
|
fail_ci_if_error: true
|
||||||
verbose: true
|
verbose: true
|
||||||
token: 6845cc80-77ee-4e17-85a1-026cd95e0766
|
# Coveralls is throwing 500. Disabled for now.
|
||||||
|
# - name: Upload Coverage to Coveralls
|
||||||
|
# uses: coverallsapp/github-action@v2
|
||||||
|
# with:
|
||||||
|
# github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
# flag-name: unit
|
||||||
|
2
.github/workflows/update-browserlist.yml
vendored
2
.github/workflows/update-browserlist.yml
vendored
@@ -5,7 +5,7 @@ on:
|
|||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
update-browser-list:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
|
3
.gitignore
vendored
3
.gitignore
vendored
@@ -43,6 +43,3 @@ stats/
|
|||||||
**/contributor-names.json
|
**/contributor-names.json
|
||||||
.pnpm-store
|
.pnpm-store
|
||||||
.nyc_output
|
.nyc_output
|
||||||
|
|
||||||
demos/dev/**
|
|
||||||
!/demos/dev/example.html
|
|
||||||
|
17
.lycheeignore
Normal file
17
.lycheeignore
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
# These links are ignored by our link checker https://github.com/lycheeverse/lychee
|
||||||
|
# The file allows you to list multiple regular expressions for exclusion (one pattern per line).
|
||||||
|
|
||||||
|
# Network error: Forbidden
|
||||||
|
https://codepen.io
|
||||||
|
|
||||||
|
# Timeout error, maybe Twitter has anti-bot defenses against GitHub's CI servers?
|
||||||
|
https://twitter.com/mermaidjs_
|
||||||
|
|
||||||
|
# Don't check files that are generated during the build via `pnpm docs:code`
|
||||||
|
packages/mermaid/src/docs/config/setup/*
|
||||||
|
|
||||||
|
# Ignore localhost
|
||||||
|
http://localhost:3333/
|
||||||
|
|
||||||
|
# Ignore slack invite
|
||||||
|
https://join.slack.com/
|
@@ -5,8 +5,5 @@ coverage
|
|||||||
# Autogenerated by PNPM
|
# Autogenerated by PNPM
|
||||||
pnpm-lock.yaml
|
pnpm-lock.yaml
|
||||||
stats
|
stats
|
||||||
**/.vitepress/components.d.ts
|
packages/mermaid/src/docs/.vitepress/components.d.ts
|
||||||
**/.vitepress/cache
|
|
||||||
.nyc_output
|
.nyc_output
|
||||||
# Autogenerated by `pnpm run --filter mermaid types:build-config`
|
|
||||||
packages/mermaid/src/config.type.ts
|
|
||||||
|
@@ -2,7 +2,6 @@ import { build, InlineConfig, type PluginOption } from 'vite';
|
|||||||
import { resolve } from 'path';
|
import { resolve } from 'path';
|
||||||
import { fileURLToPath } from 'url';
|
import { fileURLToPath } from 'url';
|
||||||
import jisonPlugin from './jisonPlugin.js';
|
import jisonPlugin from './jisonPlugin.js';
|
||||||
import jsonSchemaPlugin from './jsonSchemaPlugin.js';
|
|
||||||
import { readFileSync } from 'fs';
|
import { readFileSync } from 'fs';
|
||||||
import typescript from '@rollup/plugin-typescript';
|
import typescript from '@rollup/plugin-typescript';
|
||||||
import { visualizer } from 'rollup-plugin-visualizer';
|
import { visualizer } from 'rollup-plugin-visualizer';
|
||||||
@@ -122,7 +121,6 @@ export const getBuildConfig = ({ minify, core, watch, entryName }: BuildOptions)
|
|||||||
},
|
},
|
||||||
plugins: [
|
plugins: [
|
||||||
jisonPlugin(),
|
jisonPlugin(),
|
||||||
jsonSchemaPlugin(), // handles `.schema.yaml` files
|
|
||||||
// @ts-expect-error According to the type definitions, rollup plugins are incompatible with vite
|
// @ts-expect-error According to the type definitions, rollup plugins are incompatible with vite
|
||||||
typescript({ compilerOptions: { declaration: false } }),
|
typescript({ compilerOptions: { declaration: false } }),
|
||||||
istanbul({
|
istanbul({
|
||||||
|
@@ -1,151 +0,0 @@
|
|||||||
import { load, JSON_SCHEMA } from 'js-yaml';
|
|
||||||
import assert from 'node:assert';
|
|
||||||
import Ajv2019, { type JSONSchemaType } from 'ajv/dist/2019.js';
|
|
||||||
import { PluginOption } from 'vite';
|
|
||||||
|
|
||||||
import type { MermaidConfig, BaseDiagramConfig } from '../packages/mermaid/src/config.type.js';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* All of the keys in the mermaid config that have a mermaid diagram config.
|
|
||||||
*/
|
|
||||||
const MERMAID_CONFIG_DIAGRAM_KEYS = [
|
|
||||||
'flowchart',
|
|
||||||
'sequence',
|
|
||||||
'gantt',
|
|
||||||
'journey',
|
|
||||||
'class',
|
|
||||||
'state',
|
|
||||||
'er',
|
|
||||||
'pie',
|
|
||||||
'quadrantChart',
|
|
||||||
'xyChart',
|
|
||||||
'requirement',
|
|
||||||
'mindmap',
|
|
||||||
'timeline',
|
|
||||||
'gitGraph',
|
|
||||||
'c4',
|
|
||||||
'sankey',
|
|
||||||
] as const;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Generate default values from the JSON Schema.
|
|
||||||
*
|
|
||||||
* AJV does not support nested default values yet (or default values with $ref),
|
|
||||||
* so we need to manually find them (this may be fixed in ajv v9).
|
|
||||||
*
|
|
||||||
* @param mermaidConfigSchema - The Mermaid JSON Schema to use.
|
|
||||||
* @returns The default mermaid config object.
|
|
||||||
*/
|
|
||||||
function generateDefaults(mermaidConfigSchema: JSONSchemaType<MermaidConfig>) {
|
|
||||||
const ajv = new Ajv2019({
|
|
||||||
useDefaults: true,
|
|
||||||
allowUnionTypes: true,
|
|
||||||
strict: true,
|
|
||||||
});
|
|
||||||
|
|
||||||
ajv.addKeyword({
|
|
||||||
keyword: 'meta:enum', // used by jsonschema2md
|
|
||||||
errors: false,
|
|
||||||
});
|
|
||||||
ajv.addKeyword({
|
|
||||||
keyword: 'tsType', // used by json-schema-to-typescript
|
|
||||||
errors: false,
|
|
||||||
});
|
|
||||||
|
|
||||||
// ajv currently doesn't support nested default values, see https://github.com/ajv-validator/ajv/issues/1718
|
|
||||||
// (may be fixed in v9) so we need to manually use sub-schemas
|
|
||||||
const mermaidDefaultConfig = {};
|
|
||||||
|
|
||||||
assert.ok(mermaidConfigSchema.$defs);
|
|
||||||
const baseDiagramConfig = mermaidConfigSchema.$defs.BaseDiagramConfig;
|
|
||||||
|
|
||||||
for (const key of MERMAID_CONFIG_DIAGRAM_KEYS) {
|
|
||||||
const subSchemaRef = mermaidConfigSchema.properties[key].$ref;
|
|
||||||
const [root, defs, defName] = subSchemaRef.split('/');
|
|
||||||
assert.strictEqual(root, '#');
|
|
||||||
assert.strictEqual(defs, '$defs');
|
|
||||||
const subSchema = {
|
|
||||||
$schema: mermaidConfigSchema.$schema,
|
|
||||||
$defs: mermaidConfigSchema.$defs,
|
|
||||||
...mermaidConfigSchema.$defs[defName],
|
|
||||||
} as JSONSchemaType<BaseDiagramConfig>;
|
|
||||||
|
|
||||||
const validate = ajv.compile(subSchema);
|
|
||||||
|
|
||||||
mermaidDefaultConfig[key] = {};
|
|
||||||
|
|
||||||
for (const required of subSchema.required ?? []) {
|
|
||||||
if (subSchema.properties[required] === undefined && baseDiagramConfig.properties[required]) {
|
|
||||||
mermaidDefaultConfig[key][required] = baseDiagramConfig.properties[required].default;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!validate(mermaidDefaultConfig[key])) {
|
|
||||||
throw new Error(
|
|
||||||
`schema for subconfig ${key} does not have valid defaults! Errors were ${JSON.stringify(
|
|
||||||
validate.errors,
|
|
||||||
undefined,
|
|
||||||
2
|
|
||||||
)}`
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const validate = ajv.compile(mermaidConfigSchema);
|
|
||||||
|
|
||||||
if (!validate(mermaidDefaultConfig)) {
|
|
||||||
throw new Error(
|
|
||||||
`Mermaid config JSON Schema does not have valid defaults! Errors were ${JSON.stringify(
|
|
||||||
validate.errors,
|
|
||||||
undefined,
|
|
||||||
2
|
|
||||||
)}`
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return mermaidDefaultConfig;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Vite plugin that handles JSON Schemas saved as a `.schema.yaml` file.
|
|
||||||
*
|
|
||||||
* Use `my-example.schema.yaml?only-defaults=true` to only load the default values.
|
|
||||||
*/
|
|
||||||
export default function jsonSchemaPlugin(): PluginOption {
|
|
||||||
return {
|
|
||||||
name: 'json-schema-plugin',
|
|
||||||
transform(src: string, id: string) {
|
|
||||||
const idAsUrl = new URL(id, 'file:///');
|
|
||||||
|
|
||||||
if (!idAsUrl.pathname.endsWith('schema.yaml')) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (idAsUrl.searchParams.get('only-defaults')) {
|
|
||||||
const jsonSchema = load(src, {
|
|
||||||
filename: idAsUrl.pathname,
|
|
||||||
// only allow JSON types in our YAML doc (will probably be default in YAML 1.3)
|
|
||||||
// e.g. `true` will be parsed a boolean `true`, `True` will be parsed as string `"True"`.
|
|
||||||
schema: JSON_SCHEMA,
|
|
||||||
}) as JSONSchemaType<MermaidConfig>;
|
|
||||||
return {
|
|
||||||
code: `export default ${JSON.stringify(generateDefaults(jsonSchema), undefined, 2)};`,
|
|
||||||
map: null, // no source map
|
|
||||||
};
|
|
||||||
} else {
|
|
||||||
return {
|
|
||||||
code: `export default ${JSON.stringify(
|
|
||||||
load(src, {
|
|
||||||
filename: idAsUrl.pathname,
|
|
||||||
// only allow JSON types in our YAML doc (will probably be default in YAML 1.3)
|
|
||||||
// e.g. `true` will be parsed a boolean `true`, `True` will be parsed as string `"True"`.
|
|
||||||
schema: JSON_SCHEMA,
|
|
||||||
}),
|
|
||||||
undefined,
|
|
||||||
2
|
|
||||||
)};`,
|
|
||||||
map: null, // provide source map if available
|
|
||||||
};
|
|
||||||
}
|
|
||||||
},
|
|
||||||
};
|
|
||||||
}
|
|
2
.vscode/launch.json
vendored
2
.vscode/launch.json
vendored
@@ -17,7 +17,7 @@
|
|||||||
"name": "Docs generation",
|
"name": "Docs generation",
|
||||||
"type": "node",
|
"type": "node",
|
||||||
"request": "launch",
|
"request": "launch",
|
||||||
"args": ["scripts/docs.cli.mts"],
|
"args": ["src/docs.mts"],
|
||||||
"runtimeArgs": ["--loader", "ts-node/esm"],
|
"runtimeArgs": ["--loader", "ts-node/esm"],
|
||||||
"cwd": "${workspaceRoot}/packages/mermaid",
|
"cwd": "${workspaceRoot}/packages/mermaid",
|
||||||
"skipFiles": ["<node_internals>/**", "**/node_modules/**"],
|
"skipFiles": ["<node_internals>/**", "**/node_modules/**"],
|
||||||
|
14
CHANGELOG.md
14
CHANGELOG.md
@@ -68,7 +68,7 @@ try {
|
|||||||
|
|
||||||
### Init deprecated and InitThrowsErrors removed
|
### Init deprecated and InitThrowsErrors removed
|
||||||
|
|
||||||
The config passed to `init` was not being used earlier.
|
The config passed to `init` was not being used eariler.
|
||||||
It will now be used.
|
It will now be used.
|
||||||
The `init` function is deprecated and will be removed in the next major release.
|
The `init` function is deprecated and will be removed in the next major release.
|
||||||
init currently works as a wrapper to `initialize` and `run`.
|
init currently works as a wrapper to `initialize` and `run`.
|
||||||
@@ -195,7 +195,7 @@ mermaid.run({
|
|||||||
- "Cannot activate" in sequenceDiagram [\#647](https://github.com/knsv/mermaid/issues/647)
|
- "Cannot activate" in sequenceDiagram [\#647](https://github.com/knsv/mermaid/issues/647)
|
||||||
- Link \("click" statement\) in flowchart does not work in exported SVG [\#646](https://github.com/knsv/mermaid/issues/646)
|
- Link \("click" statement\) in flowchart does not work in exported SVG [\#646](https://github.com/knsv/mermaid/issues/646)
|
||||||
- How to pass styling [\#639](https://github.com/knsv/mermaid/issues/639)
|
- How to pass styling [\#639](https://github.com/knsv/mermaid/issues/639)
|
||||||
- The live editor can't show seq diagram with notes for 8.0.0-alpha.3 [\#638](https://github.com/knsv/mermaid/issues/638)
|
- The live editor cant show seq diagram with notes for 8.0.0-alpha.3 [\#638](https://github.com/knsv/mermaid/issues/638)
|
||||||
- import mermaid.css with ES6 + NPM [\#634](https://github.com/knsv/mermaid/issues/634)
|
- import mermaid.css with ES6 + NPM [\#634](https://github.com/knsv/mermaid/issues/634)
|
||||||
- Actor line cuts through other elements [\#633](https://github.com/knsv/mermaid/issues/633)
|
- Actor line cuts through other elements [\#633](https://github.com/knsv/mermaid/issues/633)
|
||||||
- Graph TD line out of the picture \(left side\) [\#630](https://github.com/knsv/mermaid/issues/630)
|
- Graph TD line out of the picture \(left side\) [\#630](https://github.com/knsv/mermaid/issues/630)
|
||||||
@@ -504,7 +504,7 @@ mermaid.run({
|
|||||||
|
|
||||||
- Docs css: code hard to read [\#324](https://github.com/knsv/mermaid/issues/324)
|
- Docs css: code hard to read [\#324](https://github.com/knsv/mermaid/issues/324)
|
||||||
- About Markpad integration [\#323](https://github.com/knsv/mermaid/issues/323)
|
- About Markpad integration [\#323](https://github.com/knsv/mermaid/issues/323)
|
||||||
- How to link backwards in flowchat? [\#321](https://github.com/knsv/mermaid/issues/321)
|
- How to link backwords in flowchat? [\#321](https://github.com/knsv/mermaid/issues/321)
|
||||||
- Help with editor [\#310](https://github.com/knsv/mermaid/issues/310)
|
- Help with editor [\#310](https://github.com/knsv/mermaid/issues/310)
|
||||||
- +1 [\#293](https://github.com/knsv/mermaid/issues/293)
|
- +1 [\#293](https://github.com/knsv/mermaid/issues/293)
|
||||||
- Basic chart does not render on Chome, but does in Firefox [\#290](https://github.com/knsv/mermaid/issues/290)
|
- Basic chart does not render on Chome, but does in Firefox [\#290](https://github.com/knsv/mermaid/issues/290)
|
||||||
@@ -619,7 +619,7 @@ mermaid.run({
|
|||||||
- render to png from the cli does not display the marker-end arrow heads [\#181](https://github.com/knsv/mermaid/issues/181)
|
- render to png from the cli does not display the marker-end arrow heads [\#181](https://github.com/knsv/mermaid/issues/181)
|
||||||
- Links in sequence diagrams [\#159](https://github.com/knsv/mermaid/issues/159)
|
- Links in sequence diagrams [\#159](https://github.com/knsv/mermaid/issues/159)
|
||||||
- comment characters `%%` cause parse error [\#141](https://github.com/knsv/mermaid/issues/141)
|
- comment characters `%%` cause parse error [\#141](https://github.com/knsv/mermaid/issues/141)
|
||||||
- Add a reversed asymmetric shape [\#124](https://github.com/knsv/mermaid/issues/124)
|
- Add a reversed assymetric shape [\#124](https://github.com/knsv/mermaid/issues/124)
|
||||||
- Add syntax for double headed arrows [\#123](https://github.com/knsv/mermaid/issues/123)
|
- Add syntax for double headed arrows [\#123](https://github.com/knsv/mermaid/issues/123)
|
||||||
- Support for font-awesome [\#49](https://github.com/knsv/mermaid/issues/49)
|
- Support for font-awesome [\#49](https://github.com/knsv/mermaid/issues/49)
|
||||||
|
|
||||||
@@ -659,7 +659,7 @@ mermaid.run({
|
|||||||
- Auto linewrap for notes in sequence diagrams [\#178](https://github.com/knsv/mermaid/issues/178)
|
- Auto linewrap for notes in sequence diagrams [\#178](https://github.com/knsv/mermaid/issues/178)
|
||||||
- Execute code after initialize [\#176](https://github.com/knsv/mermaid/issues/176)
|
- Execute code after initialize [\#176](https://github.com/knsv/mermaid/issues/176)
|
||||||
- Autoscaling for all diagram types [\#175](https://github.com/knsv/mermaid/issues/175)
|
- Autoscaling for all diagram types [\#175](https://github.com/knsv/mermaid/issues/175)
|
||||||
- Problem with click event callback [\#174](https://github.com/knsv/mermaid/issues/174)
|
- Problem wit click event callback [\#174](https://github.com/knsv/mermaid/issues/174)
|
||||||
- How to escape characters? [\#170](https://github.com/knsv/mermaid/issues/170)
|
- How to escape characters? [\#170](https://github.com/knsv/mermaid/issues/170)
|
||||||
- it can not work [\#167](https://github.com/knsv/mermaid/issues/167)
|
- it can not work [\#167](https://github.com/knsv/mermaid/issues/167)
|
||||||
- UML Class diagram [\#154](https://github.com/knsv/mermaid/issues/154)
|
- UML Class diagram [\#154](https://github.com/knsv/mermaid/issues/154)
|
||||||
@@ -762,7 +762,7 @@ mermaid.run({
|
|||||||
- subgraph background is black in rendered flowchart PNG via CLI [\#121](https://github.com/knsv/mermaid/issues/121)
|
- subgraph background is black in rendered flowchart PNG via CLI [\#121](https://github.com/knsv/mermaid/issues/121)
|
||||||
- Integrate editor at https://github.com/naseer/mermaid-webapp [\#110](https://github.com/knsv/mermaid/issues/110)
|
- Integrate editor at https://github.com/naseer/mermaid-webapp [\#110](https://github.com/knsv/mermaid/issues/110)
|
||||||
- Internet Explorer Support [\#99](https://github.com/knsv/mermaid/issues/99)
|
- Internet Explorer Support [\#99](https://github.com/knsv/mermaid/issues/99)
|
||||||
- Asymmetric shapes not documented [\#82](https://github.com/knsv/mermaid/issues/82)
|
- Assymetric shapes not documented [\#82](https://github.com/knsv/mermaid/issues/82)
|
||||||
- NoModificationAllowedError [\#23](https://github.com/knsv/mermaid/issues/23)
|
- NoModificationAllowedError [\#23](https://github.com/knsv/mermaid/issues/23)
|
||||||
- Improve arrows [\#3](https://github.com/knsv/mermaid/issues/3)
|
- Improve arrows [\#3](https://github.com/knsv/mermaid/issues/3)
|
||||||
|
|
||||||
@@ -908,7 +908,7 @@ mermaid.run({
|
|||||||
|
|
||||||
- Question marks don't render properly with /dist/mermaid.full.min.js [\#30](https://github.com/knsv/mermaid/issues/30)
|
- Question marks don't render properly with /dist/mermaid.full.min.js [\#30](https://github.com/knsv/mermaid/issues/30)
|
||||||
- Error with some characters [\#25](https://github.com/knsv/mermaid/issues/25)
|
- Error with some characters [\#25](https://github.com/knsv/mermaid/issues/25)
|
||||||
- Provide parse function in browser without `require`? [\#21](https://github.com/knsv/mermaid/issues/21)
|
- Provide parse function in browser widthout `require`? [\#21](https://github.com/knsv/mermaid/issues/21)
|
||||||
- Better label text support [\#18](https://github.com/knsv/mermaid/issues/18)
|
- Better label text support [\#18](https://github.com/knsv/mermaid/issues/18)
|
||||||
- Cap-cased words break parser [\#8](https://github.com/knsv/mermaid/issues/8)
|
- Cap-cased words break parser [\#8](https://github.com/knsv/mermaid/issues/8)
|
||||||
|
|
||||||
|
@@ -59,8 +59,8 @@ representative at an online or offline event.
|
|||||||
## Enforcement
|
## Enforcement
|
||||||
|
|
||||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
||||||
reported to the community leaders responsible for enforcement at <security@mermaid.live>.
|
reported to the community leaders responsible for enforcement at security@mermaid.live
|
||||||
|
.
|
||||||
All complaints will be reviewed and investigated promptly and fairly.
|
All complaints will be reviewed and investigated promptly and fairly.
|
||||||
|
|
||||||
All community leaders are obligated to respect the privacy and security of the
|
All community leaders are obligated to respect the privacy and security of the
|
||||||
|
@@ -26,14 +26,9 @@ Install required packages:
|
|||||||
```bash
|
```bash
|
||||||
# npx is required for first install as volta support for pnpm is not added yet.
|
# npx is required for first install as volta support for pnpm is not added yet.
|
||||||
npx pnpm install
|
npx pnpm install
|
||||||
pnpm test # run unit tests
|
pnpm test
|
||||||
pnpm dev # starts a dev server
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Open <http://localhost:9000> in your browser after starting the dev server.
|
|
||||||
You can also duplicate the `example.html` file in `demos/dev`, rename it and add your own mermaid code to it.
|
|
||||||
That will be served at <http://localhost:9000/dev/your-file-name.html>.
|
|
||||||
|
|
||||||
### Docker
|
### Docker
|
||||||
|
|
||||||
If you are using docker and docker-compose, you have self-documented `run` bash script, which is a convenient alias for docker-compose commands:
|
If you are using docker and docker-compose, you have self-documented `run` bash script, which is a convenient alias for docker-compose commands:
|
||||||
@@ -69,10 +64,8 @@ eg: `feature/2945_state-diagram-new-arrow-florbs`, `bug/1123_fix_random_ugly_red
|
|||||||
|
|
||||||
Documentation is necessary for all non bugfix/refactoring changes.
|
Documentation is necessary for all non bugfix/refactoring changes.
|
||||||
|
|
||||||
Only make changes to files that are in [`/packages/mermaid/src/docs`](packages/mermaid/src/docs)
|
Only make changes to files are in [`/packages/mermaid/src/docs`](packages/mermaid/src/docs)
|
||||||
|
|
||||||
**_DO NOT CHANGE FILES IN `/docs` MANUALLY_**
|
**_DO NOT CHANGE FILES IN `/docs`_**
|
||||||
|
|
||||||
The `/docs` folder will be rebuilt and committed as part of a pre-commit hook.
|
|
||||||
|
|
||||||
[Join our slack community if you want closer contact!](https://join.slack.com/t/mermaid-talk/shared_invite/enQtNzc4NDIyNzk4OTAyLWVhYjQxOTI2OTg4YmE1ZmJkY2Y4MTU3ODliYmIwOTY3NDJlYjA0YjIyZTdkMDMyZTUwOGI0NjEzYmEwODcwOTE)
|
[Join our slack community if you want closer contact!](https://join.slack.com/t/mermaid-talk/shared_invite/enQtNzc4NDIyNzk4OTAyLWVhYjQxOTI2OTg4YmE1ZmJkY2Y4MTU3ODliYmIwOTY3NDJlYjA0YjIyZTdkMDMyZTUwOGI0NjEzYmEwODcwOTE)
|
||||||
|
27
README.md
27
README.md
@@ -20,9 +20,6 @@ Generate diagrams from markdown-like text.
|
|||||||
<p align="center">
|
<p align="center">
|
||||||
<a href="./README.zh-CN.md">简体中文</a>
|
<a href="./README.zh-CN.md">简体中文</a>
|
||||||
</p>
|
</p>
|
||||||
<p align="center">
|
|
||||||
Try Live Editor previews of future releases: <a href="https://develop.git.mermaid.live/" title="Try the mermaid version from the develop branch.">Develop</a> | <a href="https://next.git.mermaid.live/" title="Try the mermaid version from the next branch.">Next</a>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
<br>
|
<br>
|
||||||
@@ -34,7 +31,7 @@ Try Live Editor previews of future releases: <a href="https://develop.git.mermai
|
|||||||
[](https://www.jsdelivr.com/package/npm/mermaid)
|
[](https://www.jsdelivr.com/package/npm/mermaid)
|
||||||
[](https://www.npmjs.com/package/mermaid)
|
[](https://www.npmjs.com/package/mermaid)
|
||||||
[](https://join.slack.com/t/mermaid-talk/shared_invite/enQtNzc4NDIyNzk4OTAyLWVhYjQxOTI2OTg4YmE1ZmJkY2Y4MTU3ODliYmIwOTY3NDJlYjA0YjIyZTdkMDMyZTUwOGI0NjEzYmEwODcwOTE)
|
[](https://join.slack.com/t/mermaid-talk/shared_invite/enQtNzc4NDIyNzk4OTAyLWVhYjQxOTI2OTg4YmE1ZmJkY2Y4MTU3ODliYmIwOTY3NDJlYjA0YjIyZTdkMDMyZTUwOGI0NjEzYmEwODcwOTE)
|
||||||
[](https://twitter.com/mermaidjs_)
|
[](https://twitter.com/mermaidjs_)
|
||||||
|
|
||||||
<img src="./img/header.png" alt="" />
|
<img src="./img/header.png" alt="" />
|
||||||
|
|
||||||
@@ -59,11 +56,11 @@ Mermaid addresses this problem by enabling users to create easily modifiable dia
|
|||||||
|
|
||||||
Mermaid allows even non-programmers to easily create detailed diagrams through the [Mermaid Live Editor](https://mermaid.live/).<br/>
|
Mermaid allows even non-programmers to easily create detailed diagrams through the [Mermaid Live Editor](https://mermaid.live/).<br/>
|
||||||
[Tutorials](./docs/config/Tutorials.md) has video tutorials.
|
[Tutorials](./docs/config/Tutorials.md) has video tutorials.
|
||||||
Use Mermaid with your favorite applications, check out the list of [Integrations and Usages of Mermaid](./docs/ecosystem/integrations-community.md).
|
Use Mermaid with your favorite applications, check out the list of [Integrations and Usages of Mermaid](./docs/ecosystem/integrations.md).
|
||||||
|
|
||||||
You can also use Mermaid within [GitHub](https://github.blog/2022-02-14-include-diagrams-markdown-files-mermaid/) as well many of your other favorite applications—check out the list of [Integrations and Usages of Mermaid](./docs/ecosystem/integrations-community.md).
|
You can also use Mermaid within [GitHub](https://github.blog/2022-02-14-include-diagrams-markdown-files-mermaid/) as well many of your other favorite applications—check out the list of [Integrations and Usages of Mermaid](./docs/ecosystem/integrations.md).
|
||||||
|
|
||||||
For a more detailed introduction to Mermaid and some of its more basic uses, look to the [Beginner's Guide](./docs/intro/getting-started.md), [Usage](./docs/config/usage.md) and [Tutorials](./docs/config/Tutorials.md).
|
For a more detailed introduction to Mermaid and some of its more basic uses, look to the [Beginner's Guide](./docs/community/n00b-overview.md), [Usage](./docs/config/usage.md) and [Tutorials](./docs/config/Tutorials.md).
|
||||||
|
|
||||||
In our release process we rely heavily on visual regression tests using [applitools](https://applitools.com/). Applitools is a great service which has been easy to use and integrate with our tests.
|
In our release process we rely heavily on visual regression tests using [applitools](https://applitools.com/). Applitools is a great service which has been easy to use and integrate with our tests.
|
||||||
|
|
||||||
@@ -168,7 +165,13 @@ class Class10 {
|
|||||||
int id
|
int id
|
||||||
size()
|
size()
|
||||||
}
|
}
|
||||||
|
namespace Namespace01 {
|
||||||
|
class Class11
|
||||||
|
class Class12 {
|
||||||
|
int id
|
||||||
|
size()
|
||||||
|
}
|
||||||
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
```mermaid
|
```mermaid
|
||||||
@@ -188,7 +191,13 @@ class Class10 {
|
|||||||
int id
|
int id
|
||||||
size()
|
size()
|
||||||
}
|
}
|
||||||
|
namespace Namespace01 {
|
||||||
|
class Class11
|
||||||
|
class Class12 {
|
||||||
|
int id
|
||||||
|
size()
|
||||||
|
}
|
||||||
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
### State diagram [<a href="https://mermaid-js.github.io/mermaid/#/stateDiagram">docs</a> - <a href="https://mermaid.live/edit#pako:eNpdkEFvgzAMhf8K8nEqpYSNthx22Xbcqcexg0sCiZQQlDhIFeK_L8A6TfXp6fOz9ewJGssFVOAJSbwr7ByadGR1n8T6evpO0vQ1uZDSekOrXGFsPqJPO6q-2-imH8f_0TeHXm50lfelsAMjnEHFY6xpMdRAUhhRQxUlFy0GTTXU_RytYeAx-AdXZB1ULWovdoCB7OXWN1CRC-Ju-r3uz6UtchGHJqDbsPygU57iysb2reoWHpyOWBINvsqypb3vFMlw3TfWZF5xiY7keC6zkpUnZIUojwW-FAVvrvn51LLnvOXHQ84Q5nn-AVtLcwk">live editor</a>]
|
### State diagram [<a href="https://mermaid-js.github.io/mermaid/#/stateDiagram">docs</a> - <a href="https://mermaid.live/edit#pako:eNpdkEFvgzAMhf8K8nEqpYSNthx22Xbcqcexg0sCiZQQlDhIFeK_L8A6TfXp6fOz9ewJGssFVOAJSbwr7ByadGR1n8T6evpO0vQ1uZDSekOrXGFsPqJPO6q-2-imH8f_0TeHXm50lfelsAMjnEHFY6xpMdRAUhhRQxUlFy0GTTXU_RytYeAx-AdXZB1ULWovdoCB7OXWN1CRC-Ju-r3uz6UtchGHJqDbsPygU57iysb2reoWHpyOWBINvsqypb3vFMlw3TfWZF5xiY7keC6zkpUnZIUojwW-FAVvrvn51LLnvOXHQ84Q5nn-AVtLcwk">live editor</a>]
|
||||||
|
@@ -12,7 +12,7 @@ Mermaid
|
|||||||
<p>
|
<p>
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<a href="https://mermaid.live/"><b>实时编辑器!</b></a>
|
<a href="https://mermaid.live/"><b>Live Editor!</b></a>
|
||||||
</p>
|
</p>
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<a href="https://mermaid.js.org">📖 文档</a> | <a href="https://mermaid.js.org/intro/">🚀 入门</a> | <a href="https://www.jsdelivr.com/package/npm/mermaid">🌐 CDN</a> | <a href="https://join.slack.com/t/mermaid-talk/shared_invite/enQtNzc4NDIyNzk4OTAyLWVhYjQxOTI2OTg4YmE1ZmJkY2Y4MTU3ODliYmIwOTY3NDJlYjA0YjIyZTdkMDMyZTUwOGI0NjEzYmEwODcwOTE" title="Slack invite">🙌 加入我们</a>
|
<a href="https://mermaid.js.org">📖 文档</a> | <a href="https://mermaid.js.org/intro/">🚀 入门</a> | <a href="https://www.jsdelivr.com/package/npm/mermaid">🌐 CDN</a> | <a href="https://join.slack.com/t/mermaid-talk/shared_invite/enQtNzc4NDIyNzk4OTAyLWVhYjQxOTI2OTg4YmE1ZmJkY2Y4MTU3ODliYmIwOTY3NDJlYjA0YjIyZTdkMDMyZTUwOGI0NjEzYmEwODcwOTE" title="Slack invite">🙌 加入我们</a>
|
||||||
@@ -21,10 +21,6 @@ Mermaid
|
|||||||
<a href="./README.md">English</a>
|
<a href="./README.md">English</a>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p align="center">
|
|
||||||
尝试未来版本的实时编辑器预览: <a href="https://develop.git.mermaid.live/" title="尝试来自develop分支的mermaid版本。">Develop</a> | <a href="https://next.git.mermaid.live/" title="尝试来自next分支的mermaid版本。">Next</a>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
@@ -35,7 +31,7 @@ Mermaid
|
|||||||
[](https://www.jsdelivr.com/package/npm/mermaid)
|
[](https://www.jsdelivr.com/package/npm/mermaid)
|
||||||
[](https://www.npmjs.com/package/mermaid)
|
[](https://www.npmjs.com/package/mermaid)
|
||||||
[](https://join.slack.com/t/mermaid-talk/shared_invite/enQtNzc4NDIyNzk4OTAyLWVhYjQxOTI2OTg4YmE1ZmJkY2Y4MTU3ODliYmIwOTY3NDJlYjA0YjIyZTdkMDMyZTUwOGI0NjEzYmEwODcwOTE)
|
[](https://join.slack.com/t/mermaid-talk/shared_invite/enQtNzc4NDIyNzk4OTAyLWVhYjQxOTI2OTg4YmE1ZmJkY2Y4MTU3ODliYmIwOTY3NDJlYjA0YjIyZTdkMDMyZTUwOGI0NjEzYmEwODcwOTE)
|
||||||
[](https://twitter.com/mermaidjs_)
|
[](https://twitter.com/mermaidjs_)
|
||||||
|
|
||||||
<img src="./img/header.png" alt="" />
|
<img src="./img/header.png" alt="" />
|
||||||
|
|
||||||
@@ -57,9 +53,9 @@ Mermaid 是一个基于 Javascript 的图表绘制工具,通过解析类 Markd
|
|||||||
Mermaid 通过允许用户创建便于修改的图表来解决这一难题,它也可以作为生产脚本(或其他代码)的一部分。<br/>
|
Mermaid 通过允许用户创建便于修改的图表来解决这一难题,它也可以作为生产脚本(或其他代码)的一部分。<br/>
|
||||||
<br/>
|
<br/>
|
||||||
Mermaid 甚至能让非程序员也能通过 [Mermaid Live Editor](https://mermaid.live/) 轻松创建详细的图表。<br/>
|
Mermaid 甚至能让非程序员也能通过 [Mermaid Live Editor](https://mermaid.live/) 轻松创建详细的图表。<br/>
|
||||||
你可以访问 [教程](./docs/config/Tutorials.md) 来查看 Live Editor 的视频教程,也可以查看 [Mermaid 的集成和使用](./docs/ecosystem/integrations-community.md) 这个清单来检查你的文档工具是否已经集成了 Mermaid 支持。
|
你可以访问 [教程](./docs/config/Tutorials.md) 来查看 Live Editor 的视频教程,也可以查看 [Mermaid 的集成和使用](./docs/ecosystem/integrations.md) 这个清单来检查你的文档工具是否已经集成了 Mermaid 支持。
|
||||||
|
|
||||||
如果想要查看关于 Mermaid 更详细的介绍及基础使用方式,可以查看 [入门指引](./docs/intro/getting-started.md), [用法](./docs/config/usage.md) 和 [教程](./docs/config/Tutorials.md).
|
如果想要查看关于 Mermaid 更详细的介绍及基础使用方式,可以查看 [入门指引](./docs/community/n00b-overview.md), [用法](./docs/config/usage.md) 和 [教程](./docs/config/Tutorials.md).
|
||||||
|
|
||||||
<!-- </Main description> -->
|
<!-- </Main description> -->
|
||||||
|
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* Mocked Sankey diagram renderer
|
* Mocked pie (picChart) diagram renderer
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { vi } from 'vitest';
|
import { vi } from 'vitest';
|
@@ -1,8 +0,0 @@
|
|||||||
/**
|
|
||||||
* Mocked pie (picChart) diagram renderer
|
|
||||||
*/
|
|
||||||
import { vi } from 'vitest';
|
|
||||||
|
|
||||||
const draw = vi.fn().mockImplementation(() => '');
|
|
||||||
|
|
||||||
export const renderer = { draw };
|
|
19
cSpell.json
19
cSpell.json
@@ -22,7 +22,6 @@
|
|||||||
"brkt",
|
"brkt",
|
||||||
"brolin",
|
"brolin",
|
||||||
"brotli",
|
"brotli",
|
||||||
"catmull",
|
|
||||||
"città",
|
"città",
|
||||||
"classdef",
|
"classdef",
|
||||||
"codedoc",
|
"codedoc",
|
||||||
@@ -39,16 +38,12 @@
|
|||||||
"docsy",
|
"docsy",
|
||||||
"doku",
|
"doku",
|
||||||
"dompurify",
|
"dompurify",
|
||||||
"dont",
|
|
||||||
"doublecircle",
|
|
||||||
"edgechromium",
|
"edgechromium",
|
||||||
"elems",
|
|
||||||
"elkjs",
|
"elkjs",
|
||||||
"elle",
|
"elle",
|
||||||
"faber",
|
"faber",
|
||||||
"flatmap",
|
"flatmap",
|
||||||
"foswiki",
|
"foswiki",
|
||||||
"frontmatter",
|
|
||||||
"ftplugin",
|
"ftplugin",
|
||||||
"gantt",
|
"gantt",
|
||||||
"gitea",
|
"gitea",
|
||||||
@@ -94,9 +89,6 @@
|
|||||||
"mult",
|
"mult",
|
||||||
"neurodiverse",
|
"neurodiverse",
|
||||||
"nextra",
|
"nextra",
|
||||||
"nikolay",
|
|
||||||
"nirname",
|
|
||||||
"npmjs",
|
|
||||||
"orlandoni",
|
"orlandoni",
|
||||||
"pathe",
|
"pathe",
|
||||||
"pbrolin",
|
"pbrolin",
|
||||||
@@ -110,14 +102,10 @@
|
|||||||
"ranksep",
|
"ranksep",
|
||||||
"rect",
|
"rect",
|
||||||
"rects",
|
"rects",
|
||||||
"reda",
|
|
||||||
"redmine",
|
"redmine",
|
||||||
"regexes",
|
|
||||||
"rehype",
|
"rehype",
|
||||||
"roledescription",
|
"roledescription",
|
||||||
"rozhkov",
|
|
||||||
"sandboxed",
|
"sandboxed",
|
||||||
"sankey",
|
|
||||||
"setupgraphviewbox",
|
"setupgraphviewbox",
|
||||||
"shiki",
|
"shiki",
|
||||||
"sidharth",
|
"sidharth",
|
||||||
@@ -132,7 +120,6 @@
|
|||||||
"stylis",
|
"stylis",
|
||||||
"subhash-halder",
|
"subhash-halder",
|
||||||
"substate",
|
"substate",
|
||||||
"sulais",
|
|
||||||
"sveidqvist",
|
"sveidqvist",
|
||||||
"swimm",
|
"swimm",
|
||||||
"techn",
|
"techn",
|
||||||
@@ -143,7 +130,6 @@
|
|||||||
"tsdoc",
|
"tsdoc",
|
||||||
"tuleap",
|
"tuleap",
|
||||||
"tylerlong",
|
"tylerlong",
|
||||||
"typora",
|
|
||||||
"ugge",
|
"ugge",
|
||||||
"unist",
|
"unist",
|
||||||
"unocss",
|
"unocss",
|
||||||
@@ -156,11 +142,8 @@
|
|||||||
"vitepress",
|
"vitepress",
|
||||||
"vueuse",
|
"vueuse",
|
||||||
"xlink",
|
"xlink",
|
||||||
"xychart",
|
|
||||||
"yash",
|
"yash",
|
||||||
"yokozuna",
|
"zenuml"
|
||||||
"zenuml",
|
|
||||||
"zune"
|
|
||||||
],
|
],
|
||||||
"patterns": [
|
"patterns": [
|
||||||
{ "name": "Markdown links", "pattern": "\\((.*)\\)", "description": "" },
|
{ "name": "Markdown links", "pattern": "\\((.*)\\)", "description": "" },
|
||||||
|
@@ -1,6 +1,3 @@
|
|||||||
codecov:
|
|
||||||
branch: develop
|
|
||||||
|
|
||||||
comment:
|
comment:
|
||||||
layout: 'reach, diff, flags, files'
|
layout: 'reach, diff, flags, files'
|
||||||
behavior: default
|
behavior: default
|
||||||
@@ -11,7 +8,5 @@ comment:
|
|||||||
coverage:
|
coverage:
|
||||||
status:
|
status:
|
||||||
project:
|
project:
|
||||||
off
|
default:
|
||||||
# Turing off for now as code coverage isn't stable and causes unnecessary build failures.
|
threshold: 1%
|
||||||
# default:
|
|
||||||
# threshold: 2%
|
|
93
cypress/helpers/util.js
Normal file
93
cypress/helpers/util.js
Normal file
@@ -0,0 +1,93 @@
|
|||||||
|
const utf8ToB64 = (str) => {
|
||||||
|
return window.btoa(unescape(encodeURIComponent(str)));
|
||||||
|
};
|
||||||
|
|
||||||
|
const batchId = 'mermaid-batch' + new Date().getTime();
|
||||||
|
|
||||||
|
export const mermaidUrl = (graphStr, options, api) => {
|
||||||
|
const obj = {
|
||||||
|
code: graphStr,
|
||||||
|
mermaid: options,
|
||||||
|
};
|
||||||
|
const objStr = JSON.stringify(obj);
|
||||||
|
let url = 'http://localhost:9000/e2e.html?graph=' + utf8ToB64(objStr);
|
||||||
|
if (api) {
|
||||||
|
url = 'http://localhost:9000/xss.html?graph=' + graphStr;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (options.listUrl) {
|
||||||
|
cy.log(options.listId, ' ', url);
|
||||||
|
}
|
||||||
|
|
||||||
|
return url;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const imgSnapshotTest = (graphStr, _options = {}, api = false, validation = undefined) => {
|
||||||
|
cy.log(_options);
|
||||||
|
const options = Object.assign(_options);
|
||||||
|
if (!options.fontFamily) {
|
||||||
|
options.fontFamily = 'courier';
|
||||||
|
}
|
||||||
|
if (!options.sequence) {
|
||||||
|
options.sequence = {};
|
||||||
|
}
|
||||||
|
if (!options.sequence || (options.sequence && !options.sequence.actorFontFamily)) {
|
||||||
|
options.sequence.actorFontFamily = 'courier';
|
||||||
|
}
|
||||||
|
if (options.sequence && !options.sequence.noteFontFamily) {
|
||||||
|
options.sequence.noteFontFamily = 'courier';
|
||||||
|
}
|
||||||
|
options.sequence.actorFontFamily = 'courier';
|
||||||
|
options.sequence.noteFontFamily = 'courier';
|
||||||
|
options.sequence.messageFontFamily = 'courier';
|
||||||
|
if (options.sequence && !options.sequence.actorFontFamily) {
|
||||||
|
options.sequence.actorFontFamily = 'courier';
|
||||||
|
}
|
||||||
|
if (!options.fontSize) {
|
||||||
|
options.fontSize = '16px';
|
||||||
|
}
|
||||||
|
const url = mermaidUrl(graphStr, options, api);
|
||||||
|
openURLAndVerifyRendering(url, options, validation);
|
||||||
|
};
|
||||||
|
|
||||||
|
export const urlSnapshotTest = (url, _options, api = false, validation) => {
|
||||||
|
const options = Object.assign(_options);
|
||||||
|
openURLAndVerifyRendering(url, options, validation);
|
||||||
|
};
|
||||||
|
|
||||||
|
export const renderGraph = (graphStr, options, api) => {
|
||||||
|
const url = mermaidUrl(graphStr, options, api);
|
||||||
|
openURLAndVerifyRendering(url, options);
|
||||||
|
};
|
||||||
|
|
||||||
|
export const openURLAndVerifyRendering = (url, options, validation = undefined) => {
|
||||||
|
const useAppli = Cypress.env('useAppli');
|
||||||
|
const name = (options.name || cy.state('runnable').fullTitle()).replace(/\s+/g, '-');
|
||||||
|
|
||||||
|
if (useAppli) {
|
||||||
|
cy.log('Opening eyes ' + Cypress.spec.name + ' --- ' + name);
|
||||||
|
cy.eyesOpen({
|
||||||
|
appName: 'Mermaid',
|
||||||
|
testName: name,
|
||||||
|
batchName: Cypress.spec.name,
|
||||||
|
batchId: batchId + Cypress.spec.name,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
cy.visit(url);
|
||||||
|
cy.window().should('have.property', 'rendered', true);
|
||||||
|
cy.get('svg').should('be.visible');
|
||||||
|
|
||||||
|
if (validation) {
|
||||||
|
cy.get('svg').should(validation);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (useAppli) {
|
||||||
|
cy.log('Check eyes' + Cypress.spec.name);
|
||||||
|
cy.eyesCheckWindow('Click!');
|
||||||
|
cy.log('Closing eyes' + Cypress.spec.name);
|
||||||
|
cy.eyesClose();
|
||||||
|
} else {
|
||||||
|
cy.matchImageSnapshot(name);
|
||||||
|
}
|
||||||
|
};
|
@@ -1,127 +0,0 @@
|
|||||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
||||||
import { Buffer } from 'buffer';
|
|
||||||
import type { MermaidConfig } from '../../packages/mermaid/src/config.type.js';
|
|
||||||
|
|
||||||
interface CypressConfig {
|
|
||||||
listUrl?: boolean;
|
|
||||||
listId?: string;
|
|
||||||
name?: string;
|
|
||||||
}
|
|
||||||
type CypressMermaidConfig = MermaidConfig & CypressConfig;
|
|
||||||
|
|
||||||
interface CodeObject {
|
|
||||||
code: string;
|
|
||||||
mermaid: CypressMermaidConfig;
|
|
||||||
}
|
|
||||||
|
|
||||||
const utf8ToB64 = (str: string): string => {
|
|
||||||
return Buffer.from(decodeURIComponent(encodeURIComponent(str))).toString('base64');
|
|
||||||
};
|
|
||||||
|
|
||||||
const batchId: string =
|
|
||||||
'mermaid-batch-' +
|
|
||||||
(Cypress.env('useAppli')
|
|
||||||
? Date.now().toString()
|
|
||||||
: Cypress.env('CYPRESS_COMMIT') || Date.now().toString());
|
|
||||||
|
|
||||||
export const mermaidUrl = (
|
|
||||||
graphStr: string,
|
|
||||||
options: CypressMermaidConfig,
|
|
||||||
api: boolean
|
|
||||||
): string => {
|
|
||||||
const codeObject: CodeObject = {
|
|
||||||
code: graphStr,
|
|
||||||
mermaid: options,
|
|
||||||
};
|
|
||||||
const objStr: string = JSON.stringify(codeObject);
|
|
||||||
let url = `http://localhost:9000/e2e.html?graph=${utf8ToB64(objStr)}`;
|
|
||||||
if (api) {
|
|
||||||
url = `http://localhost:9000/xss.html?graph=${graphStr}`;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (options.listUrl) {
|
|
||||||
cy.log(options.listId, ' ', url);
|
|
||||||
}
|
|
||||||
|
|
||||||
return url;
|
|
||||||
};
|
|
||||||
|
|
||||||
export const imgSnapshotTest = (
|
|
||||||
graphStr: string,
|
|
||||||
_options: CypressMermaidConfig = {},
|
|
||||||
api = false,
|
|
||||||
validation?: any
|
|
||||||
): void => {
|
|
||||||
const options: CypressMermaidConfig = {
|
|
||||||
..._options,
|
|
||||||
fontFamily: _options.fontFamily || 'courier',
|
|
||||||
// @ts-ignore TODO: Fix type of fontSize
|
|
||||||
fontSize: _options.fontSize || '16px',
|
|
||||||
sequence: {
|
|
||||||
...(_options.sequence || {}),
|
|
||||||
actorFontFamily: 'courier',
|
|
||||||
noteFontFamily:
|
|
||||||
_options.sequence && _options.sequence.noteFontFamily
|
|
||||||
? _options.sequence.noteFontFamily
|
|
||||||
: 'courier',
|
|
||||||
messageFontFamily: 'courier',
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
const url: string = mermaidUrl(graphStr, options, api);
|
|
||||||
openURLAndVerifyRendering(url, options, validation);
|
|
||||||
};
|
|
||||||
|
|
||||||
export const urlSnapshotTest = (
|
|
||||||
url: string,
|
|
||||||
options: CypressMermaidConfig,
|
|
||||||
_api = false,
|
|
||||||
validation?: any
|
|
||||||
): void => {
|
|
||||||
openURLAndVerifyRendering(url, options, validation);
|
|
||||||
};
|
|
||||||
|
|
||||||
export const renderGraph = (
|
|
||||||
graphStr: string,
|
|
||||||
options: CypressMermaidConfig = {},
|
|
||||||
api = false
|
|
||||||
): void => {
|
|
||||||
const url: string = mermaidUrl(graphStr, options, api);
|
|
||||||
openURLAndVerifyRendering(url, options);
|
|
||||||
};
|
|
||||||
|
|
||||||
export const openURLAndVerifyRendering = (
|
|
||||||
url: string,
|
|
||||||
options: CypressMermaidConfig,
|
|
||||||
validation?: any
|
|
||||||
): void => {
|
|
||||||
const useAppli: boolean = Cypress.env('useAppli');
|
|
||||||
const name: string = (options.name || cy.state('runnable').fullTitle()).replace(/\s+/g, '-');
|
|
||||||
|
|
||||||
if (useAppli) {
|
|
||||||
cy.log(`Opening eyes ${Cypress.spec.name} --- ${name}`);
|
|
||||||
cy.eyesOpen({
|
|
||||||
appName: 'Mermaid',
|
|
||||||
testName: name,
|
|
||||||
batchName: Cypress.spec.name,
|
|
||||||
batchId: batchId + Cypress.spec.name,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
cy.visit(url);
|
|
||||||
cy.window().should('have.property', 'rendered', true);
|
|
||||||
cy.get('svg').should('be.visible');
|
|
||||||
|
|
||||||
if (validation) {
|
|
||||||
cy.get('svg').should(validation);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (useAppli) {
|
|
||||||
cy.log(`Check eyes ${Cypress.spec.name}`);
|
|
||||||
cy.eyesCheckWindow('Click!');
|
|
||||||
cy.log(`Closing eyes ${Cypress.spec.name}`);
|
|
||||||
cy.eyesClose();
|
|
||||||
} else {
|
|
||||||
cy.matchImageSnapshot(name);
|
|
||||||
}
|
|
||||||
};
|
|
@@ -1,4 +1,4 @@
|
|||||||
import { renderGraph } from '../../helpers/util.ts';
|
import { renderGraph } from '../../helpers/util.js';
|
||||||
describe('Configuration', () => {
|
describe('Configuration', () => {
|
||||||
describe('arrowMarkerAbsolute', () => {
|
describe('arrowMarkerAbsolute', () => {
|
||||||
it('should handle default value false of arrowMarkerAbsolute', () => {
|
it('should handle default value false of arrowMarkerAbsolute', () => {
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { urlSnapshotTest } from '../../helpers/util.ts';
|
import { urlSnapshotTest } from '../../helpers/util.js';
|
||||||
|
|
||||||
describe('mermaid', () => {
|
describe('mermaid', () => {
|
||||||
describe('registerDiagram', () => {
|
describe('registerDiagram', () => {
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { urlSnapshotTest, openURLAndVerifyRendering } from '../../helpers/util.ts';
|
import { urlSnapshotTest, openURLAndVerifyRendering } from '../../helpers/util.js';
|
||||||
|
|
||||||
describe('CSS injections', () => {
|
describe('CSS injections', () => {
|
||||||
it('should not allow CSS injections outside of the diagram', () => {
|
it('should not allow CSS injections outside of the diagram', () => {
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { mermaidUrl } from '../../helpers/util.ts';
|
import { mermaidUrl } from '../../helpers/util.js';
|
||||||
describe('XSS', () => {
|
describe('XSS', () => {
|
||||||
it('should handle xss in tags', () => {
|
it('should handle xss in tags', () => {
|
||||||
const str =
|
const str =
|
||||||
@@ -132,9 +132,4 @@ describe('XSS', () => {
|
|||||||
cy.wait(1000);
|
cy.wait(1000);
|
||||||
cy.get('#the-malware').should('not.exist');
|
cy.get('#the-malware').should('not.exist');
|
||||||
});
|
});
|
||||||
it('should sanitize backticks in class names properly', () => {
|
|
||||||
cy.visit('http://localhost:9000/xss24.html');
|
|
||||||
cy.wait(1000);
|
|
||||||
cy.get('#the-malware').should('not.exist');
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { imgSnapshotTest } from '../../helpers/util.ts';
|
import { imgSnapshotTest } from '../../helpers/util.js';
|
||||||
|
|
||||||
describe('Git Graph diagram', () => {
|
describe('Git Graph diagram', () => {
|
||||||
it('1: should render a simple gitgraph with commit on main branch', () => {
|
it('1: should render a simple gitgraph with commit on main branch', () => {
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { imgSnapshotTest, renderGraph } from '../../helpers/util.ts';
|
import { imgSnapshotTest, renderGraph } from '../../helpers/util.js';
|
||||||
|
|
||||||
describe('C4 diagram', () => {
|
describe('C4 diagram', () => {
|
||||||
it('should render a simple C4Context diagram', () => {
|
it('should render a simple C4Context diagram', () => {
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { imgSnapshotTest } from '../../helpers/util.ts';
|
import { imgSnapshotTest } from '../../helpers/util.js';
|
||||||
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(
|
||||||
@@ -386,6 +386,30 @@ describe('Class diagram V2', () => {
|
|||||||
{ logLevel: 1, flowchart: { htmlLabels: false } }
|
{ logLevel: 1, flowchart: { htmlLabels: false } }
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('18: should handle the direction statement 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 } }
|
||||||
|
);
|
||||||
|
});
|
||||||
it('17a: should handle the direction statement with BT', () => {
|
it('17a: should handle the direction statement with BT', () => {
|
||||||
imgSnapshotTest(
|
imgSnapshotTest(
|
||||||
`
|
`
|
||||||
@@ -433,31 +457,7 @@ describe('Class diagram V2', () => {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('18a: should handle the direction statement with LR', () => {
|
it('18: should render a simple class diagram with notes', () => {
|
||||||
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 } }
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('18b: should render a simple class diagram with notes', () => {
|
|
||||||
imgSnapshotTest(
|
imgSnapshotTest(
|
||||||
`
|
`
|
||||||
classDiagram-v2
|
classDiagram-v2
|
||||||
@@ -562,13 +562,4 @@ class C13["With Città foreign language"]
|
|||||||
`
|
`
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
it('should render a simple class diagram with no members', () => {
|
|
||||||
imgSnapshotTest(
|
|
||||||
`
|
|
||||||
classDiagram-v2
|
|
||||||
class Class10
|
|
||||||
`,
|
|
||||||
{ logLevel: 1, flowchart: { htmlLabels: false } }
|
|
||||||
);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { imgSnapshotTest, renderGraph } from '../../helpers/util.ts';
|
import { imgSnapshotTest, renderGraph } from '../../helpers/util.js';
|
||||||
|
|
||||||
describe('Class diagram', () => {
|
describe('Class diagram', () => {
|
||||||
it('1: should render a simple class diagram', () => {
|
it('1: should render a simple class diagram', () => {
|
||||||
@@ -423,82 +423,4 @@ describe('Class diagram', () => {
|
|||||||
);
|
);
|
||||||
cy.get('svg');
|
cy.get('svg');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should render class diagram with newlines in title', () => {
|
|
||||||
imgSnapshotTest(`
|
|
||||||
classDiagram
|
|
||||||
Animal <|-- \`Du\nck\`
|
|
||||||
Animal : +int age
|
|
||||||
Animal : +String gender
|
|
||||||
Animal: +isMammal()
|
|
||||||
Animal: +mate()
|
|
||||||
class \`Du\nck\` {
|
|
||||||
+String beakColor
|
|
||||||
+String featherColor
|
|
||||||
+swim()
|
|
||||||
+quack()
|
|
||||||
}
|
|
||||||
`);
|
|
||||||
cy.get('svg');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should render class diagram with many newlines in title', () => {
|
|
||||||
imgSnapshotTest(`
|
|
||||||
classDiagram
|
|
||||||
class \`This\nTitle\nHas\nMany\nNewlines\` {
|
|
||||||
+String Also
|
|
||||||
-Stirng Many
|
|
||||||
#int Members
|
|
||||||
+And()
|
|
||||||
-Many()
|
|
||||||
#Methods()
|
|
||||||
}
|
|
||||||
`);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should render with newlines in title and an annotation', () => {
|
|
||||||
imgSnapshotTest(`
|
|
||||||
classDiagram
|
|
||||||
class \`This\nTitle\nHas\nMany\nNewlines\` {
|
|
||||||
+String Also
|
|
||||||
-Stirng Many
|
|
||||||
#int Members
|
|
||||||
+And()
|
|
||||||
-Many()
|
|
||||||
#Methods()
|
|
||||||
}
|
|
||||||
<<Interface>> \`This\nTitle\nHas\nMany\nNewlines\`
|
|
||||||
`);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should handle newline title in namespace', () => {
|
|
||||||
imgSnapshotTest(`
|
|
||||||
classDiagram
|
|
||||||
namespace testingNamespace {
|
|
||||||
class \`This\nTitle\nHas\nMany\nNewlines\` {
|
|
||||||
+String Also
|
|
||||||
-Stirng Many
|
|
||||||
#int Members
|
|
||||||
+And()
|
|
||||||
-Many()
|
|
||||||
#Methods()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
`);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should handle newline in string label', () => {
|
|
||||||
imgSnapshotTest(`
|
|
||||||
classDiagram
|
|
||||||
class A["This has\na newline!"] {
|
|
||||||
+String boop
|
|
||||||
-Int beep
|
|
||||||
#double bop
|
|
||||||
}
|
|
||||||
|
|
||||||
class B["This title also has\na newline"]
|
|
||||||
B : +with(more)
|
|
||||||
B : -methods()
|
|
||||||
`);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { imgSnapshotTest, urlSnapshotTest } from '../../helpers/util.ts';
|
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', () => {
|
||||||
@@ -14,6 +14,7 @@ describe('Configuration and directives - nodes should be light blue', () => {
|
|||||||
`,
|
`,
|
||||||
{}
|
{}
|
||||||
);
|
);
|
||||||
|
cy.get('svg');
|
||||||
});
|
});
|
||||||
it('Settings from initialize - nodes should be green', () => {
|
it('Settings from initialize - nodes should be green', () => {
|
||||||
imgSnapshotTest(
|
imgSnapshotTest(
|
||||||
@@ -27,6 +28,7 @@ graph TD
|
|||||||
end `,
|
end `,
|
||||||
{ theme: 'forest' }
|
{ theme: 'forest' }
|
||||||
);
|
);
|
||||||
|
cy.get('svg');
|
||||||
});
|
});
|
||||||
it('Settings from initialize overriding themeVariable - nodes should be red', () => {
|
it('Settings from initialize overriding themeVariable - nodes should be red', () => {
|
||||||
imgSnapshotTest(
|
imgSnapshotTest(
|
||||||
@@ -44,6 +46,7 @@ graph TD
|
|||||||
`,
|
`,
|
||||||
{ theme: 'base', themeVariables: { primaryColor: '#ff0000' }, logLevel: 0 }
|
{ theme: 'base', themeVariables: { primaryColor: '#ff0000' }, logLevel: 0 }
|
||||||
);
|
);
|
||||||
|
cy.get('svg');
|
||||||
});
|
});
|
||||||
it('Settings from directive - nodes should be grey', () => {
|
it('Settings from directive - nodes should be grey', () => {
|
||||||
imgSnapshotTest(
|
imgSnapshotTest(
|
||||||
@@ -59,24 +62,7 @@ graph TD
|
|||||||
`,
|
`,
|
||||||
{}
|
{}
|
||||||
);
|
);
|
||||||
});
|
cy.get('svg');
|
||||||
it('Settings from frontmatter - nodes should be grey', () => {
|
|
||||||
imgSnapshotTest(
|
|
||||||
`
|
|
||||||
---
|
|
||||||
config:
|
|
||||||
theme: neutral
|
|
||||||
---
|
|
||||||
graph TD
|
|
||||||
A(Start) --> B[/Another/]
|
|
||||||
A[/Another/] --> C[End]
|
|
||||||
subgraph section
|
|
||||||
B
|
|
||||||
C
|
|
||||||
end
|
|
||||||
`,
|
|
||||||
{}
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Settings from directive overriding theme variable - nodes should be red', () => {
|
it('Settings from directive overriding theme variable - nodes should be red', () => {
|
||||||
@@ -93,6 +79,7 @@ graph TD
|
|||||||
`,
|
`,
|
||||||
{}
|
{}
|
||||||
);
|
);
|
||||||
|
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(
|
||||||
@@ -108,6 +95,7 @@ graph TD
|
|||||||
`,
|
`,
|
||||||
{ theme: 'forest' }
|
{ theme: 'forest' }
|
||||||
);
|
);
|
||||||
|
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(
|
||||||
@@ -123,71 +111,8 @@ graph TD
|
|||||||
`,
|
`,
|
||||||
{ theme: 'base' }
|
{ theme: 'base' }
|
||||||
);
|
);
|
||||||
|
cy.get('svg');
|
||||||
});
|
});
|
||||||
it('Theme from initialize, frontmatter overriding theme variable - nodes should be red', () => {
|
|
||||||
imgSnapshotTest(
|
|
||||||
`
|
|
||||||
---
|
|
||||||
config:
|
|
||||||
theme: base
|
|
||||||
themeVariables:
|
|
||||||
primaryColor: '#ff0000'
|
|
||||||
---
|
|
||||||
graph TD
|
|
||||||
A(Start) --> B[/Another/]
|
|
||||||
A[/Another/] --> C[End]
|
|
||||||
subgraph section
|
|
||||||
B
|
|
||||||
C
|
|
||||||
end
|
|
||||||
`,
|
|
||||||
{ theme: 'forest' }
|
|
||||||
);
|
|
||||||
});
|
|
||||||
it('Theme from initialize, frontmatter overriding theme variable, directive overriding primaryColor - nodes should be red', () => {
|
|
||||||
imgSnapshotTest(
|
|
||||||
`
|
|
||||||
---
|
|
||||||
config:
|
|
||||||
theme: base
|
|
||||||
themeVariables:
|
|
||||||
primaryColor: '#00ff00'
|
|
||||||
---
|
|
||||||
%%{init: {'theme': 'base', 'themeVariables':{ 'primaryColor': '#ff0000'}}}%%
|
|
||||||
graph TD
|
|
||||||
A(Start) --> B[/Another/]
|
|
||||||
A[/Another/] --> C[End]
|
|
||||||
subgraph section
|
|
||||||
B
|
|
||||||
C
|
|
||||||
end
|
|
||||||
`,
|
|
||||||
{ theme: 'forest' }
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should render if values are not quoted properly', () => {
|
|
||||||
// #ff0000 is not quoted properly, and will evaluate to null.
|
|
||||||
// This test ensures that the rendering still works.
|
|
||||||
imgSnapshotTest(
|
|
||||||
`---
|
|
||||||
config:
|
|
||||||
theme: base
|
|
||||||
themeVariables:
|
|
||||||
primaryColor: #ff0000
|
|
||||||
---
|
|
||||||
graph TD
|
|
||||||
A(Start) --> B[/Another/]
|
|
||||||
A[/Another/] --> C[End]
|
|
||||||
subgraph section
|
|
||||||
B
|
|
||||||
C
|
|
||||||
end
|
|
||||||
`,
|
|
||||||
{ theme: 'forest' }
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
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(
|
||||||
`
|
`
|
||||||
@@ -202,11 +127,14 @@ graph TD
|
|||||||
`,
|
`,
|
||||||
{ themeVariables: { primaryColor: '#ff0000' } }
|
{ themeVariables: { primaryColor: '#ff0000' } }
|
||||||
);
|
);
|
||||||
|
cy.get('svg');
|
||||||
});
|
});
|
||||||
describe('when rendering several diagrams', () => {
|
describe('when rendering several diagrams', () => {
|
||||||
it('diagrams should not taint later diagrams', () => {
|
it('diagrams should not taint later diagrams', () => {
|
||||||
const url = 'http://localhost:9000/theme-directives.html';
|
const url = 'http://localhost:9000/theme-directives.html';
|
||||||
urlSnapshotTest(url, {});
|
cy.visit(url);
|
||||||
|
cy.get('svg');
|
||||||
|
cy.matchImageSnapshot('conf-and-directives.spec-when-rendering-several-diagrams-diagram-1');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { imgSnapshotTest } from '../../helpers/util.ts';
|
import { imgSnapshotTest } from '../../helpers/util.js';
|
||||||
|
|
||||||
describe('Current diagram', () => {
|
describe('Current diagram', () => {
|
||||||
it('should render a state with states in it', () => {
|
it('should render a state with states in it', () => {
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { imgSnapshotTest } from '../../helpers/util.ts';
|
import { imgSnapshotTest } from '../../helpers/util.js';
|
||||||
|
|
||||||
describe('Flowchart', () => {
|
describe('Flowchart', () => {
|
||||||
it('34: testing the label width in percy', () => {
|
it('34: testing the label width in percy', () => {
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { imgSnapshotTest, renderGraph } from '../../helpers/util.ts';
|
import { imgSnapshotTest, renderGraph } from '../../helpers/util.js';
|
||||||
|
|
||||||
describe('Entity Relationship Diagram', () => {
|
describe('Entity Relationship Diagram', () => {
|
||||||
it('should render a simple ER diagram', () => {
|
it('should render a simple ER diagram', () => {
|
||||||
@@ -200,27 +200,6 @@ describe('Entity Relationship Diagram', () => {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should render entities with attributes that begin with asterisk', () => {
|
|
||||||
imgSnapshotTest(
|
|
||||||
`
|
|
||||||
erDiagram
|
|
||||||
BOOK {
|
|
||||||
int *id
|
|
||||||
string name
|
|
||||||
varchar(99) summary
|
|
||||||
}
|
|
||||||
BOOK }o..o{ STORE : soldBy
|
|
||||||
STORE {
|
|
||||||
int *id
|
|
||||||
string name
|
|
||||||
varchar(50) address
|
|
||||||
}
|
|
||||||
`,
|
|
||||||
{ loglevel: 1 }
|
|
||||||
);
|
|
||||||
cy.get('svg');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should render entities with keys', () => {
|
it('should render entities with keys', () => {
|
||||||
renderGraph(
|
renderGraph(
|
||||||
`
|
`
|
||||||
@@ -305,21 +284,4 @@ ORDER ||--|{ LINE-ITEM : contains
|
|||||||
{}
|
{}
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should render entities with entity name aliases', () => {
|
|
||||||
imgSnapshotTest(
|
|
||||||
`
|
|
||||||
erDiagram
|
|
||||||
p[Person] {
|
|
||||||
varchar(64) firstName
|
|
||||||
varchar(64) lastName
|
|
||||||
}
|
|
||||||
c["Customer Account"] {
|
|
||||||
varchar(128) email
|
|
||||||
}
|
|
||||||
p ||--o| c : has
|
|
||||||
`,
|
|
||||||
{ logLevel: 1 }
|
|
||||||
);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { imgSnapshotTest, renderGraph } from '../../helpers/util.ts';
|
import { imgSnapshotTest, renderGraph } from '../../helpers/util.js';
|
||||||
|
|
||||||
describe.skip('Flowchart ELK', () => {
|
describe.skip('Flowchart ELK', () => {
|
||||||
it('1-elk: should render a simple flowchart', () => {
|
it('1-elk: should render a simple flowchart', () => {
|
||||||
@@ -681,7 +681,7 @@ title: Simple flowchart
|
|||||||
flowchart-elk TD
|
flowchart-elk TD
|
||||||
A --> B
|
A --> B
|
||||||
`,
|
`,
|
||||||
{ flowchart: { titleTopMargin: 0 } }
|
{ titleTopMargin: 0 }
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
it('elk: should include classes on the edges', () => {
|
it('elk: should include classes on the edges', () => {
|
||||||
@@ -710,7 +710,7 @@ flowchart-elk LR
|
|||||||
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
|
||||||
classDef someclass fill:#f96
|
classDef someclass fill:#f96
|
||||||
`,
|
`,
|
||||||
{ flowchart: { titleTopMargin: 0 } }
|
{ titleTopMargin: 0 }
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
it('With formatting in a node', () => {
|
it('With formatting in a node', () => {
|
||||||
@@ -726,7 +726,7 @@ flowchart-elk LR
|
|||||||
b --> d(The dog in the hog)
|
b --> d(The dog in the hog)
|
||||||
c --> d
|
c --> d
|
||||||
`,
|
`,
|
||||||
{ flowchart: { titleTopMargin: 0 } }
|
{ titleTopMargin: 0 }
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
it('New line in node and formatted edge label', () => {
|
it('New line in node and formatted edge label', () => {
|
||||||
@@ -736,7 +736,7 @@ flowchart-elk LR
|
|||||||
b("\`The dog in **the** hog.(1)
|
b("\`The dog in **the** hog.(1)
|
||||||
NL\`") --"\`1o **bold**\`"--> c
|
NL\`") --"\`1o **bold**\`"--> c
|
||||||
`,
|
`,
|
||||||
{ flowchart: { titleTopMargin: 0 } }
|
{ titleTopMargin: 0 }
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
it('Wrapping long text with a new line', () => {
|
it('Wrapping long text with a new line', () => {
|
||||||
@@ -749,7 +749,7 @@ Word!
|
|||||||
Another line with many, many words. Another line with many, many words. Another line with many, many words. Another line with many, many words. Another line with many, many words. Another line with many, many words. Another line with many, many words. Another line with many, many words. \`) --> c
|
Another line with many, many words. Another line with many, many words. Another line with many, many words. Another line with many, many words. Another line with many, many words. Another line with many, many words. Another line with many, many words. Another line with many, many words. \`) --> c
|
||||||
|
|
||||||
`,
|
`,
|
||||||
{ flowchart: { titleTopMargin: 0 } }
|
{ titleTopMargin: 0 }
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
it('Sub graphs and markdown strings', () => {
|
it('Sub graphs and markdown strings', () => {
|
||||||
@@ -766,7 +766,7 @@ subgraph "\`**Two**\`"
|
|||||||
end
|
end
|
||||||
|
|
||||||
`,
|
`,
|
||||||
{ flowchart: { titleTopMargin: 0 } }
|
{ titleTopMargin: 0 }
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -782,7 +782,7 @@ flowchart-elk LR
|
|||||||
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
|
||||||
classDef someclass fill:#f96
|
classDef someclass fill:#f96
|
||||||
`,
|
`,
|
||||||
{ flowchart: { titleTopMargin: 0 } }
|
{ titleTopMargin: 0 }
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
it('With formatting in a node', () => {
|
it('With formatting in a node', () => {
|
||||||
@@ -798,7 +798,7 @@ flowchart-elk LR
|
|||||||
b --> d(The dog in the hog)
|
b --> d(The dog in the hog)
|
||||||
c --> d
|
c --> d
|
||||||
`,
|
`,
|
||||||
{ flowchart: { titleTopMargin: 0 } }
|
{ titleTopMargin: 0 }
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
it('New line in node and formatted edge label', () => {
|
it('New line in node and formatted edge label', () => {
|
||||||
@@ -808,7 +808,7 @@ flowchart-elk LR
|
|||||||
b("\`The dog in **the** hog.(1)
|
b("\`The dog in **the** hog.(1)
|
||||||
NL\`") --"\`1o **bold**\`"--> c
|
NL\`") --"\`1o **bold**\`"--> c
|
||||||
`,
|
`,
|
||||||
{ flowchart: { titleTopMargin: 0 } }
|
{ titleTopMargin: 0 }
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
it('Wrapping long text with a new line', () => {
|
it('Wrapping long text with a new line', () => {
|
||||||
@@ -821,7 +821,7 @@ Word!
|
|||||||
Another line with many, many words. Another line with many, many words. Another line with many, many words. Another line with many, many words. Another line with many, many words. Another line with many, many words. Another line with many, many words. Another line with many, many words. \`") --> c
|
Another line with many, many words. Another line with many, many words. Another line with many, many words. Another line with many, many words. Another line with many, many words. Another line with many, many words. Another line with many, many words. Another line with many, many words. \`") --> c
|
||||||
|
|
||||||
`,
|
`,
|
||||||
{ flowchart: { titleTopMargin: 0 } }
|
{ titleTopMargin: 0 }
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
it('Sub graphs and markdown strings', () => {
|
it('Sub graphs and markdown strings', () => {
|
||||||
@@ -838,7 +838,7 @@ subgraph "\`**Two**\`"
|
|||||||
end
|
end
|
||||||
|
|
||||||
`,
|
`,
|
||||||
{ flowchart: { titleTopMargin: 0 } }
|
{ titleTopMargin: 0 }
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { imgSnapshotTest, renderGraph } from '../../helpers/util.ts';
|
import { imgSnapshotTest, renderGraph } from '../../helpers/util.js';
|
||||||
|
|
||||||
describe('Flowchart v2', () => {
|
describe('Flowchart v2', () => {
|
||||||
it('1: should render a simple flowchart', () => {
|
it('1: should render a simple flowchart', () => {
|
||||||
@@ -449,7 +449,7 @@ flowchart TD
|
|||||||
{ htmlLabels: true, flowchart: { htmlLabels: true }, securityLevel: 'loose' }
|
{ htmlLabels: true, flowchart: { htmlLabels: true }, securityLevel: 'loose' }
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
it('65-1: text-color from classes', () => {
|
it('65: text-color from classes', () => {
|
||||||
imgSnapshotTest(
|
imgSnapshotTest(
|
||||||
`
|
`
|
||||||
flowchart LR
|
flowchart LR
|
||||||
@@ -460,31 +460,6 @@ flowchart TD
|
|||||||
{ htmlLabels: true, flowchart: { htmlLabels: true }, securityLevel: 'loose' }
|
{ htmlLabels: true, flowchart: { htmlLabels: true }, securityLevel: 'loose' }
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
it('65-2: bold text from classes', () => {
|
|
||||||
imgSnapshotTest(
|
|
||||||
`
|
|
||||||
flowchart
|
|
||||||
classDef cat fill:#f9d5e5, stroke:#233d4d,stroke-width:2px, font-weight:bold;
|
|
||||||
CS(A long bold text to be viewed):::cat
|
|
||||||
`,
|
|
||||||
{ htmlLabels: true, flowchart: { htmlLabels: true }, securityLevel: 'loose' }
|
|
||||||
);
|
|
||||||
});
|
|
||||||
it('65-3: bigger font from classes', () => {
|
|
||||||
imgSnapshotTest(
|
|
||||||
`
|
|
||||||
flowchart
|
|
||||||
Node1:::class1 --> Node2:::class2
|
|
||||||
Node1:::class1 --> Node3:::class2
|
|
||||||
Node3 --> Node4((I am a circle)):::larger
|
|
||||||
|
|
||||||
classDef class1 fill:lightblue
|
|
||||||
classDef class2 fill:pink
|
|
||||||
classDef larger font-size:30px,fill:yellow
|
|
||||||
`,
|
|
||||||
{ htmlLabels: true, flowchart: { htmlLabels: true }, securityLevel: 'loose' }
|
|
||||||
);
|
|
||||||
});
|
|
||||||
it('66: More nested subgraph cases (TB)', () => {
|
it('66: More nested subgraph cases (TB)', () => {
|
||||||
imgSnapshotTest(
|
imgSnapshotTest(
|
||||||
`
|
`
|
||||||
@@ -696,7 +671,7 @@ title: Simple flowchart
|
|||||||
flowchart TD
|
flowchart TD
|
||||||
A --> B
|
A --> B
|
||||||
`,
|
`,
|
||||||
{ flowchart: { titleTopMargin: 10 } }
|
{ titleTopMargin: 0 }
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
it('3192: It should be possieble to render flowcharts with invisible edges', () => {
|
it('3192: It should be possieble to render flowcharts with invisible edges', () => {
|
||||||
@@ -707,7 +682,7 @@ title: Simple flowchart with invisible edges
|
|||||||
flowchart TD
|
flowchart TD
|
||||||
A ~~~ B
|
A ~~~ B
|
||||||
`,
|
`,
|
||||||
{ flowchart: { titleTopMargin: 10 } }
|
{ titleTopMargin: 0 }
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
it('4023: Should render html labels with images and-or text correctly', () => {
|
it('4023: Should render html labels with images and-or text correctly', () => {
|
||||||
@@ -720,15 +695,6 @@ A ~~~ B
|
|||||||
{}
|
{}
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('4439: Should render the graph even if some images are missing', () => {
|
|
||||||
imgSnapshotTest(
|
|
||||||
`flowchart TD
|
|
||||||
B[<img>]
|
|
||||||
B-->C[<img>]`,
|
|
||||||
{}
|
|
||||||
);
|
|
||||||
});
|
|
||||||
describe('Markdown strings flowchart (#4220)', () => {
|
describe('Markdown strings flowchart (#4220)', () => {
|
||||||
describe('html labels', () => {
|
describe('html labels', () => {
|
||||||
it('With styling and classes', () => {
|
it('With styling and classes', () => {
|
||||||
@@ -741,7 +707,7 @@ flowchart LR
|
|||||||
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
|
||||||
classDef someclass fill:#f96
|
classDef someclass fill:#f96
|
||||||
`,
|
`,
|
||||||
{ flowchart: { titleTopMargin: 0 } }
|
{ titleTopMargin: 0 }
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
it('With formatting in a node', () => {
|
it('With formatting in a node', () => {
|
||||||
@@ -757,7 +723,7 @@ flowchart LR
|
|||||||
b --> d(The dog in the hog)
|
b --> d(The dog in the hog)
|
||||||
c --> d
|
c --> d
|
||||||
`,
|
`,
|
||||||
{ flowchart: { titleTopMargin: 0 } }
|
{ titleTopMargin: 0 }
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
it('New line in node and formatted edge label', () => {
|
it('New line in node and formatted edge label', () => {
|
||||||
@@ -767,7 +733,7 @@ flowchart LR
|
|||||||
b("\`The dog in **the** hog.(1)
|
b("\`The dog in **the** hog.(1)
|
||||||
NL\`") --"\`1o **bold**\`"--> c
|
NL\`") --"\`1o **bold**\`"--> c
|
||||||
`,
|
`,
|
||||||
{ flowchart: { titleTopMargin: 0 } }
|
{ titleTopMargin: 0 }
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
it('Wrapping long text with a new line', () => {
|
it('Wrapping long text with a new line', () => {
|
||||||
@@ -780,7 +746,7 @@ Word!
|
|||||||
Another line with many, many words. Another line with many, many words. Another line with many, many words. Another line with many, many words. Another line with many, many words. Another line with many, many words. Another line with many, many words. Another line with many, many words. \`") --> c
|
Another line with many, many words. Another line with many, many words. Another line with many, many words. Another line with many, many words. Another line with many, many words. Another line with many, many words. Another line with many, many words. Another line with many, many words. \`") --> c
|
||||||
|
|
||||||
`,
|
`,
|
||||||
{ flowchart: { titleTopMargin: 0 } }
|
{ titleTopMargin: 0 }
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
it('Sub graphs and markdown strings', () => {
|
it('Sub graphs and markdown strings', () => {
|
||||||
@@ -797,7 +763,7 @@ subgraph "\`**Two**\`"
|
|||||||
end
|
end
|
||||||
|
|
||||||
`,
|
`,
|
||||||
{ flowchart: { titleTopMargin: 0 } }
|
{ titleTopMargin: 0 }
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -813,7 +779,7 @@ flowchart LR
|
|||||||
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
|
||||||
classDef someclass fill:#f96
|
classDef someclass fill:#f96
|
||||||
`,
|
`,
|
||||||
{ flowchart: { titleTopMargin: 0 } }
|
{ titleTopMargin: 0 }
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
it('With formatting in a node', () => {
|
it('With formatting in a node', () => {
|
||||||
@@ -829,7 +795,7 @@ flowchart LR
|
|||||||
b --> d(The dog in the hog)
|
b --> d(The dog in the hog)
|
||||||
c --> d
|
c --> d
|
||||||
`,
|
`,
|
||||||
{ flowchart: { titleTopMargin: 0 } }
|
{ titleTopMargin: 0 }
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
it('New line in node and formatted edge label', () => {
|
it('New line in node and formatted edge label', () => {
|
||||||
@@ -839,7 +805,7 @@ flowchart LR
|
|||||||
b("\`The dog in **the** hog.(1)
|
b("\`The dog in **the** hog.(1)
|
||||||
NL\`") --"\`1o **bold**\`"--> c
|
NL\`") --"\`1o **bold**\`"--> c
|
||||||
`,
|
`,
|
||||||
{ flowchart: { titleTopMargin: 0 } }
|
{ titleTopMargin: 0 }
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
it('Wrapping long text with a new line', () => {
|
it('Wrapping long text with a new line', () => {
|
||||||
@@ -852,7 +818,7 @@ Word!
|
|||||||
Another line with many, many words. Another line with many, many words. Another line with many, many words. Another line with many, many words. Another line with many, many words. Another line with many, many words. Another line with many, many words. Another line with many, many words. \`") --> c
|
Another line with many, many words. Another line with many, many words. Another line with many, many words. Another line with many, many words. Another line with many, many words. Another line with many, many words. Another line with many, many words. Another line with many, many words. \`") --> c
|
||||||
|
|
||||||
`,
|
`,
|
||||||
{ flowchart: { titleTopMargin: 0 } }
|
{ titleTopMargin: 0 }
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
it('Sub graphs and markdown strings', () => {
|
it('Sub graphs and markdown strings', () => {
|
||||||
@@ -869,7 +835,7 @@ subgraph "\`**Two**\`"
|
|||||||
end
|
end
|
||||||
|
|
||||||
`,
|
`,
|
||||||
{ flowchart: { titleTopMargin: 0 } }
|
{ titleTopMargin: 0 }
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { imgSnapshotTest, renderGraph } from '../../helpers/util.ts';
|
import { imgSnapshotTest, renderGraph } from '../../helpers/util.js';
|
||||||
|
|
||||||
describe('Graph', () => {
|
describe('Graph', () => {
|
||||||
it('1: should render a simple flowchart no htmlLabels', () => {
|
it('1: should render a simple flowchart no htmlLabels', () => {
|
||||||
@@ -891,27 +891,4 @@ graph TD
|
|||||||
{ htmlLabels: true, flowchart: { htmlLabels: true }, securityLevel: 'loose' }
|
{ htmlLabels: true, flowchart: { htmlLabels: true }, securityLevel: 'loose' }
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
it('66: apply class called default on node called default', () => {
|
|
||||||
imgSnapshotTest(
|
|
||||||
`
|
|
||||||
graph TD
|
|
||||||
classDef default fill:#a34,stroke:#000,stroke-width:4px,color:#fff
|
|
||||||
hello --> default
|
|
||||||
`,
|
|
||||||
{ htmlLabels: true, flowchart: { htmlLabels: true }, securityLevel: 'loose' }
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('67: should be able to style default node independently', () => {
|
|
||||||
imgSnapshotTest(
|
|
||||||
`
|
|
||||||
flowchart TD
|
|
||||||
classDef default fill:#a34
|
|
||||||
hello --> default
|
|
||||||
|
|
||||||
style default stroke:#000,stroke-width:4px
|
|
||||||
`,
|
|
||||||
{ htmlLabels: true, flowchart: { htmlLabels: true }, securityLevel: 'loose' }
|
|
||||||
);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { imgSnapshotTest, renderGraph } from '../../helpers/util.ts';
|
import { imgSnapshotTest, renderGraph } from '../../helpers/util.js';
|
||||||
|
|
||||||
describe('Gantt diagram', () => {
|
describe('Gantt diagram', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
@@ -330,48 +330,6 @@ describe('Gantt diagram', () => {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should render a gantt diagram with tick is 2 milliseconds', () => {
|
|
||||||
imgSnapshotTest(
|
|
||||||
`
|
|
||||||
gantt
|
|
||||||
title A Gantt Diagram
|
|
||||||
dateFormat SSS
|
|
||||||
axisFormat %Lms
|
|
||||||
tickInterval 2millisecond
|
|
||||||
excludes weekends
|
|
||||||
|
|
||||||
section Section
|
|
||||||
A task : a1, 000, 6ms
|
|
||||||
Another task : after a1, 6ms
|
|
||||||
section Another
|
|
||||||
Task in sec : a2, 006, 3ms
|
|
||||||
another task : 3ms
|
|
||||||
`,
|
|
||||||
{}
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should render a gantt diagram with tick is 2 seconds', () => {
|
|
||||||
imgSnapshotTest(
|
|
||||||
`
|
|
||||||
gantt
|
|
||||||
title A Gantt Diagram
|
|
||||||
dateFormat ss
|
|
||||||
axisFormat %Ss
|
|
||||||
tickInterval 2second
|
|
||||||
excludes weekends
|
|
||||||
|
|
||||||
section Section
|
|
||||||
A task : a1, 00, 6s
|
|
||||||
Another task : after a1, 6s
|
|
||||||
section Another
|
|
||||||
Task in sec : 06, 3s
|
|
||||||
another task : 3s
|
|
||||||
`,
|
|
||||||
{}
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should render a gantt diagram with tick is 15 minutes', () => {
|
it('should render a gantt diagram with tick is 15 minutes', () => {
|
||||||
imgSnapshotTest(
|
imgSnapshotTest(
|
||||||
`
|
`
|
||||||
@@ -456,28 +414,6 @@ describe('Gantt diagram', () => {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should render a gantt diagram with tick is 1 week, with the day starting on monday', () => {
|
|
||||||
imgSnapshotTest(
|
|
||||||
`
|
|
||||||
gantt
|
|
||||||
title A Gantt Diagram
|
|
||||||
dateFormat YYYY-MM-DD
|
|
||||||
axisFormat %m-%d
|
|
||||||
tickInterval 1week
|
|
||||||
weekday monday
|
|
||||||
excludes weekends
|
|
||||||
|
|
||||||
section Section
|
|
||||||
A task : a1, 2022-10-01, 30d
|
|
||||||
Another task : after a1, 20d
|
|
||||||
section Another
|
|
||||||
Task in sec : 2022-10-20, 12d
|
|
||||||
another task : 24d
|
|
||||||
`,
|
|
||||||
{}
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should render a gantt diagram with tick is 1 month', () => {
|
it('should render a gantt diagram with tick is 1 month', () => {
|
||||||
imgSnapshotTest(
|
imgSnapshotTest(
|
||||||
`
|
`
|
||||||
@@ -520,32 +456,6 @@ describe('Gantt diagram', () => {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
// TODO: fix it
|
|
||||||
//
|
|
||||||
// This test is skipped deliberately
|
|
||||||
// because it fails and blocks our development pipeline
|
|
||||||
// It was added as an attempt to fix gantt performance issues
|
|
||||||
//
|
|
||||||
// https://github.com/mermaid-js/mermaid/issues/3274
|
|
||||||
//
|
|
||||||
it.skip('should render a gantt diagram with very large intervals, skipping excludes if interval > 5 years', () => {
|
|
||||||
imgSnapshotTest(
|
|
||||||
`gantt
|
|
||||||
title A long Gantt Diagram
|
|
||||||
dateFormat YYYY-MM-DD
|
|
||||||
axisFormat %m-%d
|
|
||||||
tickInterval 1day
|
|
||||||
excludes weekends
|
|
||||||
section Section
|
|
||||||
A task : a1, 9999-10-01, 30d
|
|
||||||
Another task : after a1, 20d
|
|
||||||
section Another
|
|
||||||
Task in sec : 2022-10-20, 12d
|
|
||||||
another task : 24d
|
|
||||||
`
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should render when compact is true', () => {
|
it('should render when compact is true', () => {
|
||||||
imgSnapshotTest(
|
imgSnapshotTest(
|
||||||
`
|
`
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { imgSnapshotTest } from '../../helpers/util.ts';
|
import { imgSnapshotTest } from '../../helpers/util.js';
|
||||||
|
|
||||||
describe('Git Graph diagram', () => {
|
describe('Git Graph diagram', () => {
|
||||||
it('1: should render a simple gitgraph with commit on main branch', () => {
|
it('1: should render a simple gitgraph with commit on main branch', () => {
|
||||||
@@ -26,7 +26,7 @@ describe('Git Graph diagram', () => {
|
|||||||
`gitGraph
|
`gitGraph
|
||||||
commit id: "Normal Commit"
|
commit id: "Normal Commit"
|
||||||
commit id: "Reverse Commit" type: REVERSE
|
commit id: "Reverse Commit" type: REVERSE
|
||||||
commit id: "Highlight Commit" type: HIGHLIGHT
|
commit id: "Hightlight Commit" type: HIGHLIGHT
|
||||||
`,
|
`,
|
||||||
{}
|
{}
|
||||||
);
|
);
|
||||||
@@ -36,7 +36,7 @@ describe('Git Graph diagram', () => {
|
|||||||
`gitGraph
|
`gitGraph
|
||||||
commit id: "Normal Commit with tag" tag: "v1.0.0"
|
commit id: "Normal Commit with tag" tag: "v1.0.0"
|
||||||
commit id: "Reverse Commit with tag" type: REVERSE tag: "RC_1"
|
commit id: "Reverse Commit with tag" type: REVERSE tag: "RC_1"
|
||||||
commit id: "Highlight Commit" type: HIGHLIGHT tag: "8.8.4"
|
commit id: "Hightlight Commit" type: HIGHLIGHT tag: "8.8.4"
|
||||||
`,
|
`,
|
||||||
{}
|
{}
|
||||||
);
|
);
|
||||||
@@ -102,7 +102,7 @@ describe('Git Graph diagram', () => {
|
|||||||
{}
|
{}
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
it('8: should render a simple gitgraph with more than 8 branches & overriding variables', () => {
|
it('8: should render a simple gitgraph with more than 8 branchs & overriding variables', () => {
|
||||||
imgSnapshotTest(
|
imgSnapshotTest(
|
||||||
`%%{init: { 'logLevel': 'debug', 'theme': 'default' , 'themeVariables': {
|
`%%{init: { 'logLevel': 'debug', 'theme': 'default' , 'themeVariables': {
|
||||||
'gitBranchLabel0': '#ffffff',
|
'gitBranchLabel0': '#ffffff',
|
||||||
@@ -333,372 +333,4 @@ gitGraph
|
|||||||
{}
|
{}
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
it('15: should render a simple gitgraph with commit on main branch | Vertical Branch', () => {
|
|
||||||
imgSnapshotTest(
|
|
||||||
`gitGraph TB:
|
|
||||||
commit id: "1"
|
|
||||||
commit id: "2"
|
|
||||||
commit id: "3"
|
|
||||||
`,
|
|
||||||
{}
|
|
||||||
);
|
|
||||||
});
|
|
||||||
it('16: should render a simple gitgraph with commit on main branch with Id | Vertical Branch', () => {
|
|
||||||
imgSnapshotTest(
|
|
||||||
`gitGraph TB:
|
|
||||||
commit id: "One"
|
|
||||||
commit id: "Two"
|
|
||||||
commit id: "Three"
|
|
||||||
`,
|
|
||||||
{}
|
|
||||||
);
|
|
||||||
});
|
|
||||||
it('17: should render a simple gitgraph with different commitTypes on main branch | Vertical Branch', () => {
|
|
||||||
imgSnapshotTest(
|
|
||||||
`gitGraph TB:
|
|
||||||
commit id: "Normal Commit"
|
|
||||||
commit id: "Reverse Commit" type: REVERSE
|
|
||||||
commit id: "Highlight Commit" type: HIGHLIGHT
|
|
||||||
`,
|
|
||||||
{}
|
|
||||||
);
|
|
||||||
});
|
|
||||||
it('18: should render a simple gitgraph with tags commitTypes on main branch | Vertical Branch', () => {
|
|
||||||
imgSnapshotTest(
|
|
||||||
`gitGraph TB:
|
|
||||||
commit id: "Normal Commit with tag" tag: "v1.0.0"
|
|
||||||
commit id: "Reverse Commit with tag" type: REVERSE tag: "RC_1"
|
|
||||||
commit id: "Highlight Commit" type: HIGHLIGHT tag: "8.8.4"
|
|
||||||
`,
|
|
||||||
{}
|
|
||||||
);
|
|
||||||
});
|
|
||||||
it('19: should render a simple gitgraph with two branches | Vertical Branch', () => {
|
|
||||||
imgSnapshotTest(
|
|
||||||
`gitGraph TB:
|
|
||||||
commit id: "1"
|
|
||||||
commit id: "2"
|
|
||||||
branch develop
|
|
||||||
checkout develop
|
|
||||||
commit id: "3"
|
|
||||||
commit id: "4"
|
|
||||||
checkout main
|
|
||||||
commit id: "5"
|
|
||||||
commit id: "6"
|
|
||||||
`,
|
|
||||||
{}
|
|
||||||
);
|
|
||||||
});
|
|
||||||
it('20: should render a simple gitgraph with two branches and merge commit | Vertical Branch', () => {
|
|
||||||
imgSnapshotTest(
|
|
||||||
`gitGraph TB:
|
|
||||||
commit id: "1"
|
|
||||||
commit id: "2"
|
|
||||||
branch develop
|
|
||||||
checkout develop
|
|
||||||
commit id: "3"
|
|
||||||
commit id: "4"
|
|
||||||
checkout main
|
|
||||||
merge develop
|
|
||||||
commit id: "5"
|
|
||||||
commit id: "6"
|
|
||||||
`,
|
|
||||||
{}
|
|
||||||
);
|
|
||||||
});
|
|
||||||
it('21: should render a simple gitgraph with three branches and tagged merge commit | Vertical Branch', () => {
|
|
||||||
imgSnapshotTest(
|
|
||||||
`gitGraph TB:
|
|
||||||
commit id: "1"
|
|
||||||
commit id: "2"
|
|
||||||
branch nice_feature
|
|
||||||
checkout nice_feature
|
|
||||||
commit id: "3"
|
|
||||||
checkout main
|
|
||||||
commit id: "4"
|
|
||||||
checkout nice_feature
|
|
||||||
branch very_nice_feature
|
|
||||||
checkout very_nice_feature
|
|
||||||
commit id: "5"
|
|
||||||
checkout main
|
|
||||||
commit id: "6"
|
|
||||||
checkout nice_feature
|
|
||||||
commit id: "7"
|
|
||||||
checkout main
|
|
||||||
merge nice_feature id: "12345" tag: "my merge commit"
|
|
||||||
checkout very_nice_feature
|
|
||||||
commit id: "8"
|
|
||||||
checkout main
|
|
||||||
commit id: "9"
|
|
||||||
`,
|
|
||||||
{}
|
|
||||||
);
|
|
||||||
});
|
|
||||||
it('22: should render a simple gitgraph with more than 8 branches & overriding variables | Vertical Branch', () => {
|
|
||||||
imgSnapshotTest(
|
|
||||||
`%%{init: { 'logLevel': 'debug', 'theme': 'default' , 'themeVariables': {
|
|
||||||
'gitBranchLabel0': '#ffffff',
|
|
||||||
'gitBranchLabel1': '#ffffff',
|
|
||||||
'gitBranchLabel2': '#ffffff',
|
|
||||||
'gitBranchLabel3': '#ffffff',
|
|
||||||
'gitBranchLabel4': '#ffffff',
|
|
||||||
'gitBranchLabel5': '#ffffff',
|
|
||||||
'gitBranchLabel6': '#ffffff',
|
|
||||||
'gitBranchLabel7': '#ffffff',
|
|
||||||
} } }%%
|
|
||||||
gitGraph TB:
|
|
||||||
checkout main
|
|
||||||
branch branch1
|
|
||||||
branch branch2
|
|
||||||
branch branch3
|
|
||||||
branch branch4
|
|
||||||
branch branch5
|
|
||||||
branch branch6
|
|
||||||
branch branch7
|
|
||||||
branch branch8
|
|
||||||
branch branch9
|
|
||||||
checkout branch1
|
|
||||||
commit id: "1"
|
|
||||||
`,
|
|
||||||
{}
|
|
||||||
);
|
|
||||||
});
|
|
||||||
it('23: should render a simple gitgraph with rotated labels | Vertical Branch', () => {
|
|
||||||
imgSnapshotTest(
|
|
||||||
`%%{init: { 'logLevel': 'debug', 'theme': 'default' , 'gitGraph': {
|
|
||||||
'rotateCommitLabel': true
|
|
||||||
} } }%%
|
|
||||||
gitGraph TB:
|
|
||||||
commit id: "75f7219e83b321cd3fdde7dcf83bc7c1000a6828"
|
|
||||||
commit id: "0db4784daf82736dec4569e0dc92980d328c1f2e"
|
|
||||||
commit id: "7067e9973f9eaa6cd4a4b723c506d1eab598e83e"
|
|
||||||
commit id: "66972321ad6c199013b5b31f03b3a86fa3f9817d"
|
|
||||||
`,
|
|
||||||
{}
|
|
||||||
);
|
|
||||||
});
|
|
||||||
it('24: should render a simple gitgraph with horizontal labels | Vertical Branch', () => {
|
|
||||||
imgSnapshotTest(
|
|
||||||
`%%{init: { 'logLevel': 'debug', 'theme': 'default' , 'gitGraph': {
|
|
||||||
'rotateCommitLabel': false
|
|
||||||
} } }%%
|
|
||||||
gitGraph TB:
|
|
||||||
commit id: "Alpha"
|
|
||||||
commit id: "Beta"
|
|
||||||
commit id: "Gamma"
|
|
||||||
commit id: "Delta"
|
|
||||||
`,
|
|
||||||
{}
|
|
||||||
);
|
|
||||||
});
|
|
||||||
it('25: should render a simple gitgraph with cherry pick commit | Vertical Branch', () => {
|
|
||||||
imgSnapshotTest(
|
|
||||||
`
|
|
||||||
gitGraph TB:
|
|
||||||
commit id: "ZERO"
|
|
||||||
branch develop
|
|
||||||
commit id:"A"
|
|
||||||
checkout main
|
|
||||||
commit id:"ONE"
|
|
||||||
checkout develop
|
|
||||||
commit id:"B"
|
|
||||||
checkout main
|
|
||||||
commit id:"TWO"
|
|
||||||
cherry-pick id:"A"
|
|
||||||
commit id:"THREE"
|
|
||||||
checkout develop
|
|
||||||
commit id:"C"
|
|
||||||
`,
|
|
||||||
{}
|
|
||||||
);
|
|
||||||
});
|
|
||||||
it('26: should render a gitgraph with cherry pick commit with custom tag | Vertical Branch', () => {
|
|
||||||
imgSnapshotTest(
|
|
||||||
`
|
|
||||||
gitGraph TB:
|
|
||||||
commit id: "ZERO"
|
|
||||||
branch develop
|
|
||||||
commit id:"A"
|
|
||||||
checkout main
|
|
||||||
commit id:"ONE"
|
|
||||||
checkout develop
|
|
||||||
commit id:"B"
|
|
||||||
checkout main
|
|
||||||
commit id:"TWO"
|
|
||||||
cherry-pick id:"A" tag: "snapshot"
|
|
||||||
commit id:"THREE"
|
|
||||||
checkout develop
|
|
||||||
commit id:"C"
|
|
||||||
`,
|
|
||||||
{}
|
|
||||||
);
|
|
||||||
});
|
|
||||||
it('27: should render a gitgraph with cherry pick commit with no tag | Vertical Branch', () => {
|
|
||||||
imgSnapshotTest(
|
|
||||||
`
|
|
||||||
gitGraph TB:
|
|
||||||
commit id: "ZERO"
|
|
||||||
branch develop
|
|
||||||
commit id:"A"
|
|
||||||
checkout main
|
|
||||||
commit id:"ONE"
|
|
||||||
checkout develop
|
|
||||||
commit id:"B"
|
|
||||||
checkout main
|
|
||||||
commit id:"TWO"
|
|
||||||
cherry-pick id:"A" tag: ""
|
|
||||||
commit id:"THREE"
|
|
||||||
checkout develop
|
|
||||||
commit id:"C"
|
|
||||||
`,
|
|
||||||
{}
|
|
||||||
);
|
|
||||||
});
|
|
||||||
it('28: should render a simple gitgraph with two cherry pick commit | Vertical Branch', () => {
|
|
||||||
imgSnapshotTest(
|
|
||||||
`
|
|
||||||
gitGraph TB:
|
|
||||||
commit id: "ZERO"
|
|
||||||
branch develop
|
|
||||||
commit id:"A"
|
|
||||||
checkout main
|
|
||||||
commit id:"ONE"
|
|
||||||
checkout develop
|
|
||||||
commit id:"B"
|
|
||||||
branch featureA
|
|
||||||
commit id:"FIX"
|
|
||||||
commit id: "FIX-2"
|
|
||||||
checkout main
|
|
||||||
commit id:"TWO"
|
|
||||||
cherry-pick id:"A"
|
|
||||||
commit id:"THREE"
|
|
||||||
cherry-pick id:"FIX"
|
|
||||||
checkout develop
|
|
||||||
commit id:"C"
|
|
||||||
merge featureA
|
|
||||||
`,
|
|
||||||
{}
|
|
||||||
);
|
|
||||||
});
|
|
||||||
it('29: should render commits for more than 8 branches | Vertical Branch', () => {
|
|
||||||
imgSnapshotTest(
|
|
||||||
`
|
|
||||||
gitGraph TB:
|
|
||||||
checkout main
|
|
||||||
%% Make sure to manually set the ID of all commits, for consistent visual tests
|
|
||||||
commit id: "1-abcdefg"
|
|
||||||
checkout main
|
|
||||||
branch branch1
|
|
||||||
commit id: "2-abcdefg"
|
|
||||||
checkout main
|
|
||||||
merge branch1
|
|
||||||
branch branch2
|
|
||||||
commit id: "3-abcdefg"
|
|
||||||
checkout main
|
|
||||||
merge branch2
|
|
||||||
branch branch3
|
|
||||||
commit id: "4-abcdefg"
|
|
||||||
checkout main
|
|
||||||
merge branch3
|
|
||||||
branch branch4
|
|
||||||
commit id: "5-abcdefg"
|
|
||||||
checkout main
|
|
||||||
merge branch4
|
|
||||||
branch branch5
|
|
||||||
commit id: "6-abcdefg"
|
|
||||||
checkout main
|
|
||||||
merge branch5
|
|
||||||
branch branch6
|
|
||||||
commit id: "7-abcdefg"
|
|
||||||
checkout main
|
|
||||||
merge branch6
|
|
||||||
branch branch7
|
|
||||||
commit id: "8-abcdefg"
|
|
||||||
checkout main
|
|
||||||
merge branch7
|
|
||||||
branch branch8
|
|
||||||
commit id: "9-abcdefg"
|
|
||||||
checkout main
|
|
||||||
merge branch8
|
|
||||||
branch branch9
|
|
||||||
commit id: "10-abcdefg"
|
|
||||||
`,
|
|
||||||
{}
|
|
||||||
);
|
|
||||||
});
|
|
||||||
it('30: should render a simple gitgraph with three branches,custom merge commit id,tag,type | Vertical Branch', () => {
|
|
||||||
imgSnapshotTest(
|
|
||||||
`gitGraph TB:
|
|
||||||
commit id: "1"
|
|
||||||
commit id: "2"
|
|
||||||
branch nice_feature
|
|
||||||
checkout nice_feature
|
|
||||||
commit id: "3"
|
|
||||||
checkout main
|
|
||||||
commit id: "4"
|
|
||||||
checkout nice_feature
|
|
||||||
branch very_nice_feature
|
|
||||||
checkout very_nice_feature
|
|
||||||
commit id: "5"
|
|
||||||
checkout main
|
|
||||||
commit id: "6"
|
|
||||||
checkout nice_feature
|
|
||||||
commit id: "7"
|
|
||||||
checkout main
|
|
||||||
merge nice_feature id: "customID" tag: "customTag" type: REVERSE
|
|
||||||
checkout very_nice_feature
|
|
||||||
commit id: "8"
|
|
||||||
checkout main
|
|
||||||
commit id: "9"
|
|
||||||
`,
|
|
||||||
{}
|
|
||||||
);
|
|
||||||
});
|
|
||||||
it('31: should render a simple gitgraph with a title | Vertical Branch', () => {
|
|
||||||
imgSnapshotTest(
|
|
||||||
`---
|
|
||||||
title: simple gitGraph
|
|
||||||
---
|
|
||||||
gitGraph TB:
|
|
||||||
commit id: "1-abcdefg"
|
|
||||||
`,
|
|
||||||
{}
|
|
||||||
);
|
|
||||||
});
|
|
||||||
it('32: should render a simple gitgraph overlapping commits | Vertical Branch', () => {
|
|
||||||
imgSnapshotTest(
|
|
||||||
`gitGraph TB:
|
|
||||||
commit id:"s1"
|
|
||||||
commit id:"s2"
|
|
||||||
branch branch1
|
|
||||||
commit id:"s3"
|
|
||||||
commit id:"s4"
|
|
||||||
checkout main
|
|
||||||
commit id:"s5"
|
|
||||||
checkout branch1
|
|
||||||
commit id:"s6"
|
|
||||||
commit id:"s7"
|
|
||||||
merge main
|
|
||||||
`,
|
|
||||||
{}
|
|
||||||
);
|
|
||||||
});
|
|
||||||
it('33: should render a simple gitgraph overlapping commits', () => {
|
|
||||||
imgSnapshotTest(
|
|
||||||
`gitGraph
|
|
||||||
commit id:"s1"
|
|
||||||
commit id:"s2"
|
|
||||||
branch branch1
|
|
||||||
commit id:"s3"
|
|
||||||
commit id:"s4"
|
|
||||||
checkout main
|
|
||||||
commit id:"s5"
|
|
||||||
checkout branch1
|
|
||||||
commit id:"s6"
|
|
||||||
commit id:"s7"
|
|
||||||
merge main
|
|
||||||
`,
|
|
||||||
{}
|
|
||||||
);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { imgSnapshotTest } from '../../helpers/util.ts';
|
import { imgSnapshotTest } from '../../helpers/util.js';
|
||||||
|
|
||||||
describe('info diagram', () => {
|
describe('info diagram', () => {
|
||||||
it('should handle an info definition', () => {
|
it('should handle an info definition', () => {
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { imgSnapshotTest, renderGraph } from '../../helpers/util.ts';
|
import { imgSnapshotTest, renderGraph } from '../../helpers/util.js';
|
||||||
|
|
||||||
describe('User journey diagram', () => {
|
describe('User journey diagram', () => {
|
||||||
it('Simple test', () => {
|
it('Simple test', () => {
|
||||||
|
@@ -1,10 +0,0 @@
|
|||||||
import { urlSnapshotTest } from '../../helpers/util.ts';
|
|
||||||
|
|
||||||
describe('Marker Unique IDs Per Diagram', () => {
|
|
||||||
it('should render a blue arrow tip in second digram', () => {
|
|
||||||
urlSnapshotTest('http://localhost:9000/marker_unique_id.html', {
|
|
||||||
logLevel: 1,
|
|
||||||
flowchart: { htmlLabels: false },
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
@@ -1,4 +1,4 @@
|
|||||||
import { imgSnapshotTest } from '../../helpers/util.ts';
|
import { imgSnapshotTest } from '../../helpers/util.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check whether the SVG Element has a Mindmap root
|
* Check whether the SVG Element has a Mindmap root
|
||||||
@@ -242,7 +242,8 @@ mindmap
|
|||||||
a second line 😎\`]
|
a second line 😎\`]
|
||||||
id2[\`The dog in **the** hog... a *very long text* about it
|
id2[\`The dog in **the** hog... a *very long text* about it
|
||||||
Word!\`]
|
Word!\`]
|
||||||
`
|
`,
|
||||||
|
{ titleTopMargin: 0 }
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@@ -1,85 +1,89 @@
|
|||||||
import { imgSnapshotTest, renderGraph } from '../../helpers/util.ts';
|
import { imgSnapshotTest, renderGraph } from '../../helpers/util.js';
|
||||||
|
|
||||||
describe('pie chart', () => {
|
describe('Pie Chart', () => {
|
||||||
it('should render a simple pie diagram', () => {
|
it('should render a simple pie diagram', () => {
|
||||||
imgSnapshotTest(
|
imgSnapshotTest(
|
||||||
`pie title Sports in Sweden
|
|
||||||
"Bandy": 40
|
|
||||||
"Ice-Hockey": 80
|
|
||||||
"Football": 90
|
|
||||||
`
|
`
|
||||||
|
pie title Sports in Sweden
|
||||||
|
"Bandy" : 40
|
||||||
|
"Ice-Hockey" : 80
|
||||||
|
"Football" : 90
|
||||||
|
`,
|
||||||
|
{}
|
||||||
);
|
);
|
||||||
|
cy.get('svg');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should render a simple pie diagram with long labels', () => {
|
it('should render a simple pie diagram with long labels', () => {
|
||||||
imgSnapshotTest(
|
imgSnapshotTest(
|
||||||
`pie title NETFLIX
|
|
||||||
"Time spent looking for movie": 90
|
|
||||||
"Time spent watching it": 10
|
|
||||||
`
|
`
|
||||||
|
pie title NETFLIX
|
||||||
|
"Time spent looking for movie" : 90
|
||||||
|
"Time spent watching it" : 10
|
||||||
|
`,
|
||||||
|
{}
|
||||||
);
|
);
|
||||||
|
cy.get('svg');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should render a simple pie diagram with capital letters for labels', () => {
|
it('should render a simple pie diagram with capital letters for labels', () => {
|
||||||
imgSnapshotTest(
|
imgSnapshotTest(
|
||||||
`pie title What Voldemort doesn't have?
|
|
||||||
"FRIENDS": 2
|
|
||||||
"FAMILY": 3
|
|
||||||
"NOSE": 45
|
|
||||||
`
|
`
|
||||||
|
pie title What Voldemort doesn't have?
|
||||||
|
"FRIENDS" : 2
|
||||||
|
"FAMILY" : 3
|
||||||
|
"NOSE" : 45
|
||||||
|
`,
|
||||||
|
{}
|
||||||
);
|
);
|
||||||
|
cy.get('svg');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should render a pie diagram when useMaxWidth is true (default)', () => {
|
it('should render a pie diagram when useMaxWidth is true (default)', () => {
|
||||||
renderGraph(
|
renderGraph(
|
||||||
`pie title Sports in Sweden
|
`
|
||||||
"Bandy": 40
|
pie title Sports in Sweden
|
||||||
"Ice-Hockey": 80
|
"Bandy" : 40
|
||||||
"Football": 90
|
"Ice-Hockey" : 80
|
||||||
|
"Football" : 90
|
||||||
`,
|
`,
|
||||||
{ pie: { useMaxWidth: true } }
|
{ pie: { useMaxWidth: true } }
|
||||||
);
|
);
|
||||||
cy.get('svg').should((svg) => {
|
cy.get('svg').should((svg) => {
|
||||||
expect(svg).to.have.attr('width', '100%');
|
expect(svg).to.have.attr('width', '100%');
|
||||||
|
// expect(svg).to.have.attr('height');
|
||||||
|
// const height = parseFloat(svg.attr('height'));
|
||||||
|
// 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(
|
||||||
`pie title Sports in Sweden
|
`
|
||||||
"Bandy": 40
|
pie title Sports in Sweden
|
||||||
"Ice-Hockey": 80
|
"Bandy" : 40
|
||||||
"Football": 90
|
"Ice-Hockey" : 80
|
||||||
|
"Football" : 90
|
||||||
`,
|
`,
|
||||||
{ pie: { useMaxWidth: false } }
|
{ pie: { useMaxWidth: false } }
|
||||||
);
|
);
|
||||||
cy.get('svg').should((svg) => {
|
cy.get('svg').should((svg) => {
|
||||||
|
// const height = parseFloat(svg.attr('height'));
|
||||||
const width = parseFloat(svg.attr('width'));
|
const width = parseFloat(svg.attr('width'));
|
||||||
|
// 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');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
it('should render a pie diagram when textPosition is set', () => {
|
||||||
it('should render a pie diagram when textPosition is setted', () => {
|
|
||||||
imgSnapshotTest(
|
imgSnapshotTest(
|
||||||
`pie
|
`
|
||||||
|
pie
|
||||||
"Dogs": 50
|
"Dogs": 50
|
||||||
"Cats": 25
|
"Cats": 25
|
||||||
`,
|
`,
|
||||||
{ logLevel: 1, pie: { textPosition: 0.9 } }
|
{ logLevel: 1, pie: { textPosition: 0.9 } }
|
||||||
);
|
);
|
||||||
});
|
cy.get('svg');
|
||||||
|
|
||||||
it('should render a pie diagram with showData', () => {
|
|
||||||
imgSnapshotTest(
|
|
||||||
`pie showData
|
|
||||||
"Dogs": 50
|
|
||||||
"Cats": 25
|
|
||||||
`
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
@@ -1,4 +1,4 @@
|
|||||||
import { imgSnapshotTest, renderGraph } from '../../helpers/util.ts';
|
import { imgSnapshotTest, renderGraph } from '../../helpers/util.js';
|
||||||
|
|
||||||
describe('Quadrant Chart', () => {
|
describe('Quadrant Chart', () => {
|
||||||
it('should render if only chart type is provided', () => {
|
it('should render if only chart type is provided', () => {
|
||||||
@@ -160,70 +160,4 @@ describe('Quadrant Chart', () => {
|
|||||||
);
|
);
|
||||||
cy.get('svg');
|
cy.get('svg');
|
||||||
});
|
});
|
||||||
it('should render x-axis labels in the center, if x-axis has two labels', () => {
|
|
||||||
imgSnapshotTest(
|
|
||||||
`
|
|
||||||
quadrantChart
|
|
||||||
title Reach and engagement of campaigns
|
|
||||||
x-axis Low Reach --> High Reach
|
|
||||||
y-axis Low Engagement
|
|
||||||
quadrant-1 We should expand
|
|
||||||
quadrant-2 Need to promote
|
|
||||||
quadrant-3 Re-evaluate
|
|
||||||
quadrant-4 May be improved
|
|
||||||
Campaign A: [0.3, 0.6]
|
|
||||||
Campaign B: [0.45, 0.23]
|
|
||||||
Campaign C: [0.57, 0.69]
|
|
||||||
Campaign D: [0.78, 0.34]
|
|
||||||
Campaign E: [0.40, 0.34]
|
|
||||||
Campaign F: [0.35, 0.78]
|
|
||||||
`,
|
|
||||||
{}
|
|
||||||
);
|
|
||||||
cy.get('svg');
|
|
||||||
});
|
|
||||||
it('should render y-axis labels in the center, if y-axis has two labels', () => {
|
|
||||||
imgSnapshotTest(
|
|
||||||
`
|
|
||||||
quadrantChart
|
|
||||||
title Reach and engagement of campaigns
|
|
||||||
x-axis Low Reach
|
|
||||||
y-axis Low Engagement --> High Engagement
|
|
||||||
quadrant-1 We should expand
|
|
||||||
quadrant-2 Need to promote
|
|
||||||
quadrant-3 Re-evaluate
|
|
||||||
quadrant-4 May be improved
|
|
||||||
Campaign A: [0.3, 0.6]
|
|
||||||
Campaign B: [0.45, 0.23]
|
|
||||||
Campaign C: [0.57, 0.69]
|
|
||||||
Campaign D: [0.78, 0.34]
|
|
||||||
Campaign E: [0.40, 0.34]
|
|
||||||
Campaign F: [0.35, 0.78]
|
|
||||||
`,
|
|
||||||
{}
|
|
||||||
);
|
|
||||||
cy.get('svg');
|
|
||||||
});
|
|
||||||
it('should render both axes labels on the left and bottom, if both axes have only one label', () => {
|
|
||||||
imgSnapshotTest(
|
|
||||||
`
|
|
||||||
quadrantChart
|
|
||||||
title Reach and engagement of campaigns
|
|
||||||
x-axis Reach -->
|
|
||||||
y-axis Engagement -->
|
|
||||||
quadrant-1 We should expand
|
|
||||||
quadrant-2 Need to promote
|
|
||||||
quadrant-3 Re-evaluate
|
|
||||||
quadrant-4 May be improved
|
|
||||||
Campaign A: [0.3, 0.6]
|
|
||||||
Campaign B: [0.45, 0.23]
|
|
||||||
Campaign C: [0.57, 0.69]
|
|
||||||
Campaign D: [0.78, 0.34]
|
|
||||||
Campaign E: [0.40, 0.34]
|
|
||||||
Campaign F: [0.35, 0.78]
|
|
||||||
`,
|
|
||||||
{}
|
|
||||||
);
|
|
||||||
cy.get('svg');
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { imgSnapshotTest, renderGraph } from '../../helpers/util.ts';
|
import { imgSnapshotTest, renderGraph } from '../../helpers/util.js';
|
||||||
|
|
||||||
describe('Requirement diagram', () => {
|
describe('Requirement diagram', () => {
|
||||||
it('sample', () => {
|
it('sample', () => {
|
||||||
|
@@ -1,144 +0,0 @@
|
|||||||
import { imgSnapshotTest, renderGraph } from '../../helpers/util.ts';
|
|
||||||
|
|
||||||
describe('Sankey Diagram', () => {
|
|
||||||
it('should render a simple example', () => {
|
|
||||||
imgSnapshotTest(
|
|
||||||
`
|
|
||||||
sankey-beta
|
|
||||||
|
|
||||||
sourceNode,targetNode,10
|
|
||||||
`,
|
|
||||||
{}
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('when given a linkColor', function () {
|
|
||||||
this.beforeAll(() => {
|
|
||||||
cy.wrap(
|
|
||||||
`sankey-beta
|
|
||||||
a,b,10
|
|
||||||
`
|
|
||||||
).as('graph');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('links should use hex color', function () {
|
|
||||||
renderGraph(this.graph, { sankey: { linkColor: '#636465' } });
|
|
||||||
|
|
||||||
cy.get('.link path').should((link) => {
|
|
||||||
expect(link.attr('stroke')).to.equal('#636465');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
it('links should be the same color as source node', function () {
|
|
||||||
renderGraph(this.graph, { sankey: { linkColor: 'source' } });
|
|
||||||
|
|
||||||
cy.get('.link path').then((link) => {
|
|
||||||
cy.get('.node[id="node-1"] rect').should((node) =>
|
|
||||||
expect(link.attr('stroke')).to.equal(node.attr('fill'))
|
|
||||||
);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
it('links should be the same color as target node', function () {
|
|
||||||
renderGraph(this.graph, { sankey: { linkColor: 'target' } });
|
|
||||||
|
|
||||||
cy.get('.link path').then((link) => {
|
|
||||||
cy.get('.node[id="node-2"] rect').should((node) =>
|
|
||||||
expect(link.attr('stroke')).to.equal(node.attr('fill'))
|
|
||||||
);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
it('links must be gradient', function () {
|
|
||||||
renderGraph(this.graph, { sankey: { linkColor: 'gradient' } });
|
|
||||||
|
|
||||||
cy.get('.link path').should((link) => {
|
|
||||||
expect(link.attr('stroke')).to.equal('url(#linearGradient-3)');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('when given a nodeAlignment', function () {
|
|
||||||
this.beforeAll(() => {
|
|
||||||
cy.wrap(
|
|
||||||
`
|
|
||||||
sankey-beta
|
|
||||||
|
|
||||||
a,b,8
|
|
||||||
b,c,8
|
|
||||||
c,d,8
|
|
||||||
d,e,8
|
|
||||||
|
|
||||||
x,c,4
|
|
||||||
c,y,4
|
|
||||||
`
|
|
||||||
).as('graph');
|
|
||||||
});
|
|
||||||
|
|
||||||
this.afterEach(() => {
|
|
||||||
cy.get('.node[id="node-1"]').should((node) => {
|
|
||||||
expect(node.attr('x')).to.equal('0');
|
|
||||||
});
|
|
||||||
cy.get('.node[id="node-2"]').should((node) => {
|
|
||||||
expect(node.attr('x')).to.equal('100');
|
|
||||||
});
|
|
||||||
cy.get('.node[id="node-3"]').should((node) => {
|
|
||||||
expect(node.attr('x')).to.equal('200');
|
|
||||||
});
|
|
||||||
cy.get('.node[id="node-4"]').should((node) => {
|
|
||||||
expect(node.attr('x')).to.equal('300');
|
|
||||||
});
|
|
||||||
cy.get('.node[id="node-5"]').should((node) => {
|
|
||||||
expect(node.attr('x')).to.equal('400');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should justify nodes', function () {
|
|
||||||
renderGraph(this.graph, {
|
|
||||||
sankey: { nodeAlignment: 'justify', width: 410, useMaxWidth: false },
|
|
||||||
});
|
|
||||||
cy.get('.node[id="node-6"]').should((node) => {
|
|
||||||
expect(node.attr('x')).to.equal('0');
|
|
||||||
});
|
|
||||||
cy.get('.node[id="node-7"]').should((node) => {
|
|
||||||
expect(node.attr('x')).to.equal('400');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should align nodes left', function () {
|
|
||||||
renderGraph(this.graph, {
|
|
||||||
sankey: { nodeAlignment: 'left', width: 410, useMaxWidth: false },
|
|
||||||
});
|
|
||||||
cy.get('.node[id="node-6"]').should((node) => {
|
|
||||||
expect(node.attr('x')).to.equal('0');
|
|
||||||
});
|
|
||||||
cy.get('.node[id="node-7"]').should((node) => {
|
|
||||||
expect(node.attr('x')).to.equal('300');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should align nodes right', function () {
|
|
||||||
renderGraph(this.graph, {
|
|
||||||
sankey: { nodeAlignment: 'right', width: 410, useMaxWidth: false },
|
|
||||||
});
|
|
||||||
cy.get('.node[id="node-6"]').should((node) => {
|
|
||||||
expect(node.attr('x')).to.equal('100');
|
|
||||||
});
|
|
||||||
cy.get('.node[id="node-7"]').should((node) => {
|
|
||||||
expect(node.attr('x')).to.equal('400');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should center nodes', function () {
|
|
||||||
renderGraph(this.graph, {
|
|
||||||
sankey: { nodeAlignment: 'center', width: 410, useMaxWidth: false },
|
|
||||||
});
|
|
||||||
cy.get('.node[id="node-6"]').should((node) => {
|
|
||||||
expect(node.attr('x')).to.equal('100');
|
|
||||||
});
|
|
||||||
cy.get('.node[id="node-7"]').should((node) => {
|
|
||||||
expect(node.attr('x')).to.equal('300');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
@@ -1,6 +1,6 @@
|
|||||||
/// <reference types="Cypress" />
|
/// <reference types="Cypress" />
|
||||||
|
|
||||||
import { imgSnapshotTest, renderGraph } from '../../helpers/util.ts';
|
import { imgSnapshotTest, renderGraph } from '../../helpers/util.js';
|
||||||
|
|
||||||
context('Sequence diagram', () => {
|
context('Sequence diagram', () => {
|
||||||
it('should render a sequence diagram with boxes', () => {
|
it('should render a sequence diagram with boxes', () => {
|
||||||
@@ -156,81 +156,6 @@ context('Sequence diagram', () => {
|
|||||||
`
|
`
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
it('should render a sequence diagram with basic actor creation and destruction', () => {
|
|
||||||
imgSnapshotTest(
|
|
||||||
`
|
|
||||||
sequenceDiagram
|
|
||||||
Alice ->> Bob: Hello Bob, how are you ?
|
|
||||||
Bob ->> Alice: Fine, thank you. And you?
|
|
||||||
create participant Polo
|
|
||||||
Alice ->> Polo: Hi Polo!
|
|
||||||
create actor Ola1 as Ola
|
|
||||||
Polo ->> Ola1: Hiii
|
|
||||||
Ola1 ->> Alice: Hi too
|
|
||||||
destroy Ola1
|
|
||||||
Alice --x Ola1: Bye!
|
|
||||||
Alice ->> Bob: And now?
|
|
||||||
create participant Ola2 as Ola
|
|
||||||
Alice ->> Ola2: Hello again
|
|
||||||
destroy Alice
|
|
||||||
Alice --x Ola2: Bye for me!
|
|
||||||
destroy Bob
|
|
||||||
Ola2 --> Bob: The end
|
|
||||||
`
|
|
||||||
);
|
|
||||||
});
|
|
||||||
it('should render a sequence diagram with actor creation and destruction coupled with backgrounds, loops and notes', () => {
|
|
||||||
imgSnapshotTest(
|
|
||||||
`
|
|
||||||
sequenceDiagram
|
|
||||||
accTitle: test the accTitle
|
|
||||||
accDescr: Test a description
|
|
||||||
|
|
||||||
participant Alice
|
|
||||||
participant Bob
|
|
||||||
autonumber 10 10
|
|
||||||
rect rgb(200, 220, 100)
|
|
||||||
rect rgb(200, 255, 200)
|
|
||||||
|
|
||||||
Alice ->> Bob: Hello Bob, how are you?
|
|
||||||
create participant John as John<br />Second Line
|
|
||||||
Bob-->>John: How about you John?
|
|
||||||
end
|
|
||||||
|
|
||||||
Bob--x Alice: I am good thanks!
|
|
||||||
Bob-x John: I am good thanks!
|
|
||||||
Note right of John: John thinks a long<br />long time, so long<br />that the text does<br />not fit on a row.
|
|
||||||
|
|
||||||
Bob-->Alice: Checking with John...
|
|
||||||
Note over John:wrap: John looks like he's still thinking, so Bob prods him a bit.
|
|
||||||
Bob-x John: Hey John - we're still waiting to know<br />how you're doing
|
|
||||||
Note over John:nowrap: John's trying hard not to break his train of thought.
|
|
||||||
destroy John
|
|
||||||
Bob-x John: John! Cmon!
|
|
||||||
Note over John: After a few more moments, John<br />finally snaps out of it.
|
|
||||||
end
|
|
||||||
|
|
||||||
autonumber off
|
|
||||||
alt either this
|
|
||||||
create actor Lola
|
|
||||||
Alice->>+Lola: Yes
|
|
||||||
Lola-->>-Alice: OK
|
|
||||||
else or this
|
|
||||||
autonumber
|
|
||||||
Alice->>Lola: No
|
|
||||||
else or this will happen
|
|
||||||
Alice->Lola: Maybe
|
|
||||||
end
|
|
||||||
autonumber 200
|
|
||||||
par this happens in parallel
|
|
||||||
destroy Bob
|
|
||||||
Alice -->> Bob: Parallel message 1
|
|
||||||
and
|
|
||||||
Alice -->> Lola: Parallel message 2
|
|
||||||
end
|
|
||||||
`
|
|
||||||
);
|
|
||||||
});
|
|
||||||
context('font settings', () => {
|
context('font settings', () => {
|
||||||
it('should render different note fonts when configured', () => {
|
it('should render different note fonts when configured', () => {
|
||||||
imgSnapshotTest(
|
imgSnapshotTest(
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { imgSnapshotTest, renderGraph } from '../../helpers/util.ts';
|
import { imgSnapshotTest, renderGraph } from '../../helpers/util.js';
|
||||||
|
|
||||||
describe('State diagram', () => {
|
describe('State diagram', () => {
|
||||||
it('v2 should render a simple info', () => {
|
it('v2 should render a simple info', () => {
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { imgSnapshotTest, renderGraph } from '../../helpers/util.ts';
|
import { imgSnapshotTest, renderGraph } from '../../helpers/util.js';
|
||||||
|
|
||||||
describe('State diagram', () => {
|
describe('State diagram', () => {
|
||||||
it('should render a simple state diagrams', () => {
|
it('should render a simple state diagrams', () => {
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { imgSnapshotTest } from '../../helpers/util.ts';
|
import { imgSnapshotTest } from '../../helpers/util.js';
|
||||||
|
|
||||||
describe('themeCSS balancing, it', () => {
|
describe('themeCSS balancing, it', () => {
|
||||||
it('should not allow unbalanced CSS definitions', () => {
|
it('should not allow unbalanced CSS definitions', () => {
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { imgSnapshotTest } from '../../helpers/util.ts';
|
import { imgSnapshotTest } from '../../helpers/util.js';
|
||||||
|
|
||||||
describe('Timeline diagram', () => {
|
describe('Timeline diagram', () => {
|
||||||
it('1: should render a simple timeline with no specific sections', () => {
|
it('1: should render a simple timeline with no specific sections', () => {
|
||||||
@@ -57,7 +57,7 @@ describe('Timeline diagram', () => {
|
|||||||
{}
|
{}
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
it('5: should render a simple timeline with directive overridden colors', () => {
|
it('5: should render a simple timeline with directive overriden colors', () => {
|
||||||
imgSnapshotTest(
|
imgSnapshotTest(
|
||||||
` %%{init: { 'logLevel': 'debug', 'theme': 'default' , 'themeVariables': {
|
` %%{init: { 'logLevel': 'debug', 'theme': 'default' , 'themeVariables': {
|
||||||
'cScale0': '#ff0000',
|
'cScale0': '#ff0000',
|
||||||
|
@@ -1,322 +0,0 @@
|
|||||||
import { imgSnapshotTest, renderGraph } from '../../helpers/util.ts';
|
|
||||||
|
|
||||||
describe('XY Chart', () => {
|
|
||||||
it('should render the simplest possible chart', () => {
|
|
||||||
imgSnapshotTest(
|
|
||||||
`
|
|
||||||
xychart-beta
|
|
||||||
line [10, 30, 20]
|
|
||||||
`,
|
|
||||||
{}
|
|
||||||
);
|
|
||||||
cy.get('svg');
|
|
||||||
});
|
|
||||||
it('Should render a complete chart', () => {
|
|
||||||
imgSnapshotTest(
|
|
||||||
`
|
|
||||||
xychart-beta
|
|
||||||
title "Sales Revenue"
|
|
||||||
x-axis Months [jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec]
|
|
||||||
y-axis "Revenue (in $)" 4000 --> 11000
|
|
||||||
bar [5000, 6000, 7500, 8200, 9500, 10500, 11000, 10200, 9200, 8500, 7000, 6000]
|
|
||||||
line [5000, 6000, 7500, 8200, 9500, 10500, 11000, 10200, 9200, 8500, 7000, 6000]
|
|
||||||
`,
|
|
||||||
{}
|
|
||||||
);
|
|
||||||
});
|
|
||||||
it('Should render a chart without title', () => {
|
|
||||||
imgSnapshotTest(
|
|
||||||
`
|
|
||||||
xychart-beta
|
|
||||||
x-axis Months [jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec]
|
|
||||||
y-axis "Revenue (in $)" 4000 --> 11000
|
|
||||||
bar [5000, 6000, 7500, 8200, 9500, 10500, 11000, 10200, 9200, 8500, 7000, 6000]
|
|
||||||
line [5000, 6000, 7500, 8200, 9500, 10500, 11000, 10200, 9200, 8500, 7000, 6000]
|
|
||||||
`,
|
|
||||||
{}
|
|
||||||
);
|
|
||||||
cy.get('svg');
|
|
||||||
});
|
|
||||||
it('y-axis title not required', () => {
|
|
||||||
imgSnapshotTest(
|
|
||||||
`
|
|
||||||
xychart-beta
|
|
||||||
x-axis Months [jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec]
|
|
||||||
y-axis 4000 --> 11000
|
|
||||||
bar [5000, 6000, 7500, 8200, 9500, 10500, 11000, 10200, 9200, 8500, 7000, 6000]
|
|
||||||
line [5000, 6000, 7500, 8200, 9500, 10500, 11000, 10200, 9200, 8500, 7000, 6000]
|
|
||||||
`,
|
|
||||||
{}
|
|
||||||
);
|
|
||||||
cy.get('svg');
|
|
||||||
});
|
|
||||||
it('Should render a chart without y-axis with different range', () => {
|
|
||||||
imgSnapshotTest(
|
|
||||||
`
|
|
||||||
xychart-beta
|
|
||||||
x-axis Months [jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec]
|
|
||||||
bar [5000, 6000, 7500, 8200, 9500, 10500, 14000, 3200, 9200, 9900, 3400, 6000]
|
|
||||||
line [2000, 7000, 6500, 9200, 9500, 7500, 11000, 10200, 3200, 8500, 7000, 8800]
|
|
||||||
`,
|
|
||||||
{}
|
|
||||||
);
|
|
||||||
cy.get('svg');
|
|
||||||
});
|
|
||||||
it('x axis title not required', () => {
|
|
||||||
imgSnapshotTest(
|
|
||||||
`
|
|
||||||
xychart-beta
|
|
||||||
x-axis [jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec]
|
|
||||||
bar [5000, 6000, 7500, 8200, 9500, 10500, 14000, 3200, 9200, 9900, 3400, 6000]
|
|
||||||
line [2000, 7000, 6500, 9200, 9500, 7500, 11000, 10200, 3200, 8500, 7000, 8800]
|
|
||||||
`,
|
|
||||||
{}
|
|
||||||
);
|
|
||||||
cy.get('svg');
|
|
||||||
});
|
|
||||||
it('Multiple plots can be rendered', () => {
|
|
||||||
imgSnapshotTest(
|
|
||||||
`
|
|
||||||
xychart-beta
|
|
||||||
line [23, 46, 77, 34]
|
|
||||||
line [45, 32, 33, 12]
|
|
||||||
bar [87, 54, 99, 85]
|
|
||||||
line [78, 88, 22, 4]
|
|
||||||
line [22, 29, 75, 33]
|
|
||||||
bar [52, 96, 35, 10]
|
|
||||||
`,
|
|
||||||
{}
|
|
||||||
);
|
|
||||||
cy.get('svg');
|
|
||||||
});
|
|
||||||
it('Decimals and negative numbers are supported', () => {
|
|
||||||
imgSnapshotTest(
|
|
||||||
`
|
|
||||||
xychart-beta
|
|
||||||
y-axis -2.4 --> 3.5
|
|
||||||
line [+1.3, .6, 2.4, -.34]
|
|
||||||
`,
|
|
||||||
{}
|
|
||||||
);
|
|
||||||
cy.get('svg');
|
|
||||||
});
|
|
||||||
it('Render spark line with "plotReservedSpacePercent"', () => {
|
|
||||||
imgSnapshotTest(
|
|
||||||
`
|
|
||||||
---
|
|
||||||
config:
|
|
||||||
theme: dark
|
|
||||||
xyChart:
|
|
||||||
width: 200
|
|
||||||
height: 20
|
|
||||||
plotReservedSpacePercent: 100
|
|
||||||
---
|
|
||||||
xychart-beta
|
|
||||||
line [5000, 9000, 7500, 6200, 9500, 5500, 11000, 8200, 9200, 9500, 7000, 8800]
|
|
||||||
`,
|
|
||||||
{}
|
|
||||||
);
|
|
||||||
cy.get('svg');
|
|
||||||
});
|
|
||||||
it('Render spark bar without displaying other property', () => {
|
|
||||||
imgSnapshotTest(
|
|
||||||
`
|
|
||||||
---
|
|
||||||
config:
|
|
||||||
theme: dark
|
|
||||||
xyChart:
|
|
||||||
width: 200
|
|
||||||
height: 20
|
|
||||||
xAxis:
|
|
||||||
showLabel: false
|
|
||||||
showTitle: false
|
|
||||||
showTick: false
|
|
||||||
showAxisLine: false
|
|
||||||
yAxis:
|
|
||||||
showLabel: false
|
|
||||||
showTitle: false
|
|
||||||
showTick: false
|
|
||||||
showAxisLine: false
|
|
||||||
---
|
|
||||||
xychart-beta
|
|
||||||
bar [5000, 9000, 7500, 6200, 9500, 5500, 11000, 8200, 9200, 9500, 7000, 8800]
|
|
||||||
`,
|
|
||||||
{}
|
|
||||||
);
|
|
||||||
cy.get('svg');
|
|
||||||
});
|
|
||||||
it('Should use all the config from directive', () => {
|
|
||||||
imgSnapshotTest(
|
|
||||||
`
|
|
||||||
%%{init: {"xyChart": {"width": 1000, "height": 600, "titlePadding": 5, "titleFontSize": 10, "xAxis": {"labelFontSize": "20", "labelPadding": 10, "titleFontSize": 30, "titlePadding": 20, "tickLength": 10, "tickWidth": 5}, "yAxis": {"labelFontSize": "20", "labelPadding": 10, "titleFontSize": 30, "titlePadding": 20, "tickLength": 10, "tickWidth": 5}, "plotBorderWidth": 5, "chartOrientation": "horizontal", "plotReservedSpacePercent": 60 }}}%%
|
|
||||||
xychart-beta
|
|
||||||
title "Sales Revenue"
|
|
||||||
x-axis Months [jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec]
|
|
||||||
y-axis "Revenue (in $)" 4000 --> 11000
|
|
||||||
bar [5000, 6000, 7500, 8200, 9500, 10500, 11000, 10200, 9200, 8500, 7000, 6000]
|
|
||||||
line [5000, 6000, 7500, 8200, 9500, 10500, 11000, 10200, 9200, 8500, 7000, 6000]
|
|
||||||
`,
|
|
||||||
{}
|
|
||||||
);
|
|
||||||
cy.get('svg');
|
|
||||||
});
|
|
||||||
it('Should use all the config from yaml', () => {
|
|
||||||
imgSnapshotTest(
|
|
||||||
`
|
|
||||||
---
|
|
||||||
config:
|
|
||||||
theme: forest
|
|
||||||
xyChart:
|
|
||||||
width: 1000
|
|
||||||
height: 600
|
|
||||||
titlePadding: 5
|
|
||||||
titleFontSize: 10
|
|
||||||
xAxis:
|
|
||||||
labelFontSize: 20
|
|
||||||
labelPadding: 10
|
|
||||||
titleFontSize: 30
|
|
||||||
titlePadding: 20
|
|
||||||
tickLength: 10
|
|
||||||
tickWidth: 5
|
|
||||||
axisLineWidth: 5
|
|
||||||
yAxis:
|
|
||||||
labelFontSize: 20
|
|
||||||
labelPadding: 10
|
|
||||||
titleFontSize: 30
|
|
||||||
titlePadding: 20
|
|
||||||
tickLength: 10
|
|
||||||
tickWidth: 5
|
|
||||||
axisLineWidth: 5
|
|
||||||
chartOrientation: horizontal
|
|
||||||
plotReservedSpacePercent: 60
|
|
||||||
---
|
|
||||||
xychart-beta
|
|
||||||
title "Sales Revenue"
|
|
||||||
x-axis Months [jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec]
|
|
||||||
y-axis "Revenue (in $)" 4000 --> 11000
|
|
||||||
bar [5000, 6000, 7500, 8200, 9500, 10500, 11000, 10200, 9200, 8500, 7000, 6000]
|
|
||||||
line [5000, 6000, 7500, 8200, 9500, 10500, 11000, 10200, 9200, 8500, 7000, 6000]
|
|
||||||
`,
|
|
||||||
{}
|
|
||||||
);
|
|
||||||
cy.get('svg');
|
|
||||||
});
|
|
||||||
it('Render with show axis title false', () => {
|
|
||||||
imgSnapshotTest(
|
|
||||||
`
|
|
||||||
---
|
|
||||||
config:
|
|
||||||
xyChart:
|
|
||||||
xAxis:
|
|
||||||
showTitle: false
|
|
||||||
yAxis:
|
|
||||||
showTitle: false
|
|
||||||
---
|
|
||||||
xychart-beta
|
|
||||||
title "Sales Revenue"
|
|
||||||
x-axis Months [jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec]
|
|
||||||
y-axis "Revenue (in $)" 4000 --> 11000
|
|
||||||
bar [5000, 6000, 7500, 8200, 9500, 10500, 11000, 10200, 9200, 8500, 7000, 6000]
|
|
||||||
line [5000, 6000, 7500, 8200, 9500, 10500, 11000, 10200, 9200, 8500, 7000, 6000]
|
|
||||||
`,
|
|
||||||
{}
|
|
||||||
);
|
|
||||||
cy.get('svg');
|
|
||||||
});
|
|
||||||
it('Render with show axis label false', () => {
|
|
||||||
imgSnapshotTest(
|
|
||||||
`
|
|
||||||
---
|
|
||||||
config:
|
|
||||||
xyChart:
|
|
||||||
xAxis:
|
|
||||||
showLabel: false
|
|
||||||
yAxis:
|
|
||||||
showLabel: false
|
|
||||||
---
|
|
||||||
xychart-beta
|
|
||||||
title "Sales Revenue"
|
|
||||||
x-axis Months [jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec]
|
|
||||||
y-axis "Revenue (in $)" 4000 --> 11000
|
|
||||||
bar [5000, 6000, 7500, 8200, 9500, 10500, 11000, 10200, 9200, 8500, 7000, 6000]
|
|
||||||
line [5000, 6000, 7500, 8200, 9500, 10500, 11000, 10200, 9200, 8500, 7000, 6000]
|
|
||||||
`,
|
|
||||||
{}
|
|
||||||
);
|
|
||||||
cy.get('svg');
|
|
||||||
});
|
|
||||||
it('Render with show axis tick false', () => {
|
|
||||||
imgSnapshotTest(
|
|
||||||
`
|
|
||||||
---
|
|
||||||
config:
|
|
||||||
xyChart:
|
|
||||||
xAxis:
|
|
||||||
showTick: false
|
|
||||||
yAxis:
|
|
||||||
showTick: false
|
|
||||||
---
|
|
||||||
xychart-beta
|
|
||||||
title "Sales Revenue"
|
|
||||||
x-axis Months [jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec]
|
|
||||||
y-axis "Revenue (in $)" 4000 --> 11000
|
|
||||||
bar [5000, 6000, 7500, 8200, 9500, 10500, 11000, 10200, 9200, 8500, 7000, 6000]
|
|
||||||
line [5000, 6000, 7500, 8200, 9500, 10500, 11000, 10200, 9200, 8500, 7000, 6000]
|
|
||||||
`,
|
|
||||||
{}
|
|
||||||
);
|
|
||||||
cy.get('svg');
|
|
||||||
});
|
|
||||||
it('Render with show axis line false', () => {
|
|
||||||
imgSnapshotTest(
|
|
||||||
`
|
|
||||||
---
|
|
||||||
config:
|
|
||||||
xyChart:
|
|
||||||
xAxis:
|
|
||||||
showAxisLine: false
|
|
||||||
yAxis:
|
|
||||||
showAxisLine: false
|
|
||||||
---
|
|
||||||
xychart-beta
|
|
||||||
title "Sales Revenue"
|
|
||||||
x-axis Months [jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec]
|
|
||||||
y-axis "Revenue (in $)" 4000 --> 11000
|
|
||||||
bar [5000, 6000, 7500, 8200, 9500, 10500, 11000, 10200, 9200, 8500, 7000, 6000]
|
|
||||||
line [5000, 6000, 7500, 8200, 9500, 10500, 11000, 10200, 9200, 8500, 7000, 6000]
|
|
||||||
`,
|
|
||||||
{}
|
|
||||||
);
|
|
||||||
cy.get('svg');
|
|
||||||
});
|
|
||||||
it('Render all the theme color', () => {
|
|
||||||
imgSnapshotTest(
|
|
||||||
`
|
|
||||||
---
|
|
||||||
config:
|
|
||||||
themeVariables:
|
|
||||||
xyChart:
|
|
||||||
titleColor: "#ff0000"
|
|
||||||
backgroundColor: "#f0f8ff"
|
|
||||||
yAxisLabelColor: "#ee82ee"
|
|
||||||
yAxisTitleColor: "#7fffd4"
|
|
||||||
yAxisTickColor: "#87ceeb"
|
|
||||||
yAxisLineColor: "#ff6347"
|
|
||||||
xAxisLabelColor: "#7fffd4"
|
|
||||||
xAxisTitleColor: "#ee82ee"
|
|
||||||
xAxisTickColor: "#ff6347"
|
|
||||||
xAxisLineColor: "#87ceeb"
|
|
||||||
plotColorPalette: "#008000, #faba63"
|
|
||||||
---
|
|
||||||
xychart-beta
|
|
||||||
title "Sales Revenue"
|
|
||||||
x-axis Months [jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec]
|
|
||||||
y-axis "Revenue (in $)" 4000 --> 11000
|
|
||||||
bar [5000, 6000, 7500, 8200, 9500, 10500, 11000, 10200, 9200, 8500, 7000, 6000]
|
|
||||||
line [5000, 6000, 7500, 8200, 9500, 10500, 11000, 10200, 9200, 8500, 7000, 6000]
|
|
||||||
`,
|
|
||||||
{}
|
|
||||||
);
|
|
||||||
cy.get('svg');
|
|
||||||
});
|
|
||||||
});
|
|
@@ -1,4 +1,4 @@
|
|||||||
import { imgSnapshotTest } from '../../helpers/util.ts';
|
import { imgSnapshotTest } from '../../helpers/util.js';
|
||||||
|
|
||||||
describe('Zen UML', () => {
|
describe('Zen UML', () => {
|
||||||
it('Basic Zen UML diagram', () => {
|
it('Basic Zen UML diagram', () => {
|
||||||
|
File diff suppressed because one or more lines are too long
@@ -58,32 +58,6 @@
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<pre id="diagram" class="mermaid">
|
<pre id="diagram" class="mermaid">
|
||||||
flowchart TB
|
|
||||||
C & D & E & F & G & H & I & J & K & L & M & N & O & P & Q & R & S & T & U & V & W & X & Y & Z & A1 & A2 & A3 & A4 & A5 & A6 & A7 & A8
|
|
||||||
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------->
|
|
||||||
C & D & E & F & G & H & I & J & K & L & M & N & O & P & Q & R & S & T & U & V & W & X & Y & Z & A1 & A2 & A3 & A4 & A5 & A6 & A7 & A8
|
|
||||||
|
|
||||||
</pre>
|
|
||||||
<pre id="diagram" class="mermaid2">
|
|
||||||
flowchart TB
|
|
||||||
A & A & A & A & A & A & A & A ---> C & D & E & F & G & H & I & J & K & L & M & N & O & P & Q & R & S & T & U & V & W & X & Y & Z
|
|
||||||
</pre>
|
|
||||||
<pre id="diagram" class="mermaid2">
|
|
||||||
flowchart TB
|
|
||||||
A1 & A2 & A3 & A4 & A5 & A6 & A7 & A8 --> C & D & E & F & G & H & I & J & K & L & M & N & O & P & Q & R & S & T & U & V & W & X & Y & Z
|
|
||||||
</pre>
|
|
||||||
<pre id="diagram" class="mermaid2">
|
|
||||||
flowchart
|
|
||||||
Node1:::class1 --> Node2:::class2
|
|
||||||
Node1:::class1 --> Node3:::class2
|
|
||||||
Node3 --> Node4((I am a circle)):::larger
|
|
||||||
|
|
||||||
classDef class1 fill:lightblue
|
|
||||||
classDef class2 fill:pink
|
|
||||||
classDef larger font-size:30px,fill:yellow
|
|
||||||
</pre
|
|
||||||
>
|
|
||||||
<pre id="diagram" class="mermaid2">
|
|
||||||
stateDiagram-v2
|
stateDiagram-v2
|
||||||
[*] --> Still
|
[*] --> Still
|
||||||
Still --> [*]
|
Still --> [*]
|
||||||
@@ -99,7 +73,7 @@ flowchart RL
|
|||||||
a1 -- l2 --> a2
|
a1 -- l2 --> a2
|
||||||
end
|
end
|
||||||
</pre>
|
</pre>
|
||||||
<pre id="diagram" class="mermaid2">
|
<pre id="diagram" class="mermaid">
|
||||||
flowchart RL
|
flowchart RL
|
||||||
subgraph "`one`"
|
subgraph "`one`"
|
||||||
a1 -- l1 --> a2
|
a1 -- l1 --> a2
|
||||||
@@ -124,11 +98,11 @@ flowchart LR
|
|||||||
way`"]
|
way`"]
|
||||||
</pre
|
</pre
|
||||||
>
|
>
|
||||||
<pre id="diagram" class="mermaid2">
|
<pre id="diagram" class="mermaid">
|
||||||
classDiagram-v2
|
classDiagram-v2
|
||||||
note "I love this diagram!\nDo you love it?"
|
note "I love this diagram!\nDo you love it?"
|
||||||
</pre>
|
</pre>
|
||||||
<pre id="diagram" class="mermaid2">
|
<pre id="diagram" class="mermaid">
|
||||||
stateDiagram-v2
|
stateDiagram-v2
|
||||||
State1: The state with a note with minus - and plus + in it
|
State1: The state with a note with minus - and plus + in it
|
||||||
note left of State1
|
note left of State1
|
||||||
@@ -173,7 +147,7 @@ mindmap
|
|||||||
शान्तिः سلام 和平 `"]
|
शान्तिः سلام 和平 `"]
|
||||||
|
|
||||||
</pre>
|
</pre>
|
||||||
<pre id="diagram" class="mermaid2">
|
<pre id="diagram" class="mermaid">
|
||||||
%%{init: {"flowchart": {"defaultRenderer": "elk"}} }%%
|
%%{init: {"flowchart": {"defaultRenderer": "elk"}} }%%
|
||||||
flowchart TB
|
flowchart TB
|
||||||
%% I could not figure out how to use double quotes in labels in Mermaid
|
%% I could not figure out how to use double quotes in labels in Mermaid
|
||||||
@@ -425,32 +399,21 @@ mindmap
|
|||||||
mermaid.parseError = function (err, hash) {
|
mermaid.parseError = function (err, hash) {
|
||||||
// console.error('Mermaid error: ', err);
|
// console.error('Mermaid error: ', err);
|
||||||
};
|
};
|
||||||
// mermaid.initialize({
|
|
||||||
// // theme: 'forest',
|
|
||||||
// startOnLoad: true,
|
|
||||||
// logLevel: 0,
|
|
||||||
// flowchart: {
|
|
||||||
// // defaultRenderer: 'elk',
|
|
||||||
// useMaxWidth: false,
|
|
||||||
// // htmlLabels: false,
|
|
||||||
// htmlLabels: true,
|
|
||||||
// },
|
|
||||||
// // htmlLabels: false,
|
|
||||||
// gantt: {
|
|
||||||
// useMaxWidth: false,
|
|
||||||
// },
|
|
||||||
// useMaxWidth: false,
|
|
||||||
// });
|
|
||||||
mermaid.initialize({
|
mermaid.initialize({
|
||||||
flowchart: { titleTopMargin: 10 },
|
// theme: 'forest',
|
||||||
fontFamily: 'courier',
|
startOnLoad: true,
|
||||||
sequence: {
|
|
||||||
actorFontFamily: 'courier',
|
|
||||||
noteFontFamily: 'courier',
|
|
||||||
messageFontFamily: 'courier',
|
|
||||||
},
|
|
||||||
fontSize: 16,
|
|
||||||
logLevel: 0,
|
logLevel: 0,
|
||||||
|
flowchart: {
|
||||||
|
// defaultRenderer: 'elk',
|
||||||
|
useMaxWidth: false,
|
||||||
|
// htmlLabels: false,
|
||||||
|
htmlLabels: true,
|
||||||
|
},
|
||||||
|
// htmlLabels: false,
|
||||||
|
gantt: {
|
||||||
|
useMaxWidth: false,
|
||||||
|
},
|
||||||
|
useMaxWidth: false,
|
||||||
});
|
});
|
||||||
function callback() {
|
function callback() {
|
||||||
alert('It worked');
|
alert('It worked');
|
||||||
|
@@ -1,53 +0,0 @@
|
|||||||
<html>
|
|
||||||
<head> </head>
|
|
||||||
<body>
|
|
||||||
<h1>Example</h1>
|
|
||||||
<pre class="mermaid">
|
|
||||||
%%{init:{"theme":"base", "themeVariables": {"lineColor":"red"}}}%%
|
|
||||||
flowchart LR
|
|
||||||
subgraph red
|
|
||||||
A --> B
|
|
||||||
end
|
|
||||||
</pre>
|
|
||||||
<pre class="mermaid">
|
|
||||||
%%{init:{"theme":"base", "themeVariables": {"lineColor":"blue"}}}%%
|
|
||||||
flowchart LR
|
|
||||||
subgraph black
|
|
||||||
A --> B
|
|
||||||
end
|
|
||||||
</pre>
|
|
||||||
<pre class="mermaid">
|
|
||||||
---
|
|
||||||
config:
|
|
||||||
theme: base
|
|
||||||
themeVariables:
|
|
||||||
lineColor: yellow
|
|
||||||
---
|
|
||||||
flowchart LR
|
|
||||||
subgraph red
|
|
||||||
A --> B
|
|
||||||
end
|
|
||||||
</pre>
|
|
||||||
<pre class="mermaid">
|
|
||||||
---
|
|
||||||
config:
|
|
||||||
theme: base
|
|
||||||
themeVariables:
|
|
||||||
lineColor: green
|
|
||||||
---
|
|
||||||
flowchart LR
|
|
||||||
subgraph black
|
|
||||||
A --> B
|
|
||||||
end
|
|
||||||
</pre>
|
|
||||||
<script type="module">
|
|
||||||
import mermaid from './mermaid.esm.mjs';
|
|
||||||
mermaid.initialize({ startOnLoad: false, logLevel: 0 });
|
|
||||||
await mermaid.run();
|
|
||||||
|
|
||||||
if (window.Cypress) {
|
|
||||||
window.rendered = true;
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@@ -1,6 +1,15 @@
|
|||||||
<html>
|
<html>
|
||||||
<head>
|
<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 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>
|
<style>
|
||||||
body {
|
body {
|
||||||
/* background: rgb(221, 208, 208); */
|
/* background: rgb(221, 208, 208); */
|
||||||
@@ -113,21 +122,26 @@
|
|||||||
|
|
||||||
<script type="module">
|
<script type="module">
|
||||||
import mermaid from './mermaid.esm.mjs';
|
import mermaid from './mermaid.esm.mjs';
|
||||||
|
mermaid.parseError = function (err, hash) {
|
||||||
|
// console.error('Mermaid error: ', err);
|
||||||
|
};
|
||||||
mermaid.initialize({
|
mermaid.initialize({
|
||||||
|
// theme: 'dark',
|
||||||
|
// theme: 'dark',
|
||||||
|
// arrowMarkerAbsolute: true,
|
||||||
|
// themeCSS: '.edgePath .path {stroke: red;} .arrowheadPath {fill: red;}',
|
||||||
logLevel: 0,
|
logLevel: 0,
|
||||||
|
// flowchart: { useMaxWidth: true },
|
||||||
graph: { curve: 'cardinal', htmlLabels: false },
|
graph: { curve: 'cardinal', htmlLabels: false },
|
||||||
|
// gantt: { axisFormat: '%m/%d/%Y' },
|
||||||
sequence: { actorMargin: 50, showSequenceNumbers: true },
|
sequence: { actorMargin: 50, showSequenceNumbers: true },
|
||||||
|
// sequenceDiagram: { actorMargin: 300 } // deprecated
|
||||||
fontFamily: '"arial", sans-serif',
|
fontFamily: '"arial", sans-serif',
|
||||||
curve: 'cardinal',
|
curve: 'cardinal',
|
||||||
securityLevel: 'strict',
|
securityLevel: 'strict',
|
||||||
startOnLoad: false,
|
|
||||||
});
|
});
|
||||||
|
function callback() {
|
||||||
await mermaid.run();
|
alert('It worked');
|
||||||
|
|
||||||
if (window.Cypress) {
|
|
||||||
window.rendered = true;
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
@@ -42,16 +42,6 @@
|
|||||||
font-size: 72px;
|
font-size: 72px;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<script>
|
|
||||||
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 Succeeded');
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div>Security check</div>
|
<div>Security check</div>
|
||||||
|
@@ -42,16 +42,6 @@
|
|||||||
font-size: 72px;
|
font-size: 72px;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<script>
|
|
||||||
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 Succeeded');
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div>Security check</div>
|
<div>Security check</div>
|
||||||
|
@@ -42,16 +42,6 @@
|
|||||||
font-size: 72px;
|
font-size: 72px;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<script>
|
|
||||||
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 Succeeded');
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div>Security check</div>
|
<div>Security check</div>
|
||||||
|
@@ -42,16 +42,6 @@
|
|||||||
font-size: 72px;
|
font-size: 72px;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<script>
|
|
||||||
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 Succeeded');
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div>Security check</div>
|
<div>Security check</div>
|
||||||
|
@@ -42,16 +42,6 @@
|
|||||||
font-size: 72px;
|
font-size: 72px;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<script>
|
|
||||||
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 Succeeded');
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div>Security check</div>
|
<div>Security check</div>
|
||||||
|
@@ -42,16 +42,6 @@
|
|||||||
font-size: 72px;
|
font-size: 72px;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<script>
|
|
||||||
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 Succeeded');
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div>Security check</div>
|
<div>Security check</div>
|
||||||
|
@@ -42,16 +42,6 @@
|
|||||||
font-size: 72px;
|
font-size: 72px;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<script>
|
|
||||||
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 Succeeded');
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div>Security check</div>
|
<div>Security check</div>
|
||||||
|
@@ -42,16 +42,6 @@
|
|||||||
font-size: 72px;
|
font-size: 72px;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<script>
|
|
||||||
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 Succeeded');
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div>Security check</div>
|
<div>Security check</div>
|
||||||
|
@@ -42,16 +42,6 @@
|
|||||||
font-size: 72px;
|
font-size: 72px;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<script>
|
|
||||||
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 Succeeded');
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div>Security check</div>
|
<div>Security check</div>
|
||||||
|
@@ -42,16 +42,6 @@
|
|||||||
font-size: 72px;
|
font-size: 72px;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<script>
|
|
||||||
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 Succeeded');
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div>Security check</div>
|
<div>Security check</div>
|
||||||
|
@@ -42,16 +42,6 @@
|
|||||||
font-size: 72px;
|
font-size: 72px;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<script>
|
|
||||||
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 Succeeded');
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div>Security check</div>
|
<div>Security check</div>
|
||||||
|
@@ -42,16 +42,6 @@
|
|||||||
font-size: 72px;
|
font-size: 72px;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<script>
|
|
||||||
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 Succeeded');
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div>Security check</div>
|
<div>Security check</div>
|
||||||
|
@@ -1,109 +0,0 @@
|
|||||||
<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>
|
|
||||||
<script>
|
|
||||||
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 Succeeded');
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div>Security check</div>
|
|
||||||
<div class="flex">
|
|
||||||
<div id="diagram" class="mermaid"></div>
|
|
||||||
<div id="res" class=""></div>
|
|
||||||
</div>
|
|
||||||
<script type="module">
|
|
||||||
import mermaid from './mermaid.esm.mjs';
|
|
||||||
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: false,
|
|
||||||
// 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: 'strict',
|
|
||||||
startOnLoad: false,
|
|
||||||
secure: ['secure', 'securityLevel', 'startOnLoad', 'maxTextSize'],
|
|
||||||
// themeVariables: {relationLabelColor: 'red'}
|
|
||||||
});
|
|
||||||
function callback() {
|
|
||||||
alert('It worked');
|
|
||||||
}
|
|
||||||
|
|
||||||
let diagram = 'classDiagram\n';
|
|
||||||
diagram += '`Class<img src=x on';
|
|
||||||
diagram += 'error=xssAttack()>` <|-- `Class2<img src=x on';
|
|
||||||
diagram += 'error=xssAttack()>`';
|
|
||||||
|
|
||||||
console.log(diagram);
|
|
||||||
// document.querySelector('#diagram').innerHTML = diagram;
|
|
||||||
const { svg } = await mermaid.render('diagram', diagram);
|
|
||||||
document.querySelector('#res').innerHTML = svg;
|
|
||||||
</script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@@ -42,16 +42,6 @@
|
|||||||
font-size: 72px;
|
font-size: 72px;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<script>
|
|
||||||
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 Succeeded');
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div>Security check</div>
|
<div>Security check</div>
|
||||||
@@ -94,6 +84,14 @@
|
|||||||
function callback() {
|
function callback() {
|
||||||
alert('It worked');
|
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 Succeeded');
|
||||||
|
}
|
||||||
let diagram = 'graph LR\n';
|
let diagram = 'graph LR\n';
|
||||||
diagram += 'B-->D("<img onerror=location=`java';
|
diagram += 'B-->D("<img onerror=location=`java';
|
||||||
// diagram += "script\u003aalert\u0028document.domain\u0029\` src=x>\"\);\n";
|
// diagram += "script\u003aalert\u0028document.domain\u0029\` src=x>\"\);\n";
|
||||||
|
@@ -42,16 +42,6 @@
|
|||||||
font-size: 72px;
|
font-size: 72px;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<script>
|
|
||||||
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 Succeeded');
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div>Security check</div>
|
<div>Security check</div>
|
||||||
|
@@ -42,16 +42,6 @@
|
|||||||
font-size: 72px;
|
font-size: 72px;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<script>
|
|
||||||
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 Succeeded');
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div>Security check</div>
|
<div>Security check</div>
|
||||||
|
@@ -42,16 +42,6 @@
|
|||||||
font-size: 72px;
|
font-size: 72px;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<script>
|
|
||||||
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 Succeeded');
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div>Security check</div>
|
<div>Security check</div>
|
||||||
|
@@ -42,16 +42,6 @@
|
|||||||
font-size: 72px;
|
font-size: 72px;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<script>
|
|
||||||
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 Succeeded');
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div>Security check</div>
|
<div>Security check</div>
|
||||||
|
@@ -2,9 +2,7 @@
|
|||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"target": "es2020",
|
"target": "es2020",
|
||||||
"lib": ["es2020", "dom"],
|
"lib": ["es2020", "dom"],
|
||||||
"types": ["cypress", "node"],
|
"types": ["cypress", "node"]
|
||||||
"allowImportingTsExtensions": true,
|
|
||||||
"noEmit": true
|
|
||||||
},
|
},
|
||||||
"include": ["**/*.ts"]
|
"include": ["**/*.ts"]
|
||||||
}
|
}
|
||||||
|
@@ -173,7 +173,7 @@
|
|||||||
Container(mobile, "Mobile App", "Xamarin", "Provides a limited subset of the Internet Banking functionality to customers via their mobile device.")
|
Container(mobile, "Mobile App", "Xamarin", "Provides a limited subset of the Internet Banking functionality to customers via their mobile device.")
|
||||||
}
|
}
|
||||||
|
|
||||||
Deployment_Node(comp, "Customer's computer", "Microsoft Windows or Apple macOS"){
|
Deployment_Node(comp, "Customer's computer", "Mircosoft Windows or Apple macOS"){
|
||||||
Deployment_Node(browser, "Web Browser", "Google Chrome, Mozilla Firefox,<br/> Apple Safari or Microsoft Edge"){
|
Deployment_Node(browser, "Web Browser", "Google Chrome, Mozilla Firefox,<br/> Apple Safari or Microsoft Edge"){
|
||||||
Container(spa, "Single Page Application", "JavaScript and Angular", "Provides all of the Internet Banking functionality to customers via their web browser.")
|
Container(spa, "Single Page Application", "JavaScript and Angular", "Provides all of the Internet Banking functionality to customers via their web browser.")
|
||||||
}
|
}
|
||||||
|
@@ -38,14 +38,12 @@
|
|||||||
+quack()
|
+quack()
|
||||||
}
|
}
|
||||||
class Fish{
|
class Fish{
|
||||||
-Listint sizeInFeet
|
-int sizeInFeet
|
||||||
-canEat()
|
-canEat()
|
||||||
}
|
}
|
||||||
class Zebra{
|
class Zebra{
|
||||||
+bool is_wild
|
+bool is_wild
|
||||||
+run(List~T~, List~OT~)
|
+run()
|
||||||
%% +run-composite(List~T, K~)
|
|
||||||
+run-nested(List~List~OT~~)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
</pre>
|
</pre>
|
||||||
@@ -82,7 +80,6 @@
|
|||||||
Class01 : #size()
|
Class01 : #size()
|
||||||
Class01 : -int chimp
|
Class01 : -int chimp
|
||||||
Class01 : +int gorilla
|
Class01 : +int gorilla
|
||||||
Class01 : +abstractAttribute string*
|
|
||||||
class Class10~T~ {
|
class Class10~T~ {
|
||||||
<<service>>
|
<<service>>
|
||||||
int id
|
int id
|
||||||
@@ -125,8 +122,6 @@
|
|||||||
classDiagram
|
classDiagram
|
||||||
direction LR
|
direction LR
|
||||||
Animal ()-- Dog
|
Animal ()-- Dog
|
||||||
Animal ()-- Cat
|
|
||||||
note for Cat "should have no members area"
|
|
||||||
Dog : bark()
|
Dog : bark()
|
||||||
Dog : species()
|
Dog : species()
|
||||||
</pre>
|
</pre>
|
||||||
@@ -156,7 +151,6 @@
|
|||||||
~InternalProperty : string
|
~InternalProperty : string
|
||||||
~AnotherInternalProperty : List~List~string~~
|
~AnotherInternalProperty : List~List~string~~
|
||||||
}
|
}
|
||||||
class People List~List~Person~~
|
|
||||||
</pre>
|
</pre>
|
||||||
<hr />
|
<hr />
|
||||||
|
|
||||||
|
@@ -1,34 +0,0 @@
|
|||||||
<!--Do not edit this file-->
|
|
||||||
<!--Duplicate this file to any name you like, run `pnpm dev`, open http://localhost:9000/dev/name.html to view-->
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>Mermaid development page</title>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<pre id="diagram" class="mermaid">
|
|
||||||
graph TB
|
|
||||||
a --> b
|
|
||||||
a --> c
|
|
||||||
b --> d
|
|
||||||
c --> d
|
|
||||||
</pre>
|
|
||||||
|
|
||||||
<div id="dynamicDiagram"></div>
|
|
||||||
|
|
||||||
<script type="module">
|
|
||||||
import mermaid from '/mermaid.esm.mjs';
|
|
||||||
mermaid.parseError = function (err, hash) {
|
|
||||||
console.error('Mermaid error: ', err);
|
|
||||||
};
|
|
||||||
mermaid.initialize({
|
|
||||||
startOnLoad: true,
|
|
||||||
logLevel: 0,
|
|
||||||
});
|
|
||||||
const value = `graph TD\nHello --> World`;
|
|
||||||
const el = document.getElementById('dynamicDiagram');
|
|
||||||
const { svg } = await mermaid.render('dd', value);
|
|
||||||
console.log(svg);
|
|
||||||
el.innerHTML = svg;
|
|
||||||
</script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@@ -21,8 +21,6 @@
|
|||||||
<pre class="mermaid">
|
<pre class="mermaid">
|
||||||
---
|
---
|
||||||
title: This is a title
|
title: This is a title
|
||||||
config:
|
|
||||||
theme: forest
|
|
||||||
---
|
---
|
||||||
erDiagram
|
erDiagram
|
||||||
%% title This is a title
|
%% title This is a title
|
||||||
@@ -110,35 +108,6 @@
|
|||||||
}
|
}
|
||||||
MANUFACTURER only one to zero or more CAR : makes
|
MANUFACTURER only one to zero or more CAR : makes
|
||||||
</pre>
|
</pre>
|
||||||
<hr />
|
|
||||||
|
|
||||||
<pre class="mermaid">
|
|
||||||
erDiagram
|
|
||||||
p[Person] {
|
|
||||||
string firstName
|
|
||||||
string lastName
|
|
||||||
}
|
|
||||||
a["Customer Account"] {
|
|
||||||
string email
|
|
||||||
}
|
|
||||||
p ||--o| a : has
|
|
||||||
</pre>
|
|
||||||
<hr />
|
|
||||||
|
|
||||||
<pre class="mermaid">
|
|
||||||
erDiagram
|
|
||||||
_customer_order {
|
|
||||||
bigint id PK
|
|
||||||
bigint customer_id FK
|
|
||||||
text shipping_address
|
|
||||||
text delivery_method
|
|
||||||
timestamp_with_time_zone ordered_at
|
|
||||||
numeric total_tax_amount
|
|
||||||
numeric total_price
|
|
||||||
text payment_method
|
|
||||||
}
|
|
||||||
</pre>
|
|
||||||
<hr />
|
|
||||||
|
|
||||||
<script type="module">
|
<script type="module">
|
||||||
import mermaid from './mermaid.esm.mjs';
|
import mermaid from './mermaid.esm.mjs';
|
||||||
|
@@ -22,7 +22,7 @@
|
|||||||
---
|
---
|
||||||
graph LR
|
graph LR
|
||||||
accTitle: This is a complicated flow
|
accTitle: This is a complicated flow
|
||||||
accDescr: This is the description for the complicated flow.
|
accDescr: This is the descriptoin for the complicated flow.
|
||||||
|
|
||||||
sid-B3655226-6C29-4D00-B685-3D5C734DC7E1["
|
sid-B3655226-6C29-4D00-B685-3D5C734DC7E1["
|
||||||
|
|
||||||
@@ -123,13 +123,6 @@
|
|||||||
|
|
||||||
<h3>flowchart</h3>
|
<h3>flowchart</h3>
|
||||||
<pre class="mermaid">
|
<pre class="mermaid">
|
||||||
---
|
|
||||||
title: This is another complicated flow
|
|
||||||
config:
|
|
||||||
theme: base
|
|
||||||
flowchart:
|
|
||||||
curve: cardinal
|
|
||||||
---
|
|
||||||
flowchart LR
|
flowchart LR
|
||||||
sid-B3655226-6C29-4D00-B685-3D5C734DC7E1["
|
sid-B3655226-6C29-4D00-B685-3D5C734DC7E1["
|
||||||
|
|
||||||
|
@@ -60,9 +60,6 @@
|
|||||||
<li>
|
<li>
|
||||||
<h2><a href="./quadrantchart.html">Quadrant charts</a></h2>
|
<h2><a href="./quadrantchart.html">Quadrant charts</a></h2>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
|
||||||
<h2><a href="./xychart.html">XY charts</a></h2>
|
|
||||||
</li>
|
|
||||||
<li>
|
<li>
|
||||||
<h2><a href="./requirements.html">Requirements</a></h2>
|
<h2><a href="./requirements.html">Requirements</a></h2>
|
||||||
</li>
|
</li>
|
||||||
@@ -78,9 +75,6 @@
|
|||||||
<li>
|
<li>
|
||||||
<h2><a href="./zenuml.html">ZenUML</a></h2>
|
<h2><a href="./zenuml.html">ZenUML</a></h2>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
|
||||||
<h2><a href="./sankey.html">Sankey</a></h2>
|
|
||||||
</li>
|
|
||||||
</ul>
|
</ul>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@@ -7,6 +7,7 @@
|
|||||||
<link rel="icon" type="image/png" href="data:image/png;base64,iVBORw0KGgo=" />
|
<link rel="icon" type="image/png" href="data:image/png;base64,iVBORw0KGgo=" />
|
||||||
<style>
|
<style>
|
||||||
div.mermaid {
|
div.mermaid {
|
||||||
|
/* font-family: 'trebuchet ms', verdana, arial; */
|
||||||
font-family: 'Courier New', Courier, monospace !important;
|
font-family: 'Courier New', Courier, monospace !important;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
@@ -18,30 +19,35 @@
|
|||||||
pie title Pets adopted by volunteers
|
pie title Pets adopted by volunteers
|
||||||
accTitle: simple pie char demo
|
accTitle: simple pie char demo
|
||||||
accDescr: pie chart with 3 sections: dogs, cats, rats. Most are dogs.
|
accDescr: pie chart with 3 sections: dogs, cats, rats. Most are dogs.
|
||||||
"Dogs": 386
|
"Dogs" : 386
|
||||||
"Cats": 85
|
"Cats" : 85
|
||||||
"Rats": 15
|
"Rats" : 15
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
<hr />
|
<hr />
|
||||||
<pre class="mermaid">
|
<pre class="mermaid">
|
||||||
%%{init: {"pie": {"textPosition": 0.9}, "themeVariables": {"pieOuterStrokeWidth": "5px"}}}%%
|
%%{init: {"pie": {"textPosition": 0.9}, "themeVariables": {"pieOuterStrokeWidth": "5px"}} }%%
|
||||||
pie
|
pie
|
||||||
title Key elements in Product X
|
title Key elements in Product X
|
||||||
accTitle: Key elements in Product X
|
accTitle: Key elements in Product X
|
||||||
accDescr: This is a pie chart showing the key elements in Product X.
|
accDescr: This is a pie chart showing the key elements in Product X.
|
||||||
"Calcium": 42.96
|
"Calcium" : 42.96
|
||||||
"Potassium": 50.05
|
"Potassium" : 50.05
|
||||||
"Magnesium": 10.01
|
"Magnesium" : 10.01
|
||||||
"Iron": 5
|
"Iron" : 5
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
<script type="module">
|
<script type="module">
|
||||||
import mermaid from './mermaid.esm.mjs';
|
import mermaid from './mermaid.esm.mjs';
|
||||||
mermaid.initialize({
|
mermaid.initialize({
|
||||||
theme: 'forest',
|
theme: 'forest',
|
||||||
|
// themeCSS: '.node rect { fill: red; }',
|
||||||
logLevel: 3,
|
logLevel: 3,
|
||||||
securityLevel: 'loose',
|
securityLevel: 'loose',
|
||||||
|
// flowchart: { curve: 'basis' },
|
||||||
|
// gantt: { axisFormat: '%m/%d/%Y' },
|
||||||
|
sequence: { actorMargin: 50 },
|
||||||
|
// sequenceDiagram: { actorMargin: 300 } // deprecated
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
@@ -17,7 +17,7 @@
|
|||||||
<h1>Requirement diagram demos</h1>
|
<h1>Requirement diagram demos</h1>
|
||||||
<pre class="mermaid">
|
<pre class="mermaid">
|
||||||
requirementDiagram
|
requirementDiagram
|
||||||
accTitle: Requirements demo in black and white
|
accTitle: Requirments demo in black and white
|
||||||
accDescr: A series of requirement boxes showing relationships among them. Has meaningless task names
|
accDescr: A series of requirement boxes showing relationships among them. Has meaningless task names
|
||||||
|
|
||||||
requirement test_req {
|
requirement test_req {
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user