mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-11-04 21:04:12 +01:00
Compare commits
64 Commits
bugfix/545
...
renovate/p
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0ac60bcaf9 | ||
|
|
dfd59470dc | ||
|
|
4aac6fa448 | ||
|
|
5f96f80efb | ||
|
|
545801e144 | ||
|
|
0bd74759cc | ||
|
|
e4cf266c1d | ||
|
|
c0e1662e50 | ||
|
|
6546aed482 | ||
|
|
b76ccae065 | ||
|
|
287a9a3fcb | ||
|
|
7f5160fa4d | ||
|
|
7b0763f262 | ||
|
|
38c289818c | ||
|
|
57530076aa | ||
|
|
f2d7877c7a | ||
|
|
62d2c6505e | ||
|
|
974236bbb8 | ||
|
|
cf0d1248a4 | ||
|
|
ebefbd87a8 | ||
|
|
1e7b71a085 | ||
|
|
f28f3c25aa | ||
|
|
58137aa631 | ||
|
|
e7719f14c5 | ||
|
|
35d9cead8a | ||
|
|
13baf51b35 | ||
|
|
9af985ba9b | ||
|
|
c7f8a11ded | ||
|
|
762b44cf33 | ||
|
|
02c0091106 | ||
|
|
16359adc33 | ||
|
|
061632c580 | ||
|
|
cbf89462ac | ||
|
|
700aa100f2 | ||
|
|
49103ea654 | ||
|
|
3f46c94ab2 | ||
|
|
34f40f0794 | ||
|
|
32ac2c689d | ||
|
|
dbcadc1d0b | ||
|
|
ad82448084 | ||
|
|
9498619d3c | ||
|
|
7a8557a1a2 | ||
|
|
74863c94fb | ||
|
|
63df702146 | ||
|
|
421f8d4633 | ||
|
|
bf6e1a594c | ||
|
|
0116b272b4 | ||
|
|
634f3367da | ||
|
|
d60b09cafc | ||
|
|
875827f59b | ||
|
|
c4e08261b5 | ||
|
|
70f679d2fa | ||
|
|
25c43fa439 | ||
|
|
ec1c6325d4 | ||
|
|
309ff6be38 | ||
|
|
02d368df05 | ||
|
|
4ee1fe2ca4 | ||
|
|
2dd29bee25 | ||
|
|
259a508d8a | ||
|
|
1963064369 | ||
|
|
a101ce803c | ||
|
|
fc0c7936d1 | ||
|
|
2d2add5b44 | ||
|
|
58fd5ddbaf |
@@ -1,5 +0,0 @@
|
|||||||
---
|
|
||||||
'mermaid': patch
|
|
||||||
---
|
|
||||||
|
|
||||||
chore: Fix mindmap rendering in docs and apply tidytree layout
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
---
|
|
||||||
'mermaid': patch
|
|
||||||
---
|
|
||||||
|
|
||||||
fix: Ensure edge label color is applied when using classDef with edge IDs
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
---
|
|
||||||
'mermaid': patch
|
|
||||||
---
|
|
||||||
|
|
||||||
fix: Resolve gantt chart crash due to invalid array length
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
---
|
|
||||||
'mermaid': minor
|
|
||||||
---
|
|
||||||
|
|
||||||
feat: Add IDs in architecture diagrams
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
---
|
|
||||||
'mermaid': patch
|
|
||||||
---
|
|
||||||
|
|
||||||
chore: revert marked dependency from ^15.0.7 to ^16.0.0
|
|
||||||
|
|
||||||
- Reverted marked package version to ^16.0.0 for better compatibility
|
|
||||||
- This is a dependency update that maintains API compatibility
|
|
||||||
- All tests pass with the updated version
|
|
||||||
5
.changeset/short-seals-sort.md
Normal file
5
.changeset/short-seals-sort.md
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'mermaid': minor
|
||||||
|
---
|
||||||
|
|
||||||
|
feat: allow to put notes in namespaces on classDiagram
|
||||||
@@ -1,3 +1,5 @@
|
|||||||
|
!viewbox
|
||||||
|
# It should be viewBox
|
||||||
# This file contains coding related terms
|
# This file contains coding related terms
|
||||||
ALPHANUM
|
ALPHANUM
|
||||||
antiscript
|
antiscript
|
||||||
|
|||||||
@@ -64,6 +64,7 @@ rscratch
|
|||||||
shiki
|
shiki
|
||||||
Slidev
|
Slidev
|
||||||
sparkline
|
sparkline
|
||||||
|
speccharts
|
||||||
sphinxcontrib
|
sphinxcontrib
|
||||||
ssim
|
ssim
|
||||||
stylis
|
stylis
|
||||||
|
|||||||
@@ -71,6 +71,9 @@ export const getBuildConfig = (options: MermaidBuildOptions): BuildOptions => {
|
|||||||
|
|
||||||
const external: string[] = ['require', 'fs', 'path'];
|
const external: string[] = ['require', 'fs', 'path'];
|
||||||
const outFileName = getFileName(name, options);
|
const outFileName = getFileName(name, options);
|
||||||
|
const { dependencies, version } = JSON.parse(
|
||||||
|
readFileSync(resolve(__dirname, `../packages/${packageName}/package.json`), 'utf-8')
|
||||||
|
);
|
||||||
const output: BuildOptions = buildOptions({
|
const output: BuildOptions = buildOptions({
|
||||||
...rest,
|
...rest,
|
||||||
absWorkingDir: resolve(__dirname, `../packages/${packageName}`),
|
absWorkingDir: resolve(__dirname, `../packages/${packageName}`),
|
||||||
@@ -82,15 +85,13 @@ export const getBuildConfig = (options: MermaidBuildOptions): BuildOptions => {
|
|||||||
chunkNames: `chunks/${outFileName}/[name]-[hash]`,
|
chunkNames: `chunks/${outFileName}/[name]-[hash]`,
|
||||||
define: {
|
define: {
|
||||||
// This needs to be stringified for esbuild
|
// This needs to be stringified for esbuild
|
||||||
includeLargeFeatures: `${includeLargeFeatures}`,
|
'injected.includeLargeFeatures': `${includeLargeFeatures}`,
|
||||||
|
'injected.version': `'${version}'`,
|
||||||
'import.meta.vitest': 'undefined',
|
'import.meta.vitest': 'undefined',
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
if (core) {
|
if (core) {
|
||||||
const { dependencies } = JSON.parse(
|
|
||||||
readFileSync(resolve(__dirname, `../packages/${packageName}/package.json`), 'utf-8')
|
|
||||||
);
|
|
||||||
// Core build is used to generate file without bundled dependencies.
|
// Core build is used to generate file without bundled dependencies.
|
||||||
// This is used by downstream projects to bundle dependencies themselves.
|
// This is used by downstream projects to bundle dependencies themselves.
|
||||||
// Ignore dependencies and any dependencies of dependencies
|
// Ignore dependencies and any dependencies of dependencies
|
||||||
|
|||||||
2
.github/workflows/e2e-timings.yml
vendored
2
.github/workflows/e2e-timings.yml
vendored
@@ -58,7 +58,7 @@ jobs:
|
|||||||
echo "EOF" >> $GITHUB_OUTPUT
|
echo "EOF" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
- name: Commit and create pull request
|
- name: Commit and create pull request
|
||||||
uses: peter-evans/create-pull-request@915d841dae6a4f191bb78faf61a257411d7be4d2
|
uses: peter-evans/create-pull-request@0edc001d28a2959cd7a6b505629f1d82f0a6e67d
|
||||||
with:
|
with:
|
||||||
add-paths: |
|
add-paths: |
|
||||||
cypress/timings.json
|
cypress/timings.json
|
||||||
|
|||||||
1
.github/workflows/release.yml
vendored
1
.github/workflows/release.yml
vendored
@@ -42,5 +42,4 @@ jobs:
|
|||||||
publish: pnpm changeset:publish
|
publish: pnpm changeset:publish
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
||||||
NPM_CONFIG_PROVENANCE: true
|
NPM_CONFIG_PROVENANCE: true
|
||||||
|
|||||||
38
.github/workflows/validate-lockfile.yml
vendored
38
.github/workflows/validate-lockfile.yml
vendored
@@ -1,7 +1,7 @@
|
|||||||
name: Validate pnpm-lock.yaml
|
name: Validate pnpm-lock.yaml
|
||||||
|
|
||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request_target:
|
||||||
paths:
|
paths:
|
||||||
- 'pnpm-lock.yaml'
|
- 'pnpm-lock.yaml'
|
||||||
- '**/package.json'
|
- '**/package.json'
|
||||||
@@ -15,13 +15,8 @@ jobs:
|
|||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
ref: ${{ github.event.pull_request.head.sha }}
|
||||||
- name: Set up Node.js
|
repository: ${{ github.event.pull_request.head.repo.full_name }}
|
||||||
uses: actions/setup-node@v4
|
|
||||||
with:
|
|
||||||
node-version: 20
|
|
||||||
|
|
||||||
- uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4.1.0
|
|
||||||
|
|
||||||
- name: Validate pnpm-lock.yaml entries
|
- name: Validate pnpm-lock.yaml entries
|
||||||
id: validate # give this step an ID so we can reference its outputs
|
id: validate # give this step an ID so we can reference its outputs
|
||||||
@@ -55,16 +50,41 @@ jobs:
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
- name: Find existing lockfile validation comment
|
||||||
|
if: always()
|
||||||
|
uses: peter-evans/find-comment@v3
|
||||||
|
id: find-comment
|
||||||
|
with:
|
||||||
|
issue-number: ${{ github.event.pull_request.number }}
|
||||||
|
comment-author: 'github-actions[bot]'
|
||||||
|
body-includes: 'Lockfile Validation Failed'
|
||||||
|
|
||||||
- name: Comment on PR if validation failed
|
- name: Comment on PR if validation failed
|
||||||
if: failure()
|
if: failure()
|
||||||
uses: peter-evans/create-or-update-comment@v4
|
uses: peter-evans/create-or-update-comment@v5
|
||||||
with:
|
with:
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
issue-number: ${{ github.event.pull_request.number }}
|
issue-number: ${{ github.event.pull_request.number }}
|
||||||
|
comment-id: ${{ steps.find-comment.outputs.comment-id }}
|
||||||
|
edit-mode: replace
|
||||||
body: |
|
body: |
|
||||||
|
❌ **Lockfile Validation Failed**
|
||||||
|
|
||||||
The following issue(s) were detected:
|
The following issue(s) were detected:
|
||||||
${{ steps.validate.outputs.errors }}
|
${{ steps.validate.outputs.errors }}
|
||||||
|
|
||||||
Please address these and push an update.
|
Please address these and push an update.
|
||||||
|
|
||||||
_Posted automatically by GitHub Actions_
|
_Posted automatically by GitHub Actions_
|
||||||
|
|
||||||
|
- name: Delete comment if validation passed
|
||||||
|
if: success() && steps.find-comment.outputs.comment-id != ''
|
||||||
|
uses: actions/github-script@v7
|
||||||
|
with:
|
||||||
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
script: |
|
||||||
|
await github.rest.issues.deleteComment({
|
||||||
|
owner: context.repo.owner,
|
||||||
|
repo: context.repo.repo,
|
||||||
|
comment_id: ${{ steps.find-comment.outputs.comment-id }},
|
||||||
|
});
|
||||||
|
|||||||
@@ -78,6 +78,8 @@ export const getBuildConfig = ({ minify, core, watch, entryName }: BuildOptions)
|
|||||||
},
|
},
|
||||||
define: {
|
define: {
|
||||||
'import.meta.vitest': 'undefined',
|
'import.meta.vitest': 'undefined',
|
||||||
|
'injected.includeLargeFeatures': 'true',
|
||||||
|
'injected.version': `'0.0.0'`,
|
||||||
},
|
},
|
||||||
resolve: {
|
resolve: {
|
||||||
extensions: [],
|
extensions: [],
|
||||||
@@ -94,10 +96,6 @@ export const getBuildConfig = ({ minify, core, watch, entryName }: BuildOptions)
|
|||||||
}),
|
}),
|
||||||
...visualizerOptions(packageName, core),
|
...visualizerOptions(packageName, core),
|
||||||
],
|
],
|
||||||
define: {
|
|
||||||
// Needs to be string
|
|
||||||
includeLargeFeatures: 'true',
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
if (watch && config.build) {
|
if (watch && config.build) {
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ USER 0:0
|
|||||||
RUN corepack enable \
|
RUN corepack enable \
|
||||||
&& corepack enable pnpm
|
&& corepack enable pnpm
|
||||||
|
|
||||||
RUN apk add --no-cache git~=2.43.4 \
|
RUN apk add --no-cache git~=2.43 \
|
||||||
&& git config --add --system safe.directory /mermaid
|
&& git config --add --system safe.directory /mermaid
|
||||||
|
|
||||||
ENV NODE_OPTIONS="--max_old_space_size=8192"
|
ENV NODE_OPTIONS="--max_old_space_size=8192"
|
||||||
|
|||||||
@@ -99,6 +99,7 @@ export const openURLAndVerifyRendering = (
|
|||||||
cy.visit(url);
|
cy.visit(url);
|
||||||
cy.window().should('have.property', 'rendered', true);
|
cy.window().should('have.property', 'rendered', true);
|
||||||
cy.get('svg').should('be.visible');
|
cy.get('svg').should('be.visible');
|
||||||
|
// cspell:ignore viewbox
|
||||||
cy.get('svg').should('not.have.attr', 'viewbox');
|
cy.get('svg').should('not.have.attr', 'viewbox');
|
||||||
|
|
||||||
if (validation) {
|
if (validation) {
|
||||||
|
|||||||
@@ -562,6 +562,20 @@ class C13["With Città foreign language"]
|
|||||||
`
|
`
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
it('should add notes in namespaces', function () {
|
||||||
|
imgSnapshotTest(
|
||||||
|
`
|
||||||
|
classDiagram
|
||||||
|
note "This is a outer note"
|
||||||
|
note for C1 "This is a outer note for C1"
|
||||||
|
namespace Namespace1 {
|
||||||
|
note "This is a inner note"
|
||||||
|
note for C1 "This is a inner note for C1"
|
||||||
|
class C1
|
||||||
|
}
|
||||||
|
`
|
||||||
|
);
|
||||||
|
});
|
||||||
it('should render a simple class diagram with no members', () => {
|
it('should render a simple class diagram with no members', () => {
|
||||||
imgSnapshotTest(
|
imgSnapshotTest(
|
||||||
`
|
`
|
||||||
|
|||||||
@@ -709,6 +709,20 @@ class C13["With Città foreign language"]
|
|||||||
`
|
`
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
it('should add notes in namespaces', function () {
|
||||||
|
imgSnapshotTest(
|
||||||
|
`
|
||||||
|
classDiagram
|
||||||
|
note "This is a outer note"
|
||||||
|
note for C1 "This is a outer note for C1"
|
||||||
|
namespace Namespace1 {
|
||||||
|
note "This is a inner note"
|
||||||
|
note for C1 "This is a inner note for C1"
|
||||||
|
class C1
|
||||||
|
}
|
||||||
|
`
|
||||||
|
);
|
||||||
|
});
|
||||||
it('should render a simple class diagram with no members', () => {
|
it('should render a simple class diagram with no members', () => {
|
||||||
imgSnapshotTest(
|
imgSnapshotTest(
|
||||||
`
|
`
|
||||||
|
|||||||
@@ -184,6 +184,7 @@
|
|||||||
}
|
}
|
||||||
Admin --> Report : generates
|
Admin --> Report : generates
|
||||||
</pre>
|
</pre>
|
||||||
|
<hr />
|
||||||
<pre class="mermaid">
|
<pre class="mermaid">
|
||||||
classDiagram
|
classDiagram
|
||||||
namespace Company.Project.Module {
|
namespace Company.Project.Module {
|
||||||
@@ -240,6 +241,20 @@
|
|||||||
Bike --> Square : "Logo Shape"
|
Bike --> Square : "Logo Shape"
|
||||||
|
|
||||||
</pre>
|
</pre>
|
||||||
|
<hr />
|
||||||
|
<pre class="mermaid">
|
||||||
|
classDiagram
|
||||||
|
note "This is a outer note"
|
||||||
|
note for Class1 "This is a outer note for Class1"
|
||||||
|
namespace ns {
|
||||||
|
note "This is a inner note"
|
||||||
|
note for Class1 "This is a inner note for Class1"
|
||||||
|
class Class1
|
||||||
|
class Class2
|
||||||
|
}
|
||||||
|
</pre>
|
||||||
|
<hr />
|
||||||
|
|
||||||
<script type="module">
|
<script type="module">
|
||||||
import mermaid from './mermaid.esm.mjs';
|
import mermaid from './mermaid.esm.mjs';
|
||||||
mermaid.initialize({
|
mermaid.initialize({
|
||||||
|
|||||||
@@ -57,6 +57,8 @@ To add an integration to this list, see the [Integrations - create page](./integ
|
|||||||
- [GitHub Writer](https://github.com/ckeditor/github-writer)
|
- [GitHub Writer](https://github.com/ckeditor/github-writer)
|
||||||
- [SVG diagram generator](https://github.com/SimonKenyonShepard/mermaidjs-github-svg-generator)
|
- [SVG diagram generator](https://github.com/SimonKenyonShepard/mermaidjs-github-svg-generator)
|
||||||
- [GitLab](https://docs.gitlab.com/ee/user/markdown.html#diagrams-and-flowcharts) ✅
|
- [GitLab](https://docs.gitlab.com/ee/user/markdown.html#diagrams-and-flowcharts) ✅
|
||||||
|
- [GNU Octave](https://octave.org/) ✅
|
||||||
|
- [octave_mermaid_js](https://github.com/CNOCTAVE/octave_mermaid_js) ✅
|
||||||
- [Mermaid Plugin for JetBrains IDEs](https://plugins.jetbrains.com/plugin/20146-mermaid)
|
- [Mermaid Plugin for JetBrains IDEs](https://plugins.jetbrains.com/plugin/20146-mermaid)
|
||||||
- [MonsterWriter](https://www.monsterwriter.com/) ✅
|
- [MonsterWriter](https://www.monsterwriter.com/) ✅
|
||||||
- [Joplin](https://joplinapp.org) ✅
|
- [Joplin](https://joplinapp.org) ✅
|
||||||
@@ -272,6 +274,7 @@ Communication tools and platforms
|
|||||||
- [reveal.js-mermaid-plugin](https://github.com/ludwick/reveal.js-mermaid-plugin)
|
- [reveal.js-mermaid-plugin](https://github.com/ludwick/reveal.js-mermaid-plugin)
|
||||||
- [Reveal CK](https://github.com/jedcn/reveal-ck)
|
- [Reveal CK](https://github.com/jedcn/reveal-ck)
|
||||||
- [reveal-ck-mermaid-plugin](https://github.com/tmtm/reveal-ck-mermaid-plugin)
|
- [reveal-ck-mermaid-plugin](https://github.com/tmtm/reveal-ck-mermaid-plugin)
|
||||||
|
- [speccharts: Turn your test suites into specification diagrams](https://github.com/arnaudrenaud/speccharts)
|
||||||
- [Vitepress Plugin](https://github.com/sametcn99/vitepress-mermaid-renderer)
|
- [Vitepress Plugin](https://github.com/sametcn99/vitepress-mermaid-renderer)
|
||||||
|
|
||||||
<!--- cspell:ignore Blazorade HueHive --->
|
<!--- cspell:ignore Blazorade HueHive --->
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ Try the Ultimate AI, Mermaid, and Visual Diagramming Suite by creating an accoun
|
|||||||
|
|
||||||
## Plans
|
## Plans
|
||||||
|
|
||||||
- **Free** - A free plan that includes three diagrams.
|
- **Free** - A free plan that includes six diagrams.
|
||||||
|
|
||||||
- **Pro** - A paid plan that includes unlimited diagrams, access to the collaboration feature, and more.
|
- **Pro** - A paid plan that includes unlimited diagrams, access to the collaboration feature, and more.
|
||||||
|
|
||||||
|
|||||||
@@ -287,7 +287,6 @@ To describe the visibility (or encapsulation) of an attribute or method/function
|
|||||||
>
|
>
|
||||||
> - `*` Abstract e.g.: `someAbstractMethod()*` or `someAbstractMethod() int*`
|
> - `*` Abstract e.g.: `someAbstractMethod()*` or `someAbstractMethod() int*`
|
||||||
> - `$` Static e.g.: `someStaticMethod()$` or `someStaticMethod() String$`
|
> - `$` Static e.g.: `someStaticMethod()$` or `someStaticMethod() String$`
|
||||||
> - `$*` OR `*$` Both e.g: `someAbstractStaticMethod()$*` or `someAbstractStaticMethod() int$*`
|
|
||||||
|
|
||||||
> _note_ you can also include additional _classifiers_ to a field definition by adding the following notation to the very end:
|
> _note_ you can also include additional _classifiers_ to a field definition by adding the following notation to the very end:
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -18,7 +18,9 @@
|
|||||||
"elk",
|
"elk",
|
||||||
"mermaid"
|
"mermaid"
|
||||||
],
|
],
|
||||||
"scripts": {},
|
"scripts": {
|
||||||
|
"clean": "rimraf dist"
|
||||||
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/mermaid-js/mermaid"
|
"url": "https://github.com/mermaid-js/mermaid"
|
||||||
|
|||||||
@@ -19,7 +19,9 @@
|
|||||||
"mermaid",
|
"mermaid",
|
||||||
"layout"
|
"layout"
|
||||||
],
|
],
|
||||||
"scripts": {},
|
"scripts": {
|
||||||
|
"clean": "rimraf dist"
|
||||||
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/mermaid-js/mermaid"
|
"url": "https://github.com/mermaid-js/mermaid"
|
||||||
|
|||||||
@@ -1,5 +1,30 @@
|
|||||||
# mermaid
|
# mermaid
|
||||||
|
|
||||||
|
## 11.12.1
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- [#7107](https://github.com/mermaid-js/mermaid/pull/7107) [`cbf8946`](https://github.com/mermaid-js/mermaid/commit/cbf89462acecac7a06f19843e8d48cb137df0753) Thanks [@shubhamparikh2704](https://github.com/shubhamparikh2704)! - fix: Updated the dependency dagre-d3-es to 7.0.13 to fix GHSA-cc8p-78qf-8p7q
|
||||||
|
|
||||||
|
## 11.12.0
|
||||||
|
|
||||||
|
### Minor Changes
|
||||||
|
|
||||||
|
- [#6921](https://github.com/mermaid-js/mermaid/pull/6921) [`764b315`](https://github.com/mermaid-js/mermaid/commit/764b315dc16d0359add7c6b8e3ef7592e9bdc09c) Thanks [@quilicicf](https://github.com/quilicicf)! - feat: Add IDs in architecture diagrams
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- [#6950](https://github.com/mermaid-js/mermaid/pull/6950) [`a957908`](https://github.com/mermaid-js/mermaid/commit/a9579083bfba367a4f4678547ec37ed7b61b9f5b) Thanks [@shubhamparikh2704](https://github.com/shubhamparikh2704)! - chore: Fix mindmap rendering in docs and apply tidytree layout
|
||||||
|
|
||||||
|
- [#6826](https://github.com/mermaid-js/mermaid/pull/6826) [`1d36810`](https://github.com/mermaid-js/mermaid/commit/1d3681053b9168354e48e5763023b6305cd1ca72) Thanks [@darshanr0107](https://github.com/darshanr0107)! - fix: Ensure edge label color is applied when using classDef with edge IDs
|
||||||
|
|
||||||
|
- [#6945](https://github.com/mermaid-js/mermaid/pull/6945) [`d318f1a`](https://github.com/mermaid-js/mermaid/commit/d318f1a13cd7429334a29c70e449074ec1cb9f68) Thanks [@darshanr0107](https://github.com/darshanr0107)! - fix: Resolve gantt chart crash due to invalid array length
|
||||||
|
|
||||||
|
- [#6918](https://github.com/mermaid-js/mermaid/pull/6918) [`cfe9238`](https://github.com/mermaid-js/mermaid/commit/cfe9238882cbe95416db1feea3112456a71b6aaf) Thanks [@shubhamparikh2704](https://github.com/shubhamparikh2704)! - chore: revert marked dependency from ^15.0.7 to ^16.0.0
|
||||||
|
- Reverted marked package version to ^16.0.0 for better compatibility
|
||||||
|
- This is a dependency update that maintains API compatibility
|
||||||
|
- All tests pass with the updated version
|
||||||
|
|
||||||
## 11.11.0
|
## 11.11.0
|
||||||
|
|
||||||
### Minor Changes
|
### Minor Changes
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "mermaid",
|
"name": "mermaid",
|
||||||
"version": "11.11.0",
|
"version": "11.12.1",
|
||||||
"description": "Markdown-ish syntax for generating flowcharts, mindmaps, sequence diagrams, class diagrams, gantt charts, git graphs and more.",
|
"description": "Markdown-ish syntax for generating flowcharts, mindmaps, sequence diagrams, class diagrams, gantt charts, git graphs and more.",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"module": "./dist/mermaid.core.mjs",
|
"module": "./dist/mermaid.core.mjs",
|
||||||
@@ -76,7 +76,7 @@
|
|||||||
"cytoscape-fcose": "^2.2.0",
|
"cytoscape-fcose": "^2.2.0",
|
||||||
"d3": "^7.9.0",
|
"d3": "^7.9.0",
|
||||||
"d3-sankey": "^0.12.3",
|
"d3-sankey": "^0.12.3",
|
||||||
"dagre-d3-es": "7.0.11",
|
"dagre-d3-es": "7.0.13",
|
||||||
"dayjs": "^1.11.18",
|
"dayjs": "^1.11.18",
|
||||||
"dompurify": "^3.2.5",
|
"dompurify": "^3.2.5",
|
||||||
"katex": "^0.16.22",
|
"katex": "^0.16.22",
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ export const addDiagrams = () => {
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
if (includeLargeFeatures) {
|
if (injected.includeLargeFeatures) {
|
||||||
registerLazyLoadedDiagrams(flowchartElk, mindmap, architecture);
|
registerLazyLoadedDiagrams(flowchartElk, mindmap, architecture);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ import type {
|
|||||||
ClassRelation,
|
ClassRelation,
|
||||||
ClassNode,
|
ClassNode,
|
||||||
ClassNote,
|
ClassNote,
|
||||||
|
ClassNoteMap,
|
||||||
ClassMap,
|
ClassMap,
|
||||||
NamespaceMap,
|
NamespaceMap,
|
||||||
NamespaceNode,
|
NamespaceNode,
|
||||||
@@ -33,15 +34,16 @@ const sanitizeText = (txt: string) => common.sanitizeText(txt, getConfig());
|
|||||||
|
|
||||||
export class ClassDB implements DiagramDB {
|
export class ClassDB implements DiagramDB {
|
||||||
private relations: ClassRelation[] = [];
|
private relations: ClassRelation[] = [];
|
||||||
private classes = new Map<string, ClassNode>();
|
private classes: ClassMap = new Map<string, ClassNode>();
|
||||||
private readonly styleClasses = new Map<string, StyleClass>();
|
private readonly styleClasses = new Map<string, StyleClass>();
|
||||||
private notes: ClassNote[] = [];
|
private notes: ClassNoteMap = new Map<string, ClassNote>();
|
||||||
private interfaces: Interface[] = [];
|
private interfaces: Interface[] = [];
|
||||||
// private static classCounter = 0;
|
// private static classCounter = 0;
|
||||||
private namespaces = new Map<string, NamespaceNode>();
|
private namespaces = new Map<string, NamespaceNode>();
|
||||||
private namespaceCounter = 0;
|
private namespaceCounter = 0;
|
||||||
|
|
||||||
private functions: any[] = [];
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
|
||||||
|
private functions: Function[] = [];
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
this.functions.push(this.setupToolTips.bind(this));
|
this.functions.push(this.setupToolTips.bind(this));
|
||||||
@@ -124,7 +126,7 @@ export class ClassDB implements DiagramDB {
|
|||||||
annotations: [],
|
annotations: [],
|
||||||
styles: [],
|
styles: [],
|
||||||
domId: MERMAID_DOM_ID_PREFIX + name + '-' + classCounter,
|
domId: MERMAID_DOM_ID_PREFIX + name + '-' + classCounter,
|
||||||
} as ClassNode);
|
});
|
||||||
|
|
||||||
classCounter++;
|
classCounter++;
|
||||||
}
|
}
|
||||||
@@ -155,12 +157,12 @@ export class ClassDB implements DiagramDB {
|
|||||||
|
|
||||||
public clear() {
|
public clear() {
|
||||||
this.relations = [];
|
this.relations = [];
|
||||||
this.classes = new Map();
|
this.classes = new Map<string, ClassNode>();
|
||||||
this.notes = [];
|
this.notes = new Map<string, ClassNote>();
|
||||||
this.interfaces = [];
|
this.interfaces = [];
|
||||||
this.functions = [];
|
this.functions = [];
|
||||||
this.functions.push(this.setupToolTips.bind(this));
|
this.functions.push(this.setupToolTips.bind(this));
|
||||||
this.namespaces = new Map();
|
this.namespaces = new Map<string, NamespaceNode>();
|
||||||
this.namespaceCounter = 0;
|
this.namespaceCounter = 0;
|
||||||
this.direction = 'TB';
|
this.direction = 'TB';
|
||||||
commonClear();
|
commonClear();
|
||||||
@@ -178,7 +180,12 @@ export class ClassDB implements DiagramDB {
|
|||||||
return this.relations;
|
return this.relations;
|
||||||
}
|
}
|
||||||
|
|
||||||
public getNotes() {
|
public getNote(id: string | number): ClassNote {
|
||||||
|
const key = typeof id === 'number' ? `note${id}` : id;
|
||||||
|
return this.notes.get(key)!;
|
||||||
|
}
|
||||||
|
|
||||||
|
public getNotes(): ClassNoteMap {
|
||||||
return this.notes;
|
return this.notes;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -265,10 +272,6 @@ export class ClassDB implements DiagramDB {
|
|||||||
theClass.annotations.push(sanitizeText(memberString.substring(2, memberString.length - 2)));
|
theClass.annotations.push(sanitizeText(memberString.substring(2, memberString.length - 2)));
|
||||||
} else if (memberString.indexOf(')') > 0) {
|
} else if (memberString.indexOf(')') > 0) {
|
||||||
//its a method
|
//its a method
|
||||||
if (memberString.length < 2) {
|
|
||||||
// Too short to be a method, ignore
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
theClass.methods.push(new ClassMember(memberString, 'method'));
|
theClass.methods.push(new ClassMember(memberString, 'method'));
|
||||||
} else if (memberString) {
|
} else if (memberString) {
|
||||||
theClass.members.push(new ClassMember(memberString, 'attribute'));
|
theClass.members.push(new ClassMember(memberString, 'attribute'));
|
||||||
@@ -283,16 +286,19 @@ export class ClassDB implements DiagramDB {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public addNote(text: string, className: string) {
|
public addNote(text: string, className: string): string {
|
||||||
|
const index = this.notes.size;
|
||||||
const note = {
|
const note = {
|
||||||
id: `note${this.notes.length}`,
|
id: `note${index}`,
|
||||||
class: className,
|
class: className,
|
||||||
text: text,
|
text: text,
|
||||||
|
index: index,
|
||||||
};
|
};
|
||||||
this.notes.push(note);
|
this.notes.set(note.id, note);
|
||||||
|
return note.id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public cleanupLabel(label: string) {
|
public cleanupLabel(label: string): string {
|
||||||
if (label.startsWith(':')) {
|
if (label.startsWith(':')) {
|
||||||
label = label.substring(1);
|
label = label.substring(1);
|
||||||
}
|
}
|
||||||
@@ -358,7 +364,7 @@ export class ClassDB implements DiagramDB {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public getTooltip(id: string, namespace?: string) {
|
public getTooltip(id: string, namespace?: string): string | undefined {
|
||||||
if (namespace && this.namespaces.has(namespace)) {
|
if (namespace && this.namespaces.has(namespace)) {
|
||||||
return this.namespaces.get(namespace)!.classes.get(id)!.tooltip;
|
return this.namespaces.get(namespace)!.classes.get(id)!.tooltip;
|
||||||
}
|
}
|
||||||
@@ -538,10 +544,11 @@ export class ClassDB implements DiagramDB {
|
|||||||
|
|
||||||
this.namespaces.set(id, {
|
this.namespaces.set(id, {
|
||||||
id: id,
|
id: id,
|
||||||
classes: new Map(),
|
classes: new Map<string, ClassNode>(),
|
||||||
children: {},
|
notes: new Map<string, ClassNote>(),
|
||||||
|
children: new Map<string, NamespaceNode>(),
|
||||||
domId: MERMAID_DOM_ID_PREFIX + id + '-' + this.namespaceCounter,
|
domId: MERMAID_DOM_ID_PREFIX + id + '-' + this.namespaceCounter,
|
||||||
} as NamespaceNode);
|
});
|
||||||
|
|
||||||
this.namespaceCounter++;
|
this.namespaceCounter++;
|
||||||
}
|
}
|
||||||
@@ -559,16 +566,23 @@ export class ClassDB implements DiagramDB {
|
|||||||
*
|
*
|
||||||
* @param id - ID of the namespace to add
|
* @param id - ID of the namespace to add
|
||||||
* @param classNames - IDs of the class to add
|
* @param classNames - IDs of the class to add
|
||||||
|
* @param noteNames - IDs of the notes to add
|
||||||
* @public
|
* @public
|
||||||
*/
|
*/
|
||||||
public addClassesToNamespace(id: string, classNames: string[]) {
|
public addClassesToNamespace(id: string, classNames: string[], noteNames: string[]) {
|
||||||
if (!this.namespaces.has(id)) {
|
if (!this.namespaces.has(id)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (const name of classNames) {
|
for (const name of classNames) {
|
||||||
const { className } = this.splitClassNameAndType(name);
|
const { className } = this.splitClassNameAndType(name);
|
||||||
this.classes.get(className)!.parent = id;
|
const classNode = this.getClass(className);
|
||||||
this.namespaces.get(id)!.classes.set(className, this.classes.get(className)!);
|
classNode.parent = id;
|
||||||
|
this.namespaces.get(id)!.classes.set(className, classNode);
|
||||||
|
}
|
||||||
|
for (const noteName of noteNames) {
|
||||||
|
const noteNode = this.getNote(noteName);
|
||||||
|
noteNode.parent = id;
|
||||||
|
this.namespaces.get(id)!.notes.set(noteName, noteNode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -621,9 +635,7 @@ export class ClassDB implements DiagramDB {
|
|||||||
const edges: Edge[] = [];
|
const edges: Edge[] = [];
|
||||||
const config = getConfig();
|
const config = getConfig();
|
||||||
|
|
||||||
for (const namespaceKey of this.namespaces.keys()) {
|
for (const namespace of this.namespaces.values()) {
|
||||||
const namespace = this.namespaces.get(namespaceKey);
|
|
||||||
if (namespace) {
|
|
||||||
const node: Node = {
|
const node: Node = {
|
||||||
id: namespace.id,
|
id: namespace.id,
|
||||||
label: namespace.id,
|
label: namespace.id,
|
||||||
@@ -636,21 +648,19 @@ export class ClassDB implements DiagramDB {
|
|||||||
};
|
};
|
||||||
nodes.push(node);
|
nodes.push(node);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
for (const classKey of this.classes.keys()) {
|
for (const classNode of this.classes.values()) {
|
||||||
const classNode = this.classes.get(classKey);
|
const node: Node = {
|
||||||
if (classNode) {
|
...classNode,
|
||||||
const node = classNode as unknown as Node;
|
type: undefined,
|
||||||
node.parentId = classNode.parent;
|
isGroup: false,
|
||||||
node.look = config.look;
|
parentId: classNode.parent,
|
||||||
|
look: config.look,
|
||||||
|
};
|
||||||
nodes.push(node);
|
nodes.push(node);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
let cnt = 0;
|
for (const note of this.notes.values()) {
|
||||||
for (const note of this.notes) {
|
|
||||||
cnt++;
|
|
||||||
const noteNode: Node = {
|
const noteNode: Node = {
|
||||||
id: note.id,
|
id: note.id,
|
||||||
label: note.text,
|
label: note.text,
|
||||||
@@ -664,14 +674,15 @@ export class ClassDB implements DiagramDB {
|
|||||||
`stroke: ${config.themeVariables.noteBorderColor}`,
|
`stroke: ${config.themeVariables.noteBorderColor}`,
|
||||||
],
|
],
|
||||||
look: config.look,
|
look: config.look,
|
||||||
|
parentId: note.parent,
|
||||||
};
|
};
|
||||||
nodes.push(noteNode);
|
nodes.push(noteNode);
|
||||||
|
|
||||||
const noteClassId = this.classes.get(note.class)?.id ?? '';
|
const noteClassId = this.classes.get(note.class)?.id;
|
||||||
|
|
||||||
if (noteClassId) {
|
if (noteClassId) {
|
||||||
const edge: Edge = {
|
const edge: Edge = {
|
||||||
id: `edgeNote${cnt}`,
|
id: `edgeNote${note.index}`,
|
||||||
start: note.id,
|
start: note.id,
|
||||||
end: noteClassId,
|
end: noteClassId,
|
||||||
type: 'normal',
|
type: 'normal',
|
||||||
@@ -701,7 +712,7 @@ export class ClassDB implements DiagramDB {
|
|||||||
nodes.push(interfaceNode);
|
nodes.push(interfaceNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
cnt = 0;
|
let cnt = 0;
|
||||||
for (const classRelation of this.relations) {
|
for (const classRelation of this.relations) {
|
||||||
cnt++;
|
cnt++;
|
||||||
const edge: Edge = {
|
const edge: Edge = {
|
||||||
|
|||||||
@@ -417,7 +417,7 @@ class C13["With Città foreign language"]
|
|||||||
note "This is a keyword: ${keyword}. It truly is."
|
note "This is a keyword: ${keyword}. It truly is."
|
||||||
`;
|
`;
|
||||||
parser.parse(str);
|
parser.parse(str);
|
||||||
expect(classDb.getNotes()[0].text).toEqual(`This is a keyword: ${keyword}. It truly is.`);
|
expect(classDb.getNote(0).text).toEqual(`This is a keyword: ${keyword}. It truly is.`);
|
||||||
});
|
});
|
||||||
|
|
||||||
it.each(keywords)(
|
it.each(keywords)(
|
||||||
@@ -427,7 +427,7 @@ class C13["With Città foreign language"]
|
|||||||
note "${keyword}"`;
|
note "${keyword}"`;
|
||||||
|
|
||||||
parser.parse(str);
|
parser.parse(str);
|
||||||
expect(classDb.getNotes()[0].text).toEqual(`${keyword}`);
|
expect(classDb.getNote(0).text).toEqual(`${keyword}`);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -441,7 +441,7 @@ class C13["With Città foreign language"]
|
|||||||
`;
|
`;
|
||||||
|
|
||||||
parser.parse(str);
|
parser.parse(str);
|
||||||
expect(classDb.getNotes()[0].text).toEqual(`This is a keyword: ${keyword}. It truly is.`);
|
expect(classDb.getNote(0).text).toEqual(`This is a keyword: ${keyword}. It truly is.`);
|
||||||
});
|
});
|
||||||
|
|
||||||
it.each(keywords)(
|
it.each(keywords)(
|
||||||
@@ -456,7 +456,7 @@ class C13["With Città foreign language"]
|
|||||||
`;
|
`;
|
||||||
|
|
||||||
parser.parse(str);
|
parser.parse(str);
|
||||||
expect(classDb.getNotes()[0].text).toEqual(`${keyword}`);
|
expect(classDb.getNote(0).text).toEqual(`${keyword}`);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import utils, { getEdgeId } from '../../utils.js';
|
|||||||
import { interpolateToCurve, getStylesFromArray } from '../../utils.js';
|
import { interpolateToCurve, getStylesFromArray } from '../../utils.js';
|
||||||
import { setupGraphViewbox } from '../../setupGraphViewbox.js';
|
import { setupGraphViewbox } from '../../setupGraphViewbox.js';
|
||||||
import common from '../common/common.js';
|
import common from '../common/common.js';
|
||||||
import type { ClassRelation, ClassNote, ClassMap, NamespaceMap } from './classTypes.js';
|
import type { ClassRelation, ClassMap, ClassNoteMap, NamespaceMap } from './classTypes.js';
|
||||||
import type { EdgeData } from '../../types.js';
|
import type { EdgeData } from '../../types.js';
|
||||||
|
|
||||||
const sanitizeText = (txt: string) => common.sanitizeText(txt, getConfig());
|
const sanitizeText = (txt: string) => common.sanitizeText(txt, getConfig());
|
||||||
@@ -65,6 +65,9 @@ export const addNamespaces = function (
|
|||||||
|
|
||||||
g.setNode(vertex.id, node);
|
g.setNode(vertex.id, node);
|
||||||
addClasses(vertex.classes, g, _id, diagObj, vertex.id);
|
addClasses(vertex.classes, g, _id, diagObj, vertex.id);
|
||||||
|
const classes: ClassMap = diagObj.db.getClasses();
|
||||||
|
const relations: ClassRelation[] = diagObj.db.getRelations();
|
||||||
|
addNotes(vertex.notes, g, relations.length + 1, classes, vertex.id);
|
||||||
|
|
||||||
log.info('setNode', node);
|
log.info('setNode', node);
|
||||||
});
|
});
|
||||||
@@ -144,16 +147,17 @@ export const addClasses = function (
|
|||||||
* @param classes - Classes
|
* @param classes - Classes
|
||||||
*/
|
*/
|
||||||
export const addNotes = function (
|
export const addNotes = function (
|
||||||
notes: ClassNote[],
|
notes: ClassNoteMap,
|
||||||
g: graphlib.Graph,
|
g: graphlib.Graph,
|
||||||
startEdgeId: number,
|
startEdgeId: number,
|
||||||
classes: ClassMap
|
classes: ClassMap,
|
||||||
|
parent?: string
|
||||||
) {
|
) {
|
||||||
log.info(notes);
|
log.info(notes);
|
||||||
|
|
||||||
notes.forEach(function (note, i) {
|
[...notes.values()]
|
||||||
const vertex = note;
|
.filter((note) => note.parent === parent)
|
||||||
|
.forEach(function (vertex) {
|
||||||
const cssNoteStr = '';
|
const cssNoteStr = '';
|
||||||
|
|
||||||
const styles = { labelStyle: '', style: '' };
|
const styles = { labelStyle: '', style: '' };
|
||||||
@@ -181,10 +185,14 @@ export const addNotes = function (
|
|||||||
g.setNode(vertex.id, node);
|
g.setNode(vertex.id, node);
|
||||||
log.info('setNode', node);
|
log.info('setNode', node);
|
||||||
|
|
||||||
|
if (parent) {
|
||||||
|
g.setParent(vertex.id, parent);
|
||||||
|
}
|
||||||
|
|
||||||
if (!vertex.class || !classes.has(vertex.class)) {
|
if (!vertex.class || !classes.has(vertex.class)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const edgeId = startEdgeId + i;
|
const edgeId = startEdgeId + vertex.index;
|
||||||
|
|
||||||
const edgeData: EdgeData = {
|
const edgeData: EdgeData = {
|
||||||
id: `edgeNote${edgeId}`,
|
id: `edgeNote${edgeId}`,
|
||||||
@@ -329,7 +337,7 @@ export const draw = async function (text: string, id: string, _version: string,
|
|||||||
const namespaces: NamespaceMap = diagObj.db.getNamespaces();
|
const namespaces: NamespaceMap = diagObj.db.getNamespaces();
|
||||||
const classes: ClassMap = diagObj.db.getClasses();
|
const classes: ClassMap = diagObj.db.getClasses();
|
||||||
const relations: ClassRelation[] = diagObj.db.getRelations();
|
const relations: ClassRelation[] = diagObj.db.getRelations();
|
||||||
const notes: ClassNote[] = diagObj.db.getNotes();
|
const notes: ClassNoteMap = diagObj.db.getNotes();
|
||||||
log.info(relations);
|
log.info(relations);
|
||||||
addNamespaces(namespaces, g, id, diagObj);
|
addNamespaces(namespaces, g, id, diagObj);
|
||||||
addClasses(classes, g, id, diagObj);
|
addClasses(classes, g, id, diagObj);
|
||||||
|
|||||||
@@ -206,7 +206,7 @@ export const draw = function (text, id, _version, diagObj) {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
const notes = diagObj.db.getNotes();
|
const notes = diagObj.db.getNotes().values();
|
||||||
notes.forEach(function (note) {
|
notes.forEach(function (note) {
|
||||||
log.debug(`Adding note: ${JSON.stringify(note)}`);
|
log.debug(`Adding note: ${JSON.stringify(note)}`);
|
||||||
const node = svgDraw.drawNote(diagram, note, conf, diagObj);
|
const node = svgDraw.drawNote(diagram, note, conf, diagObj);
|
||||||
|
|||||||
@@ -1,317 +0,0 @@
|
|||||||
import { ClassMember } from './classTypes.js';
|
|
||||||
import { vi, describe, it, expect } from 'vitest';
|
|
||||||
const spyOn = vi.spyOn;
|
|
||||||
|
|
||||||
const staticCssStyle = 'text-decoration:underline;';
|
|
||||||
const abstractCssStyle = 'font-style:italic;';
|
|
||||||
const abstractStaticCssStyle = 'text-decoration:underline;font-style:italic;';
|
|
||||||
|
|
||||||
describe('ClassTypes - Attribute Tests', () => {
|
|
||||||
describe('Basic attribute parsing without classifiers', () => {
|
|
||||||
it('should parse attribute with no modifiers', () => {
|
|
||||||
const str = 'name String';
|
|
||||||
const displayDetails = new ClassMember(str, 'attribute').getDisplayDetails();
|
|
||||||
|
|
||||||
expect(displayDetails.displayText).toBe('name String');
|
|
||||||
expect(displayDetails.cssStyle).toBe('');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should parse attribute with public "+" visibility', () => {
|
|
||||||
const str = '+name String';
|
|
||||||
const displayDetails = new ClassMember(str, 'attribute').getDisplayDetails();
|
|
||||||
|
|
||||||
expect(displayDetails.displayText).toBe('+name String');
|
|
||||||
expect(displayDetails.cssStyle).toBe('');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should parse attribute with protected "#" visibility', () => {
|
|
||||||
const str = '#name String';
|
|
||||||
const displayDetails = new ClassMember(str, 'attribute').getDisplayDetails();
|
|
||||||
|
|
||||||
expect(displayDetails.displayText).toBe('#name String');
|
|
||||||
expect(displayDetails.cssStyle).toBe('');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should parse attribute with private "-" visibility', () => {
|
|
||||||
const str = '-name String';
|
|
||||||
const displayDetails = new ClassMember(str, 'attribute').getDisplayDetails();
|
|
||||||
|
|
||||||
expect(displayDetails.displayText).toBe('-name String');
|
|
||||||
expect(displayDetails.cssStyle).toBe('');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should parse attribute with internal "~" visibility', () => {
|
|
||||||
const str = '~name String';
|
|
||||||
const displayDetails = new ClassMember(str, 'attribute').getDisplayDetails();
|
|
||||||
|
|
||||||
expect(displayDetails.displayText).toBe('~name String');
|
|
||||||
expect(displayDetails.cssStyle).toBe('');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should parse simple attribute name only', () => {
|
|
||||||
const str = 'id';
|
|
||||||
const displayDetails = new ClassMember(str, 'attribute').getDisplayDetails();
|
|
||||||
|
|
||||||
expect(displayDetails.displayText).toBe('id');
|
|
||||||
expect(displayDetails.cssStyle).toBe('');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should parse attribute with visibility and name only', () => {
|
|
||||||
const str = '+id';
|
|
||||||
const displayDetails = new ClassMember(str, 'attribute').getDisplayDetails();
|
|
||||||
|
|
||||||
expect(displayDetails.displayText).toBe('+id');
|
|
||||||
expect(displayDetails.cssStyle).toBe('');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('Static classifier ($) attributes', () => {
|
|
||||||
it('should parse static attribute without visibility', () => {
|
|
||||||
const str = 'count int$';
|
|
||||||
const displayDetails = new ClassMember(str, 'attribute').getDisplayDetails();
|
|
||||||
|
|
||||||
expect(displayDetails.displayText).toBe('count int');
|
|
||||||
expect(displayDetails.cssStyle).toBe(staticCssStyle);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should parse static attribute with public visibility', () => {
|
|
||||||
const str = '+count int$';
|
|
||||||
const displayDetails = new ClassMember(str, 'attribute').getDisplayDetails();
|
|
||||||
|
|
||||||
expect(displayDetails.displayText).toBe('+count int');
|
|
||||||
expect(displayDetails.cssStyle).toBe(staticCssStyle);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should parse static attribute with protected visibility', () => {
|
|
||||||
const str = '#count int$';
|
|
||||||
const displayDetails = new ClassMember(str, 'attribute').getDisplayDetails();
|
|
||||||
|
|
||||||
expect(displayDetails.displayText).toBe('#count int');
|
|
||||||
expect(displayDetails.cssStyle).toBe(staticCssStyle);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should parse static attribute with private visibility', () => {
|
|
||||||
const str = '-count int$';
|
|
||||||
const displayDetails = new ClassMember(str, 'attribute').getDisplayDetails();
|
|
||||||
|
|
||||||
expect(displayDetails.displayText).toBe('-count int');
|
|
||||||
expect(displayDetails.cssStyle).toBe(staticCssStyle);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should parse static attribute with internal visibility', () => {
|
|
||||||
const str = '~count int$';
|
|
||||||
const displayDetails = new ClassMember(str, 'attribute').getDisplayDetails();
|
|
||||||
|
|
||||||
expect(displayDetails.displayText).toBe('~count int');
|
|
||||||
expect(displayDetails.cssStyle).toBe(staticCssStyle);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should parse static attribute name only', () => {
|
|
||||||
const str = 'MAX_SIZE$';
|
|
||||||
const displayDetails = new ClassMember(str, 'attribute').getDisplayDetails();
|
|
||||||
|
|
||||||
expect(displayDetails.displayText).toBe('MAX_SIZE');
|
|
||||||
expect(displayDetails.cssStyle).toBe(staticCssStyle);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('Abstract classifier (*) attributes', () => {
|
|
||||||
it('should parse abstract attribute without visibility', () => {
|
|
||||||
const str = 'data String*';
|
|
||||||
const displayDetails = new ClassMember(str, 'attribute').getDisplayDetails();
|
|
||||||
|
|
||||||
expect(displayDetails.displayText).toBe('data String');
|
|
||||||
expect(displayDetails.cssStyle).toBe(abstractCssStyle);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should parse abstract attribute with public visibility', () => {
|
|
||||||
const str = '+data String*';
|
|
||||||
const displayDetails = new ClassMember(str, 'attribute').getDisplayDetails();
|
|
||||||
|
|
||||||
expect(displayDetails.displayText).toBe('+data String');
|
|
||||||
expect(displayDetails.cssStyle).toBe(abstractCssStyle);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should parse abstract attribute with protected visibility', () => {
|
|
||||||
const str = '#data String*';
|
|
||||||
const displayDetails = new ClassMember(str, 'attribute').getDisplayDetails();
|
|
||||||
|
|
||||||
expect(displayDetails.displayText).toBe('#data String');
|
|
||||||
expect(displayDetails.cssStyle).toBe(abstractCssStyle);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should parse abstract attribute with private visibility', () => {
|
|
||||||
const str = '-data String*';
|
|
||||||
const displayDetails = new ClassMember(str, 'attribute').getDisplayDetails();
|
|
||||||
|
|
||||||
expect(displayDetails.displayText).toBe('-data String');
|
|
||||||
expect(displayDetails.cssStyle).toBe(abstractCssStyle);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should parse abstract attribute with internal visibility', () => {
|
|
||||||
const str = '~data String*';
|
|
||||||
const displayDetails = new ClassMember(str, 'attribute').getDisplayDetails();
|
|
||||||
|
|
||||||
expect(displayDetails.displayText).toBe('~data String');
|
|
||||||
expect(displayDetails.cssStyle).toBe(abstractCssStyle);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should parse abstract attribute name only', () => {
|
|
||||||
const str = 'value*';
|
|
||||||
const displayDetails = new ClassMember(str, 'attribute').getDisplayDetails();
|
|
||||||
|
|
||||||
expect(displayDetails.displayText).toBe('value');
|
|
||||||
expect(displayDetails.cssStyle).toBe(abstractCssStyle);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('Abstract and Static combined classifiers', () => {
|
|
||||||
it('should parse abstract+static ($*) attribute without visibility', () => {
|
|
||||||
const str = 'config Map$*';
|
|
||||||
const displayDetails = new ClassMember(str, 'attribute').getDisplayDetails();
|
|
||||||
|
|
||||||
expect(displayDetails.displayText).toBe('config Map');
|
|
||||||
expect(displayDetails.cssStyle).toBe(abstractStaticCssStyle);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should parse static+abstract (*$) attribute without visibility', () => {
|
|
||||||
const str = 'config Map*$';
|
|
||||||
const displayDetails = new ClassMember(str, 'attribute').getDisplayDetails();
|
|
||||||
|
|
||||||
expect(displayDetails.displayText).toBe('config Map');
|
|
||||||
expect(displayDetails.cssStyle).toBe(abstractStaticCssStyle);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should parse abstract+static ($*) attribute with public visibility', () => {
|
|
||||||
const str = '+config Map$*';
|
|
||||||
const displayDetails = new ClassMember(str, 'attribute').getDisplayDetails();
|
|
||||||
|
|
||||||
expect(displayDetails.displayText).toBe('+config Map');
|
|
||||||
expect(displayDetails.cssStyle).toBe(abstractStaticCssStyle);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should parse static+abstract (*$) attribute with public visibility', () => {
|
|
||||||
const str = '+config Map*$';
|
|
||||||
const displayDetails = new ClassMember(str, 'attribute').getDisplayDetails();
|
|
||||||
|
|
||||||
expect(displayDetails.displayText).toBe('+config Map');
|
|
||||||
expect(displayDetails.cssStyle).toBe(abstractStaticCssStyle);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should parse abstract+static ($*) attribute with protected visibility', () => {
|
|
||||||
const str = '#registry HashMap$*';
|
|
||||||
const displayDetails = new ClassMember(str, 'attribute').getDisplayDetails();
|
|
||||||
|
|
||||||
expect(displayDetails.displayText).toBe('#registry HashMap');
|
|
||||||
expect(displayDetails.cssStyle).toBe(abstractStaticCssStyle);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should parse static+abstract (*$) attribute with protected visibility', () => {
|
|
||||||
const str = '#registry HashMap*$';
|
|
||||||
const displayDetails = new ClassMember(str, 'attribute').getDisplayDetails();
|
|
||||||
|
|
||||||
expect(displayDetails.displayText).toBe('#registry HashMap');
|
|
||||||
expect(displayDetails.cssStyle).toBe(abstractStaticCssStyle);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should parse abstract+static ($*) attribute with private visibility', () => {
|
|
||||||
const str = '-cache LRUCache$*';
|
|
||||||
const displayDetails = new ClassMember(str, 'attribute').getDisplayDetails();
|
|
||||||
|
|
||||||
expect(displayDetails.displayText).toBe('-cache LRUCache');
|
|
||||||
expect(displayDetails.cssStyle).toBe(abstractStaticCssStyle);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should parse static+abstract (*$) attribute with private visibility', () => {
|
|
||||||
const str = '-cache LRUCache*$';
|
|
||||||
const displayDetails = new ClassMember(str, 'attribute').getDisplayDetails();
|
|
||||||
|
|
||||||
expect(displayDetails.displayText).toBe('-cache LRUCache');
|
|
||||||
expect(displayDetails.cssStyle).toBe(abstractStaticCssStyle);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should parse abstract+static ($*) attribute with internal visibility', () => {
|
|
||||||
const str = '~pool ThreadPool$*';
|
|
||||||
const displayDetails = new ClassMember(str, 'attribute').getDisplayDetails();
|
|
||||||
|
|
||||||
expect(displayDetails.displayText).toBe('~pool ThreadPool');
|
|
||||||
expect(displayDetails.cssStyle).toBe(abstractStaticCssStyle);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should parse static+abstract (*$) attribute with internal visibility', () => {
|
|
||||||
const str = '~pool ThreadPool*$';
|
|
||||||
const displayDetails = new ClassMember(str, 'attribute').getDisplayDetails();
|
|
||||||
|
|
||||||
expect(displayDetails.displayText).toBe('~pool ThreadPool');
|
|
||||||
expect(displayDetails.cssStyle).toBe(abstractStaticCssStyle);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should parse abstract+static ($*) attribute name only', () => {
|
|
||||||
const str = 'INSTANCE$*';
|
|
||||||
const displayDetails = new ClassMember(str, 'attribute').getDisplayDetails();
|
|
||||||
|
|
||||||
expect(displayDetails.displayText).toBe('INSTANCE');
|
|
||||||
expect(displayDetails.cssStyle).toBe(abstractStaticCssStyle);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should parse static+abstract (*$) attribute name only', () => {
|
|
||||||
const str = 'INSTANCE*$';
|
|
||||||
const displayDetails = new ClassMember(str, 'attribute').getDisplayDetails();
|
|
||||||
|
|
||||||
expect(displayDetails.displayText).toBe('INSTANCE');
|
|
||||||
expect(displayDetails.cssStyle).toBe(abstractStaticCssStyle);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('Complex attribute type scenarios', () => {
|
|
||||||
it('should parse generic type attribute with static classifier', () => {
|
|
||||||
const str = '+items List~String~$';
|
|
||||||
const displayDetails = new ClassMember(str, 'attribute').getDisplayDetails();
|
|
||||||
|
|
||||||
expect(displayDetails.displayText).toBe('+items List<String>');
|
|
||||||
expect(displayDetails.cssStyle).toBe(staticCssStyle);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should parse nested generic type attribute with abstract classifier', () => {
|
|
||||||
const str = '#mapping Map~String, List~Integer~~*';
|
|
||||||
const displayDetails = new ClassMember(str, 'attribute').getDisplayDetails();
|
|
||||||
|
|
||||||
expect(displayDetails.displayText).toBe('#mapping Map~String, List<Integer~>');
|
|
||||||
expect(displayDetails.cssStyle).toBe(abstractCssStyle);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should parse complex generic type with abstract+static classifiers', () => {
|
|
||||||
const str = '+factory Function~Map~String, Object~, Promise~Result~~$*';
|
|
||||||
const displayDetails = new ClassMember(str, 'attribute').getDisplayDetails();
|
|
||||||
|
|
||||||
expect(displayDetails.displayText).toBe(
|
|
||||||
'+factory Function<Map>String, Object~, Promise<Result~>'
|
|
||||||
);
|
|
||||||
expect(displayDetails.cssStyle).toBe(abstractStaticCssStyle);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should parse attribute with spaces in type name', () => {
|
|
||||||
const str = '+fullName Full Name String$';
|
|
||||||
const displayDetails = new ClassMember(str, 'attribute').getDisplayDetails();
|
|
||||||
|
|
||||||
expect(displayDetails.displayText).toBe('+fullName Full Name String');
|
|
||||||
expect(displayDetails.cssStyle).toBe(staticCssStyle);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should parse attribute with special characters in name', () => {
|
|
||||||
const str = '+user_name String*';
|
|
||||||
const displayDetails = new ClassMember(str, 'attribute').getDisplayDetails();
|
|
||||||
|
|
||||||
expect(displayDetails.displayText).toBe('+user_name String');
|
|
||||||
expect(displayDetails.cssStyle).toBe(abstractCssStyle);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should parse attribute with numeric suffix', () => {
|
|
||||||
const str = '-value123 int$*';
|
|
||||||
const displayDetails = new ClassMember(str, 'attribute').getDisplayDetails();
|
|
||||||
|
|
||||||
expect(displayDetails.displayText).toBe('-value123 int');
|
|
||||||
expect(displayDetails.cssStyle).toBe(abstractStaticCssStyle);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
@@ -1,170 +0,0 @@
|
|||||||
import { describe, it, expect } from 'vitest';
|
|
||||||
import { ClassMember } from './classTypes.js';
|
|
||||||
|
|
||||||
describe('ClassTypes - Enhanced Abstract and Static Combinations', () => {
|
|
||||||
// Test constants to match original test structure
|
|
||||||
const staticCssStyle = 'text-decoration:underline;';
|
|
||||||
const abstractCssStyle = 'font-style:italic;';
|
|
||||||
const abstractStaticCssStyle = 'text-decoration:underline;font-style:italic;';
|
|
||||||
|
|
||||||
describe('Enhanced parseClassifier functionality', () => {
|
|
||||||
describe('when the attribute has static "$" modifier', () => {
|
|
||||||
it('should parse the display text correctly and apply static css style', () => {
|
|
||||||
const str = 'name String$';
|
|
||||||
|
|
||||||
const displayDetails = new ClassMember(str, 'attribute').getDisplayDetails();
|
|
||||||
|
|
||||||
expect(displayDetails.displayText).toBe('name String');
|
|
||||||
expect(displayDetails.cssStyle).toBe(staticCssStyle);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('when the attribute has abstract "*" modifier', () => {
|
|
||||||
it('should parse the display text correctly and apply abstract css style', () => {
|
|
||||||
const str = 'name String*';
|
|
||||||
|
|
||||||
const displayDetails = new ClassMember(str, 'attribute').getDisplayDetails();
|
|
||||||
|
|
||||||
expect(displayDetails.displayText).toBe('name String');
|
|
||||||
expect(displayDetails.cssStyle).toBe(abstractCssStyle);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('when the attribute has abstract static "*$" modifier', () => {
|
|
||||||
it('should parse the display text correctly and apply abstract static css style', () => {
|
|
||||||
const str = 'name String*$';
|
|
||||||
|
|
||||||
const displayDetails = new ClassMember(str, 'attribute').getDisplayDetails();
|
|
||||||
|
|
||||||
expect(displayDetails.displayText).toBe('name String');
|
|
||||||
expect(displayDetails.cssStyle).toBe(abstractStaticCssStyle);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('when the attribute has static abstract "$*" modifier', () => {
|
|
||||||
it('should parse the display text correctly and apply abstract static css style', () => {
|
|
||||||
const str = 'name String$*';
|
|
||||||
|
|
||||||
const displayDetails = new ClassMember(str, 'attribute').getDisplayDetails();
|
|
||||||
|
|
||||||
expect(displayDetails.displayText).toBe('name String');
|
|
||||||
expect(displayDetails.cssStyle).toBe(abstractStaticCssStyle);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should handle abstract and static combined (*$) on methods', () => {
|
|
||||||
const str = 'getTime()*$';
|
|
||||||
const classMember = new ClassMember(str, 'method');
|
|
||||||
const details = classMember.getDisplayDetails();
|
|
||||||
|
|
||||||
expect(details.displayText).toBe('getTime()');
|
|
||||||
expect(details.cssStyle).toBe(abstractStaticCssStyle);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should handle static and abstract combined ($*) on methods', () => {
|
|
||||||
const str = 'getTime()$*';
|
|
||||||
const classMember = new ClassMember(str, 'method');
|
|
||||||
const details = classMember.getDisplayDetails();
|
|
||||||
|
|
||||||
expect(details.displayText).toBe('getTime()');
|
|
||||||
expect(details.cssStyle).toBe(abstractStaticCssStyle);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should handle abstract and static combined (*$) on attributes', () => {
|
|
||||||
const str = 'data String*$';
|
|
||||||
const classMember = new ClassMember(str, 'attribute');
|
|
||||||
const details = classMember.getDisplayDetails();
|
|
||||||
|
|
||||||
expect(details.displayText).toBe('data String');
|
|
||||||
expect(details.cssStyle).toBe(abstractStaticCssStyle);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should handle static and abstract combined ($*) on attributes', () => {
|
|
||||||
const str = 'data String$*';
|
|
||||||
const classMember = new ClassMember(str, 'attribute');
|
|
||||||
const details = classMember.getDisplayDetails();
|
|
||||||
|
|
||||||
expect(details.displayText).toBe('data String');
|
|
||||||
expect(details.cssStyle).toBe(abstractStaticCssStyle);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should handle complex method with abstract static combination', () => {
|
|
||||||
const str = '+processData(Map~String, List~Integer~~) Optional~Result~*$';
|
|
||||||
const classMember = new ClassMember(str, 'method');
|
|
||||||
const details = classMember.getDisplayDetails();
|
|
||||||
|
|
||||||
expect(details.displayText).toBe(
|
|
||||||
'+processData(Map~String, List<Integer~>) : Optional<Result>'
|
|
||||||
);
|
|
||||||
expect(details.cssStyle).toBe(abstractStaticCssStyle);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should handle attribute with visibility and abstract static combination', () => {
|
|
||||||
const str = '#config Settings$*';
|
|
||||||
const classMember = new ClassMember(str, 'attribute');
|
|
||||||
const details = classMember.getDisplayDetails();
|
|
||||||
|
|
||||||
expect(details.displayText).toBe('#config Settings');
|
|
||||||
expect(details.cssStyle).toBe(abstractStaticCssStyle);
|
|
||||||
});
|
|
||||||
|
|
||||||
// Verify existing classifier functionality still works
|
|
||||||
it('should still handle single static classifier correctly', () => {
|
|
||||||
const str = 'getName()$';
|
|
||||||
const classMember = new ClassMember(str, 'method');
|
|
||||||
const details = classMember.getDisplayDetails();
|
|
||||||
|
|
||||||
expect(details.displayText).toBe('getName()');
|
|
||||||
expect(details.cssStyle).toBe(staticCssStyle);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should still handle single abstract classifier correctly', () => {
|
|
||||||
const str = 'name String*';
|
|
||||||
const classMember = new ClassMember(str, 'attribute');
|
|
||||||
const details = classMember.getDisplayDetails();
|
|
||||||
|
|
||||||
expect(details.displayText).toBe('name String');
|
|
||||||
expect(details.cssStyle).toBe(abstractCssStyle);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should handle empty classifier correctly', () => {
|
|
||||||
const str = 'getValue()';
|
|
||||||
const classMember = new ClassMember(str, 'method');
|
|
||||||
const details = classMember.getDisplayDetails();
|
|
||||||
|
|
||||||
expect(details.displayText).toBe('getValue()');
|
|
||||||
expect(details.cssStyle).toBe('');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
it('should return correct css for static classifier', function () {
|
|
||||||
const str = `getTime()$`;
|
|
||||||
|
|
||||||
const classMember = new ClassMember(str, 'method');
|
|
||||||
expect(classMember.getDisplayDetails().displayText).toBe('getTime()');
|
|
||||||
expect(classMember.getDisplayDetails().cssStyle).toBe(staticCssStyle);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should return correct css for abstract classifier', function () {
|
|
||||||
const str = `getTime()*`;
|
|
||||||
|
|
||||||
const classMember = new ClassMember(str, 'method');
|
|
||||||
expect(classMember.getDisplayDetails().displayText).toBe('getTime()');
|
|
||||||
expect(classMember.getDisplayDetails().cssStyle).toBe(abstractCssStyle);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should return correct css for abstract static classifier', function () {
|
|
||||||
const str = `getTime()*$`;
|
|
||||||
|
|
||||||
const classMember = new ClassMember(str, 'method');
|
|
||||||
expect(classMember.getDisplayDetails().displayText).toBe('getTime()');
|
|
||||||
expect(classMember.getDisplayDetails().cssStyle).toBe(abstractStaticCssStyle);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should return correct css for static abstract classifier', function () {
|
|
||||||
const str = `getTime()$*`;
|
|
||||||
|
|
||||||
const classMember = new ClassMember(str, 'method');
|
|
||||||
expect(classMember.getDisplayDetails().displayText).toBe('getTime()');
|
|
||||||
expect(classMember.getDisplayDetails().cssStyle).toBe(abstractStaticCssStyle);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
@@ -1,827 +0,0 @@
|
|||||||
import { ClassMember } from './classTypes.js';
|
|
||||||
import { vi, describe, it, expect } from 'vitest';
|
|
||||||
const spyOn = vi.spyOn;
|
|
||||||
|
|
||||||
const staticCssStyle = 'text-decoration:underline;';
|
|
||||||
const abstractCssStyle = 'font-style:italic;';
|
|
||||||
const abstractStaticCssStyle = 'text-decoration:underline;font-style:italic;';
|
|
||||||
|
|
||||||
describe('given text representing a method, ', function () {
|
|
||||||
describe('when method has no parameters', function () {
|
|
||||||
it('should parse correctly', function () {
|
|
||||||
const str = `getTime()`;
|
|
||||||
|
|
||||||
const classMember = new ClassMember(str, 'method');
|
|
||||||
expect(classMember.getDisplayDetails().displayText).toBe(str);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should handle public visibility', function () {
|
|
||||||
const str = `+getTime()`;
|
|
||||||
|
|
||||||
const classMember = new ClassMember(str, 'method');
|
|
||||||
expect(classMember.getDisplayDetails().displayText).toBe('+getTime()');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should handle private visibility', function () {
|
|
||||||
const str = `-getTime()`;
|
|
||||||
|
|
||||||
const classMember = new ClassMember(str, 'method');
|
|
||||||
expect(classMember.getDisplayDetails().displayText).toBe('-getTime()');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should handle protected visibility', function () {
|
|
||||||
const str = `#getTime()`;
|
|
||||||
|
|
||||||
const classMember = new ClassMember(str, 'method');
|
|
||||||
expect(classMember.getDisplayDetails().displayText).toBe('#getTime()');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should handle internal visibility', function () {
|
|
||||||
const str = `~getTime()`;
|
|
||||||
|
|
||||||
const classMember = new ClassMember(str, 'method');
|
|
||||||
expect(classMember.getDisplayDetails().displayText).toBe('~getTime()');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('when method has single parameter value', function () {
|
|
||||||
it('should parse correctly', function () {
|
|
||||||
const str = `getTime(int)`;
|
|
||||||
|
|
||||||
const classMember = new ClassMember(str, 'method');
|
|
||||||
expect(classMember.getDisplayDetails().displayText).toBe(str);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should handle public visibility', function () {
|
|
||||||
const str = `+getTime(int)`;
|
|
||||||
|
|
||||||
const classMember = new ClassMember(str, 'method');
|
|
||||||
expect(classMember.getDisplayDetails().displayText).toBe('+getTime(int)');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should handle private visibility', function () {
|
|
||||||
const str = `-getTime(int)`;
|
|
||||||
|
|
||||||
const classMember = new ClassMember(str, 'method');
|
|
||||||
expect(classMember.getDisplayDetails().displayText).toBe('-getTime(int)');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should handle protected visibility', function () {
|
|
||||||
const str = `#getTime(int)`;
|
|
||||||
|
|
||||||
const classMember = new ClassMember(str, 'method');
|
|
||||||
expect(classMember.getDisplayDetails().displayText).toBe('#getTime(int)');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should handle internal visibility', function () {
|
|
||||||
const str = `~getTime(int)`;
|
|
||||||
|
|
||||||
const classMember = new ClassMember(str, 'method');
|
|
||||||
expect(classMember.getDisplayDetails().displayText).toBe('~getTime(int)');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should return correct css for static classifier', function () {
|
|
||||||
const str = `getTime(int)$`;
|
|
||||||
|
|
||||||
const classMember = new ClassMember(str, 'method');
|
|
||||||
expect(classMember.getDisplayDetails().displayText).toBe('getTime(int)');
|
|
||||||
expect(classMember.getDisplayDetails().cssStyle).toBe(staticCssStyle);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should return correct css for abstract classifier', function () {
|
|
||||||
const str = `getTime(int)*`;
|
|
||||||
|
|
||||||
const classMember = new ClassMember(str, 'method');
|
|
||||||
expect(classMember.getDisplayDetails().displayText).toBe('getTime(int)');
|
|
||||||
expect(classMember.getDisplayDetails().cssStyle).toBe(abstractCssStyle);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should return correct css for abstract static classifier', function () {
|
|
||||||
const str = `getTime(int)*$`;
|
|
||||||
|
|
||||||
const classMember = new ClassMember(str, 'method');
|
|
||||||
expect(classMember.getDisplayDetails().displayText).toBe('getTime(int)');
|
|
||||||
expect(classMember.getDisplayDetails().cssStyle).toBe(abstractStaticCssStyle);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should return correct css for static abstract classifier', function () {
|
|
||||||
const str = `getTime(int)$*`;
|
|
||||||
|
|
||||||
const classMember = new ClassMember(str, 'method');
|
|
||||||
expect(classMember.getDisplayDetails().displayText).toBe('getTime(int)');
|
|
||||||
expect(classMember.getDisplayDetails().cssStyle).toBe(abstractStaticCssStyle);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('when method has single parameter type and name (type first)', function () {
|
|
||||||
it('should parse correctly', function () {
|
|
||||||
const str = `getTime(int count)`;
|
|
||||||
|
|
||||||
const classMember = new ClassMember(str, 'method');
|
|
||||||
expect(classMember.getDisplayDetails().displayText).toBe(str);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should handle public visibility', function () {
|
|
||||||
const str = `+getTime(int count)`;
|
|
||||||
|
|
||||||
const classMember = new ClassMember(str, 'method');
|
|
||||||
expect(classMember.getDisplayDetails().displayText).toBe('+getTime(int count)');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should handle private visibility', function () {
|
|
||||||
const str = `-getTime(int count)`;
|
|
||||||
|
|
||||||
const classMember = new ClassMember(str, 'method');
|
|
||||||
expect(classMember.getDisplayDetails().displayText).toBe('-getTime(int count)');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should handle protected visibility', function () {
|
|
||||||
const str = `#getTime(int count)`;
|
|
||||||
|
|
||||||
const classMember = new ClassMember(str, 'method');
|
|
||||||
expect(classMember.getDisplayDetails().displayText).toBe('#getTime(int count)');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should handle internal visibility', function () {
|
|
||||||
const str = `~getTime(int count)`;
|
|
||||||
|
|
||||||
const classMember = new ClassMember(str, 'method');
|
|
||||||
expect(classMember.getDisplayDetails().displayText).toBe('~getTime(int count)');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should return correct css for static classifier', function () {
|
|
||||||
const str = `getTime(int count)$`;
|
|
||||||
|
|
||||||
const classMember = new ClassMember(str, 'method');
|
|
||||||
expect(classMember.getDisplayDetails().displayText).toBe('getTime(int count)');
|
|
||||||
expect(classMember.getDisplayDetails().cssStyle).toBe(staticCssStyle);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should return correct css for abstract classifier', function () {
|
|
||||||
const str = `getTime(int count)*`;
|
|
||||||
|
|
||||||
const classMember = new ClassMember(str, 'method');
|
|
||||||
expect(classMember.getDisplayDetails().displayText).toBe('getTime(int count)');
|
|
||||||
expect(classMember.getDisplayDetails().cssStyle).toBe(abstractCssStyle);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should return correct css for abstract static classifier', function () {
|
|
||||||
const str = `getTime(int count)*$`;
|
|
||||||
|
|
||||||
const classMember = new ClassMember(str, 'method');
|
|
||||||
expect(classMember.getDisplayDetails().displayText).toBe('getTime(int count)');
|
|
||||||
expect(classMember.getDisplayDetails().cssStyle).toBe(abstractStaticCssStyle);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should return correct css for static abstract classifier', function () {
|
|
||||||
const str = `getTime(int count)$*`;
|
|
||||||
|
|
||||||
const classMember = new ClassMember(str, 'method');
|
|
||||||
expect(classMember.getDisplayDetails().displayText).toBe('getTime(int count)');
|
|
||||||
expect(classMember.getDisplayDetails().cssStyle).toBe(abstractStaticCssStyle);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('when method has single parameter type and name (name first)', function () {
|
|
||||||
it('should parse correctly', function () {
|
|
||||||
const str = `getTime(count int)`;
|
|
||||||
|
|
||||||
const classMember = new ClassMember(str, 'method');
|
|
||||||
expect(classMember.getDisplayDetails().displayText).toBe(str);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should handle public visibility', function () {
|
|
||||||
const str = `+getTime(count int)`;
|
|
||||||
|
|
||||||
const classMember = new ClassMember(str, 'method');
|
|
||||||
expect(classMember.getDisplayDetails().displayText).toBe('+getTime(count int)');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should handle private visibility', function () {
|
|
||||||
const str = `-getTime(count int)`;
|
|
||||||
|
|
||||||
const classMember = new ClassMember(str, 'method');
|
|
||||||
expect(classMember.getDisplayDetails().displayText).toBe('-getTime(count int)');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should handle protected visibility', function () {
|
|
||||||
const str = `#getTime(count int)`;
|
|
||||||
|
|
||||||
const classMember = new ClassMember(str, 'method');
|
|
||||||
expect(classMember.getDisplayDetails().displayText).toBe('#getTime(count int)');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should handle internal visibility', function () {
|
|
||||||
const str = `~getTime(count int)`;
|
|
||||||
|
|
||||||
const classMember = new ClassMember(str, 'method');
|
|
||||||
expect(classMember.getDisplayDetails().displayText).toBe('~getTime(count int)');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should return correct css for static classifier', function () {
|
|
||||||
const str = `getTime(count int)$`;
|
|
||||||
|
|
||||||
const classMember = new ClassMember(str, 'method');
|
|
||||||
expect(classMember.getDisplayDetails().displayText).toBe('getTime(count int)');
|
|
||||||
expect(classMember.getDisplayDetails().cssStyle).toBe(staticCssStyle);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should return correct css for abstract classifier', function () {
|
|
||||||
const str = `getTime(count int)*`;
|
|
||||||
|
|
||||||
const classMember = new ClassMember(str, 'method');
|
|
||||||
expect(classMember.getDisplayDetails().displayText).toBe('getTime(count int)');
|
|
||||||
expect(classMember.getDisplayDetails().cssStyle).toBe(abstractCssStyle);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should return correct css for abstract static classifier', function () {
|
|
||||||
const str = `getTime(count int)*$`;
|
|
||||||
|
|
||||||
const classMember = new ClassMember(str, 'method');
|
|
||||||
expect(classMember.getDisplayDetails().displayText).toBe('getTime(count int)');
|
|
||||||
expect(classMember.getDisplayDetails().cssStyle).toBe(abstractStaticCssStyle);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should return correct css for static abstract classifier', function () {
|
|
||||||
const str = `getTime(count int)$*`;
|
|
||||||
|
|
||||||
const classMember = new ClassMember(str, 'method');
|
|
||||||
expect(classMember.getDisplayDetails().displayText).toBe('getTime(count int)');
|
|
||||||
expect(classMember.getDisplayDetails().cssStyle).toBe(abstractStaticCssStyle);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('when method has multiple parameters', function () {
|
|
||||||
it('should parse correctly', function () {
|
|
||||||
const str = `getTime(string text, int count)`;
|
|
||||||
|
|
||||||
const classMember = new ClassMember(str, 'method');
|
|
||||||
expect(classMember.getDisplayDetails().displayText).toBe(str);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should handle public visibility', function () {
|
|
||||||
const str = `+getTime(string text, int count)`;
|
|
||||||
|
|
||||||
const classMember = new ClassMember(str, 'method');
|
|
||||||
expect(classMember.getDisplayDetails().displayText).toBe(str);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should handle private visibility', function () {
|
|
||||||
const str = `-getTime(string text, int count)`;
|
|
||||||
|
|
||||||
const classMember = new ClassMember(str, 'method');
|
|
||||||
expect(classMember.getDisplayDetails().displayText).toBe(str);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should handle protected visibility', function () {
|
|
||||||
const str = `#getTime(string text, int count)`;
|
|
||||||
|
|
||||||
const classMember = new ClassMember(str, 'method');
|
|
||||||
expect(classMember.getDisplayDetails().displayText).toBe(str);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should handle internal visibility', function () {
|
|
||||||
const str = `~getTime(string text, int count)`;
|
|
||||||
|
|
||||||
const classMember = new ClassMember(str, 'method');
|
|
||||||
expect(classMember.getDisplayDetails().displayText).toBe(str);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should return correct css for static classifier', function () {
|
|
||||||
const str = `getTime(string text, int count)$`;
|
|
||||||
|
|
||||||
const classMember = new ClassMember(str, 'method');
|
|
||||||
expect(classMember.getDisplayDetails().displayText).toBe('getTime(string text, int count)');
|
|
||||||
expect(classMember.getDisplayDetails().cssStyle).toBe(staticCssStyle);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should return correct css for abstract classifier', function () {
|
|
||||||
const str = `getTime(string text, int count)*`;
|
|
||||||
|
|
||||||
const classMember = new ClassMember(str, 'method');
|
|
||||||
expect(classMember.getDisplayDetails().displayText).toBe('getTime(string text, int count)');
|
|
||||||
expect(classMember.getDisplayDetails().cssStyle).toBe(abstractCssStyle);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should return correct css for abstract static classifier', function () {
|
|
||||||
const str = `getTime(string text, int count)*$`;
|
|
||||||
|
|
||||||
const classMember = new ClassMember(str, 'method');
|
|
||||||
expect(classMember.getDisplayDetails().displayText).toBe('getTime(string text, int count)');
|
|
||||||
expect(classMember.getDisplayDetails().cssStyle).toBe(abstractStaticCssStyle);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should return correct css for static abstract classifier', function () {
|
|
||||||
const str = `getTime(string text, int count)$*`;
|
|
||||||
|
|
||||||
const classMember = new ClassMember(str, 'method');
|
|
||||||
expect(classMember.getDisplayDetails().displayText).toBe('getTime(string text, int count)');
|
|
||||||
expect(classMember.getDisplayDetails().cssStyle).toBe(abstractStaticCssStyle);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('when method has return type', function () {
|
|
||||||
it('should parse correctly', function () {
|
|
||||||
const str = `getTime() DateTime`;
|
|
||||||
|
|
||||||
const classMember = new ClassMember(str, 'method');
|
|
||||||
expect(classMember.getDisplayDetails().displayText).toBe('getTime() : DateTime');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should handle public visibility', function () {
|
|
||||||
const str = `+getTime() DateTime`;
|
|
||||||
|
|
||||||
const classMember = new ClassMember(str, 'method');
|
|
||||||
expect(classMember.getDisplayDetails().displayText).toBe('+getTime() : DateTime');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should handle private visibility', function () {
|
|
||||||
const str = `-getTime() DateTime`;
|
|
||||||
|
|
||||||
const classMember = new ClassMember(str, 'method');
|
|
||||||
expect(classMember.getDisplayDetails().displayText).toBe('-getTime() : DateTime');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should handle protected visibility', function () {
|
|
||||||
const str = `#getTime() DateTime`;
|
|
||||||
|
|
||||||
const classMember = new ClassMember(str, 'method');
|
|
||||||
expect(classMember.getDisplayDetails().displayText).toBe('#getTime() : DateTime');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should handle internal visibility', function () {
|
|
||||||
const str = `~getTime() DateTime`;
|
|
||||||
|
|
||||||
const classMember = new ClassMember(str, 'method');
|
|
||||||
expect(classMember.getDisplayDetails().displayText).toBe('~getTime() : DateTime');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should return correct css for static classifier', function () {
|
|
||||||
const str = `getTime() DateTime$`;
|
|
||||||
|
|
||||||
const classMember = new ClassMember(str, 'method');
|
|
||||||
expect(classMember.getDisplayDetails().displayText).toBe('getTime() : DateTime');
|
|
||||||
expect(classMember.getDisplayDetails().cssStyle).toBe(staticCssStyle);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should return correct css for abstract classifier', function () {
|
|
||||||
const str = `getTime() DateTime*`;
|
|
||||||
|
|
||||||
const classMember = new ClassMember(str, 'method');
|
|
||||||
expect(classMember.getDisplayDetails().displayText).toBe('getTime() : DateTime');
|
|
||||||
expect(classMember.getDisplayDetails().cssStyle).toBe(abstractCssStyle);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should return correct css for abstract static classifier', function () {
|
|
||||||
const str = `getTime() DateTime*$`;
|
|
||||||
|
|
||||||
const classMember = new ClassMember(str, 'method');
|
|
||||||
expect(classMember.getDisplayDetails().displayText).toBe('getTime() : DateTime');
|
|
||||||
expect(classMember.getDisplayDetails().cssStyle).toBe(abstractStaticCssStyle);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should return correct css for static abstract classifier', function () {
|
|
||||||
const str = `getTime() DateTime$*`;
|
|
||||||
|
|
||||||
const classMember = new ClassMember(str, 'method');
|
|
||||||
expect(classMember.getDisplayDetails().displayText).toBe('getTime() : DateTime');
|
|
||||||
expect(classMember.getDisplayDetails().cssStyle).toBe(abstractStaticCssStyle);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('when method parameter is generic', function () {
|
|
||||||
it('should parse correctly', function () {
|
|
||||||
const str = `getTimes(List~T~)`;
|
|
||||||
|
|
||||||
const classMember = new ClassMember(str, 'method');
|
|
||||||
expect(classMember.getDisplayDetails().displayText).toBe('getTimes(List<T>)');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should handle public visibility', function () {
|
|
||||||
const str = `+getTimes(List~T~)`;
|
|
||||||
|
|
||||||
const classMember = new ClassMember(str, 'method');
|
|
||||||
expect(classMember.getDisplayDetails().displayText).toBe('+getTimes(List<T>)');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should handle private visibility', function () {
|
|
||||||
const str = `-getTimes(List~T~)`;
|
|
||||||
|
|
||||||
const classMember = new ClassMember(str, 'method');
|
|
||||||
expect(classMember.getDisplayDetails().displayText).toBe('-getTimes(List<T>)');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should handle protected visibility', function () {
|
|
||||||
const str = `#getTimes(List~T~)`;
|
|
||||||
|
|
||||||
const classMember = new ClassMember(str, 'method');
|
|
||||||
expect(classMember.getDisplayDetails().displayText).toBe('#getTimes(List<T>)');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should handle internal visibility', function () {
|
|
||||||
const str = `~getTimes(List~T~)`;
|
|
||||||
|
|
||||||
const classMember = new ClassMember(str, 'method');
|
|
||||||
expect(classMember.getDisplayDetails().displayText).toBe('~getTimes(List<T>)');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should return correct css for static classifier', function () {
|
|
||||||
const str = `getTimes(List~T~)$`;
|
|
||||||
|
|
||||||
const classMember = new ClassMember(str, 'method');
|
|
||||||
expect(classMember.getDisplayDetails().displayText).toBe('getTimes(List<T>)');
|
|
||||||
expect(classMember.getDisplayDetails().cssStyle).toBe(staticCssStyle);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should return correct css for abstract classifier', function () {
|
|
||||||
const str = `getTimes(List~T~)*`;
|
|
||||||
|
|
||||||
const classMember = new ClassMember(str, 'method');
|
|
||||||
expect(classMember.getDisplayDetails().displayText).toBe('getTimes(List<T>)');
|
|
||||||
expect(classMember.getDisplayDetails().cssStyle).toBe(abstractCssStyle);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should return correct css for abstract static classifier', function () {
|
|
||||||
const str = `getTimes(List~T~)*$`;
|
|
||||||
|
|
||||||
const classMember = new ClassMember(str, 'method');
|
|
||||||
expect(classMember.getDisplayDetails().displayText).toBe('getTimes(List<T>)');
|
|
||||||
expect(classMember.getDisplayDetails().cssStyle).toBe(abstractStaticCssStyle);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should return correct css for static abstract classifier', function () {
|
|
||||||
const str = `getTimes(List~T~)$*`;
|
|
||||||
|
|
||||||
const classMember = new ClassMember(str, 'method');
|
|
||||||
expect(classMember.getDisplayDetails().displayText).toBe('getTimes(List<T>)');
|
|
||||||
expect(classMember.getDisplayDetails().cssStyle).toBe(abstractStaticCssStyle);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('when method parameter contains two generic', function () {
|
|
||||||
it('should parse correctly', function () {
|
|
||||||
const str = `getTimes(List~T~, List~OT~)`;
|
|
||||||
|
|
||||||
const classMember = new ClassMember(str, 'method');
|
|
||||||
expect(classMember.getDisplayDetails().displayText).toBe('getTimes(List<T>, List<OT>)');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should handle public visibility', function () {
|
|
||||||
const str = `+getTimes(List~T~, List~OT~)`;
|
|
||||||
|
|
||||||
const classMember = new ClassMember(str, 'method');
|
|
||||||
expect(classMember.getDisplayDetails().displayText).toBe('+getTimes(List<T>, List<OT>)');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should handle private visibility', function () {
|
|
||||||
const str = `-getTimes(List~T~, List~OT~)`;
|
|
||||||
|
|
||||||
const classMember = new ClassMember(str, 'method');
|
|
||||||
expect(classMember.getDisplayDetails().displayText).toBe('-getTimes(List<T>, List<OT>)');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should handle protected visibility', function () {
|
|
||||||
const str = `#getTimes(List~T~, List~OT~)`;
|
|
||||||
|
|
||||||
const classMember = new ClassMember(str, 'method');
|
|
||||||
expect(classMember.getDisplayDetails().displayText).toBe('#getTimes(List<T>, List<OT>)');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should handle internal visibility', function () {
|
|
||||||
const str = `~getTimes(List~T~, List~OT~)`;
|
|
||||||
|
|
||||||
const classMember = new ClassMember(str, 'method');
|
|
||||||
expect(classMember.getDisplayDetails().displayText).toBe('~getTimes(List<T>, List<OT>)');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should return correct css for static classifier', function () {
|
|
||||||
const str = `getTimes(List~T~, List~OT~)$`;
|
|
||||||
|
|
||||||
const classMember = new ClassMember(str, 'method');
|
|
||||||
expect(classMember.getDisplayDetails().displayText).toBe('getTimes(List<T>, List<OT>)');
|
|
||||||
expect(classMember.getDisplayDetails().cssStyle).toBe(staticCssStyle);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should return correct css for abstract classifier', function () {
|
|
||||||
const str = `getTimes(List~T~, List~OT~)*`;
|
|
||||||
|
|
||||||
const classMember = new ClassMember(str, 'method');
|
|
||||||
expect(classMember.getDisplayDetails().displayText).toBe('getTimes(List<T>, List<OT>)');
|
|
||||||
expect(classMember.getDisplayDetails().cssStyle).toBe(abstractCssStyle);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should return correct css for abstract static classifier', function () {
|
|
||||||
const str = `getTimes(List~T~, List~OT~)*$`;
|
|
||||||
|
|
||||||
const classMember = new ClassMember(str, 'method');
|
|
||||||
expect(classMember.getDisplayDetails().displayText).toBe('getTimes(List<T>, List<OT>)');
|
|
||||||
expect(classMember.getDisplayDetails().cssStyle).toBe(abstractStaticCssStyle);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should return correct css for static abstract classifier', function () {
|
|
||||||
const str = `getTimes(List~T~, List~OT~)$*`;
|
|
||||||
|
|
||||||
const classMember = new ClassMember(str, 'method');
|
|
||||||
expect(classMember.getDisplayDetails().displayText).toBe('getTimes(List<T>, List<OT>)');
|
|
||||||
expect(classMember.getDisplayDetails().cssStyle).toBe(abstractStaticCssStyle);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('when method parameter is a nested generic', function () {
|
|
||||||
it('should parse correctly', function () {
|
|
||||||
const str = `getTimetableList(List~List~T~~)`;
|
|
||||||
|
|
||||||
const classMember = new ClassMember(str, 'method');
|
|
||||||
expect(classMember.getDisplayDetails().displayText).toBe('getTimetableList(List<List<T>>)');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should handle public visibility', function () {
|
|
||||||
const str = `+getTimetableList(List~List~T~~)`;
|
|
||||||
|
|
||||||
const classMember = new ClassMember(str, 'method');
|
|
||||||
expect(classMember.getDisplayDetails().displayText).toBe('+getTimetableList(List<List<T>>)');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should handle private visibility', function () {
|
|
||||||
const str = `-getTimetableList(List~List~T~~)`;
|
|
||||||
|
|
||||||
const classMember = new ClassMember(str, 'method');
|
|
||||||
expect(classMember.getDisplayDetails().displayText).toBe('-getTimetableList(List<List<T>>)');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should handle protected visibility', function () {
|
|
||||||
const str = `#getTimetableList(List~List~T~~)`;
|
|
||||||
|
|
||||||
const classMember = new ClassMember(str, 'method');
|
|
||||||
expect(classMember.getDisplayDetails().displayText).toBe('#getTimetableList(List<List<T>>)');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should handle internal visibility', function () {
|
|
||||||
const str = `~getTimetableList(List~List~T~~)`;
|
|
||||||
|
|
||||||
const classMember = new ClassMember(str, 'method');
|
|
||||||
expect(classMember.getDisplayDetails().displayText).toBe('~getTimetableList(List<List<T>>)');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should return correct css for static classifier', function () {
|
|
||||||
const str = `getTimetableList(List~List~T~~)$`;
|
|
||||||
|
|
||||||
const classMember = new ClassMember(str, 'method');
|
|
||||||
expect(classMember.getDisplayDetails().displayText).toBe('getTimetableList(List<List<T>>)');
|
|
||||||
expect(classMember.getDisplayDetails().cssStyle).toBe(staticCssStyle);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should return correct css for abstract classifier', function () {
|
|
||||||
const str = `getTimetableList(List~List~T~~)*`;
|
|
||||||
|
|
||||||
const classMember = new ClassMember(str, 'method');
|
|
||||||
expect(classMember.getDisplayDetails().displayText).toBe('getTimetableList(List<List<T>>)');
|
|
||||||
expect(classMember.getDisplayDetails().cssStyle).toBe(abstractCssStyle);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should return correct css for abstract static classifier', function () {
|
|
||||||
const str = `getTimetableList(List~List~T~~)*$`;
|
|
||||||
|
|
||||||
const classMember = new ClassMember(str, 'method');
|
|
||||||
expect(classMember.getDisplayDetails().displayText).toBe('getTimetableList(List<List<T>>)');
|
|
||||||
expect(classMember.getDisplayDetails().cssStyle).toBe(abstractStaticCssStyle);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should return correct css for static abstract classifier', function () {
|
|
||||||
const str = `getTimetableList(List~List~T~~)$*`;
|
|
||||||
|
|
||||||
const classMember = new ClassMember(str, 'method');
|
|
||||||
expect(classMember.getDisplayDetails().displayText).toBe('getTimetableList(List<List<T>>)');
|
|
||||||
expect(classMember.getDisplayDetails().cssStyle).toBe(abstractStaticCssStyle);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('when method parameter is a composite generic', function () {
|
|
||||||
const methodNameAndParameters = 'getTimes(List~K, V~)';
|
|
||||||
const expectedMethodNameAndParameters = 'getTimes(List<K, V>)';
|
|
||||||
it('should parse correctly', function () {
|
|
||||||
const str = methodNameAndParameters;
|
|
||||||
|
|
||||||
const classMember = new ClassMember(str, 'method');
|
|
||||||
expect(classMember.getDisplayDetails().displayText).toBe(expectedMethodNameAndParameters);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should handle public visibility', function () {
|
|
||||||
const str = '+' + methodNameAndParameters;
|
|
||||||
|
|
||||||
const classMember = new ClassMember(str, 'method');
|
|
||||||
expect(classMember.getDisplayDetails().displayText).toBe(
|
|
||||||
'+' + expectedMethodNameAndParameters
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should handle private visibility', function () {
|
|
||||||
const str = '-' + methodNameAndParameters;
|
|
||||||
const classMember = new ClassMember(str, 'method');
|
|
||||||
expect(classMember.getDisplayDetails().displayText).toBe(
|
|
||||||
'-' + expectedMethodNameAndParameters
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should handle protected visibility', function () {
|
|
||||||
const str = '#' + methodNameAndParameters;
|
|
||||||
const classMember = new ClassMember(str, 'method');
|
|
||||||
expect(classMember.getDisplayDetails().displayText).toBe(
|
|
||||||
'#' + expectedMethodNameAndParameters
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should handle internal visibility', function () {
|
|
||||||
const str = '~' + methodNameAndParameters;
|
|
||||||
|
|
||||||
const classMember = new ClassMember(str, 'method');
|
|
||||||
expect(classMember.getDisplayDetails().displayText).toBe(
|
|
||||||
'~' + expectedMethodNameAndParameters
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should return correct css for static classifier', function () {
|
|
||||||
const str = methodNameAndParameters + '$';
|
|
||||||
const classMember = new ClassMember(str, 'method');
|
|
||||||
expect(classMember.getDisplayDetails().displayText).toBe(expectedMethodNameAndParameters);
|
|
||||||
expect(classMember.getDisplayDetails().cssStyle).toBe(staticCssStyle);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should return correct css for abstract classifier', function () {
|
|
||||||
const str = methodNameAndParameters + '*';
|
|
||||||
const classMember = new ClassMember(str, 'method');
|
|
||||||
expect(classMember.getDisplayDetails().displayText).toBe(expectedMethodNameAndParameters);
|
|
||||||
expect(classMember.getDisplayDetails().cssStyle).toBe(abstractCssStyle);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should return correct css for abstract static classifier', function () {
|
|
||||||
const str = methodNameAndParameters + '*$';
|
|
||||||
const classMember = new ClassMember(str, 'method');
|
|
||||||
expect(classMember.getDisplayDetails().displayText).toBe(expectedMethodNameAndParameters);
|
|
||||||
expect(classMember.getDisplayDetails().cssStyle).toBe(abstractStaticCssStyle);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should return correct css for static abstract classifier', function () {
|
|
||||||
const str = methodNameAndParameters + '$*';
|
|
||||||
const classMember = new ClassMember(str, 'method');
|
|
||||||
expect(classMember.getDisplayDetails().displayText).toBe(expectedMethodNameAndParameters);
|
|
||||||
expect(classMember.getDisplayDetails().cssStyle).toBe(abstractStaticCssStyle);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('when method return type is generic', function () {
|
|
||||||
it('should parse correctly', function () {
|
|
||||||
const str = `getTimes() List~T~`;
|
|
||||||
|
|
||||||
const classMember = new ClassMember(str, 'method');
|
|
||||||
expect(classMember.getDisplayDetails().displayText).toBe('getTimes() : List<T>');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should handle public visibility', function () {
|
|
||||||
const str = `+getTimes() List~T~`;
|
|
||||||
|
|
||||||
const classMember = new ClassMember(str, 'method');
|
|
||||||
expect(classMember.getDisplayDetails().displayText).toBe('+getTimes() : List<T>');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should handle private visibility', function () {
|
|
||||||
const str = `-getTimes() List~T~`;
|
|
||||||
|
|
||||||
const classMember = new ClassMember(str, 'method');
|
|
||||||
expect(classMember.getDisplayDetails().displayText).toBe('-getTimes() : List<T>');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should handle protected visibility', function () {
|
|
||||||
const str = `#getTimes() List~T~`;
|
|
||||||
|
|
||||||
const classMember = new ClassMember(str, 'method');
|
|
||||||
expect(classMember.getDisplayDetails().displayText).toBe('#getTimes() : List<T>');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should handle internal visibility', function () {
|
|
||||||
const str = `~getTimes() List~T~`;
|
|
||||||
|
|
||||||
const classMember = new ClassMember(str, 'method');
|
|
||||||
expect(classMember.getDisplayDetails().displayText).toBe('~getTimes() : List<T>');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should return correct css for static classifier', function () {
|
|
||||||
const str = `getTimes() List~T~$`;
|
|
||||||
|
|
||||||
const classMember = new ClassMember(str, 'method');
|
|
||||||
expect(classMember.getDisplayDetails().displayText).toBe('getTimes() : List<T>');
|
|
||||||
expect(classMember.getDisplayDetails().cssStyle).toBe(staticCssStyle);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should return correct css for abstract classifier', function () {
|
|
||||||
const str = `getTimes() List~T~*`;
|
|
||||||
|
|
||||||
const classMember = new ClassMember(str, 'method');
|
|
||||||
expect(classMember.getDisplayDetails().displayText).toBe('getTimes() : List<T>');
|
|
||||||
expect(classMember.getDisplayDetails().cssStyle).toBe(abstractCssStyle);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should return correct css for abstract static classifier', function () {
|
|
||||||
const str = `getTimes() List~T~*$`;
|
|
||||||
|
|
||||||
const classMember = new ClassMember(str, 'method');
|
|
||||||
expect(classMember.getDisplayDetails().displayText).toBe('getTimes() : List<T>');
|
|
||||||
expect(classMember.getDisplayDetails().cssStyle).toBe(abstractStaticCssStyle);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should return correct css for static abstract classifier', function () {
|
|
||||||
const str = `getTimes() List~T~$*`;
|
|
||||||
|
|
||||||
const classMember = new ClassMember(str, 'method');
|
|
||||||
expect(classMember.getDisplayDetails().displayText).toBe('getTimes() : List<T>');
|
|
||||||
expect(classMember.getDisplayDetails().cssStyle).toBe(abstractStaticCssStyle);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('when method return type is a nested generic', function () {
|
|
||||||
it('should parse correctly', function () {
|
|
||||||
const str = `getTimetableList() List~List~T~~`;
|
|
||||||
|
|
||||||
const classMember = new ClassMember(str, 'method');
|
|
||||||
expect(classMember.getDisplayDetails().displayText).toBe(
|
|
||||||
'getTimetableList() : List<List<T>>'
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should handle public visibility', function () {
|
|
||||||
const str = `+getTimetableList() List~List~T~~`;
|
|
||||||
|
|
||||||
const classMember = new ClassMember(str, 'method');
|
|
||||||
expect(classMember.getDisplayDetails().displayText).toBe(
|
|
||||||
'+getTimetableList() : List<List<T>>'
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should handle private visibility', function () {
|
|
||||||
const str = `-getTimetableList() List~List~T~~`;
|
|
||||||
|
|
||||||
const classMember = new ClassMember(str, 'method');
|
|
||||||
expect(classMember.getDisplayDetails().displayText).toBe(
|
|
||||||
'-getTimetableList() : List<List<T>>'
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should handle protected visibility', function () {
|
|
||||||
const str = `#getTimetableList() List~List~T~~`;
|
|
||||||
|
|
||||||
const classMember = new ClassMember(str, 'method');
|
|
||||||
expect(classMember.getDisplayDetails().displayText).toBe(
|
|
||||||
'#getTimetableList() : List<List<T>>'
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should handle internal visibility', function () {
|
|
||||||
const str = `~getTimetableList() List~List~T~~`;
|
|
||||||
|
|
||||||
const classMember = new ClassMember(str, 'method');
|
|
||||||
expect(classMember.getDisplayDetails().displayText).toBe(
|
|
||||||
'~getTimetableList() : List<List<T>>'
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should return correct css for static classifier', function () {
|
|
||||||
const str = `getTimetableList() List~List~T~~$`;
|
|
||||||
|
|
||||||
const classMember = new ClassMember(str, 'method');
|
|
||||||
expect(classMember.getDisplayDetails().displayText).toBe(
|
|
||||||
'getTimetableList() : List<List<T>>'
|
|
||||||
);
|
|
||||||
expect(classMember.getDisplayDetails().cssStyle).toBe(staticCssStyle);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should return correct css for abstract classifier', function () {
|
|
||||||
const str = `getTimetableList() List~List~T~~*`;
|
|
||||||
|
|
||||||
const classMember = new ClassMember(str, 'method');
|
|
||||||
expect(classMember.getDisplayDetails().displayText).toBe(
|
|
||||||
'getTimetableList() : List<List<T>>'
|
|
||||||
);
|
|
||||||
expect(classMember.getDisplayDetails().cssStyle).toBe(abstractCssStyle);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should return correct css for abstract static classifier', function () {
|
|
||||||
const str = `getTimetableList() List~List~T~~*$`;
|
|
||||||
|
|
||||||
const classMember = new ClassMember(str, 'method');
|
|
||||||
expect(classMember.getDisplayDetails().displayText).toBe(
|
|
||||||
'getTimetableList() : List<List<T>>'
|
|
||||||
);
|
|
||||||
expect(classMember.getDisplayDetails().cssStyle).toBe(abstractStaticCssStyle);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should return correct css for static abstract classifier', function () {
|
|
||||||
const str = `getTimetableList() List~List~T~~$*`;
|
|
||||||
|
|
||||||
const classMember = new ClassMember(str, 'method');
|
|
||||||
expect(classMember.getDisplayDetails().displayText).toBe(
|
|
||||||
'getTimetableList() : List<List<T>>'
|
|
||||||
);
|
|
||||||
expect(classMember.getDisplayDetails().cssStyle).toBe(abstractStaticCssStyle);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
@@ -4,9 +4,664 @@ const spyOn = vi.spyOn;
|
|||||||
|
|
||||||
const staticCssStyle = 'text-decoration:underline;';
|
const staticCssStyle = 'text-decoration:underline;';
|
||||||
const abstractCssStyle = 'font-style:italic;';
|
const abstractCssStyle = 'font-style:italic;';
|
||||||
const abstractStaticCssStyle = 'text-decoration:underline;font-style:italic;';
|
|
||||||
|
|
||||||
describe('given text representing a method, ', function () {
|
describe('given text representing a method, ', function () {
|
||||||
|
describe('when method has no parameters', function () {
|
||||||
|
it('should parse correctly', function () {
|
||||||
|
const str = `getTime()`;
|
||||||
|
|
||||||
|
const classMember = new ClassMember(str, 'method');
|
||||||
|
expect(classMember.getDisplayDetails().displayText).toBe(str);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should handle public visibility', function () {
|
||||||
|
const str = `+getTime()`;
|
||||||
|
|
||||||
|
const classMember = new ClassMember(str, 'method');
|
||||||
|
expect(classMember.getDisplayDetails().displayText).toBe('+getTime()');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should handle private visibility', function () {
|
||||||
|
const str = `-getTime()`;
|
||||||
|
|
||||||
|
const classMember = new ClassMember(str, 'method');
|
||||||
|
expect(classMember.getDisplayDetails().displayText).toBe('-getTime()');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should handle protected visibility', function () {
|
||||||
|
const str = `#getTime()`;
|
||||||
|
|
||||||
|
const classMember = new ClassMember(str, 'method');
|
||||||
|
expect(classMember.getDisplayDetails().displayText).toBe('#getTime()');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should handle internal visibility', function () {
|
||||||
|
const str = `~getTime()`;
|
||||||
|
|
||||||
|
const classMember = new ClassMember(str, 'method');
|
||||||
|
expect(classMember.getDisplayDetails().displayText).toBe('~getTime()');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return correct css for static classifier', function () {
|
||||||
|
const str = `getTime()$`;
|
||||||
|
|
||||||
|
const classMember = new ClassMember(str, 'method');
|
||||||
|
expect(classMember.getDisplayDetails().displayText).toBe('getTime()');
|
||||||
|
expect(classMember.getDisplayDetails().cssStyle).toBe(staticCssStyle);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return correct css for abstract classifier', function () {
|
||||||
|
const str = `getTime()*`;
|
||||||
|
|
||||||
|
const classMember = new ClassMember(str, 'method');
|
||||||
|
expect(classMember.getDisplayDetails().displayText).toBe('getTime()');
|
||||||
|
expect(classMember.getDisplayDetails().cssStyle).toBe(abstractCssStyle);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('when method has single parameter value', function () {
|
||||||
|
it('should parse correctly', function () {
|
||||||
|
const str = `getTime(int)`;
|
||||||
|
|
||||||
|
const classMember = new ClassMember(str, 'method');
|
||||||
|
expect(classMember.getDisplayDetails().displayText).toBe(str);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should handle public visibility', function () {
|
||||||
|
const str = `+getTime(int)`;
|
||||||
|
|
||||||
|
const classMember = new ClassMember(str, 'method');
|
||||||
|
expect(classMember.getDisplayDetails().displayText).toBe('+getTime(int)');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should handle private visibility', function () {
|
||||||
|
const str = `-getTime(int)`;
|
||||||
|
|
||||||
|
const classMember = new ClassMember(str, 'method');
|
||||||
|
expect(classMember.getDisplayDetails().displayText).toBe('-getTime(int)');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should handle protected visibility', function () {
|
||||||
|
const str = `#getTime(int)`;
|
||||||
|
|
||||||
|
const classMember = new ClassMember(str, 'method');
|
||||||
|
expect(classMember.getDisplayDetails().displayText).toBe('#getTime(int)');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should handle internal visibility', function () {
|
||||||
|
const str = `~getTime(int)`;
|
||||||
|
|
||||||
|
const classMember = new ClassMember(str, 'method');
|
||||||
|
expect(classMember.getDisplayDetails().displayText).toBe('~getTime(int)');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return correct css for static classifier', function () {
|
||||||
|
const str = `getTime(int)$`;
|
||||||
|
|
||||||
|
const classMember = new ClassMember(str, 'method');
|
||||||
|
expect(classMember.getDisplayDetails().displayText).toBe('getTime(int)');
|
||||||
|
expect(classMember.getDisplayDetails().cssStyle).toBe(staticCssStyle);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return correct css for abstract classifier', function () {
|
||||||
|
const str = `getTime(int)*`;
|
||||||
|
|
||||||
|
const classMember = new ClassMember(str, 'method');
|
||||||
|
expect(classMember.getDisplayDetails().displayText).toBe('getTime(int)');
|
||||||
|
expect(classMember.getDisplayDetails().cssStyle).toBe(abstractCssStyle);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('when method has single parameter type and name (type first)', function () {
|
||||||
|
it('should parse correctly', function () {
|
||||||
|
const str = `getTime(int count)`;
|
||||||
|
|
||||||
|
const classMember = new ClassMember(str, 'method');
|
||||||
|
expect(classMember.getDisplayDetails().displayText).toBe(str);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should handle public visibility', function () {
|
||||||
|
const str = `+getTime(int count)`;
|
||||||
|
|
||||||
|
const classMember = new ClassMember(str, 'method');
|
||||||
|
expect(classMember.getDisplayDetails().displayText).toBe('+getTime(int count)');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should handle private visibility', function () {
|
||||||
|
const str = `-getTime(int count)`;
|
||||||
|
|
||||||
|
const classMember = new ClassMember(str, 'method');
|
||||||
|
expect(classMember.getDisplayDetails().displayText).toBe('-getTime(int count)');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should handle protected visibility', function () {
|
||||||
|
const str = `#getTime(int count)`;
|
||||||
|
|
||||||
|
const classMember = new ClassMember(str, 'method');
|
||||||
|
expect(classMember.getDisplayDetails().displayText).toBe('#getTime(int count)');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should handle internal visibility', function () {
|
||||||
|
const str = `~getTime(int count)`;
|
||||||
|
|
||||||
|
const classMember = new ClassMember(str, 'method');
|
||||||
|
expect(classMember.getDisplayDetails().displayText).toBe('~getTime(int count)');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return correct css for static classifier', function () {
|
||||||
|
const str = `getTime(int count)$`;
|
||||||
|
|
||||||
|
const classMember = new ClassMember(str, 'method');
|
||||||
|
expect(classMember.getDisplayDetails().displayText).toBe('getTime(int count)');
|
||||||
|
expect(classMember.getDisplayDetails().cssStyle).toBe(staticCssStyle);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return correct css for abstract classifier', function () {
|
||||||
|
const str = `getTime(int count)*`;
|
||||||
|
|
||||||
|
const classMember = new ClassMember(str, 'method');
|
||||||
|
expect(classMember.getDisplayDetails().displayText).toBe('getTime(int count)');
|
||||||
|
expect(classMember.getDisplayDetails().cssStyle).toBe(abstractCssStyle);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('when method has single parameter type and name (name first)', function () {
|
||||||
|
it('should parse correctly', function () {
|
||||||
|
const str = `getTime(count int)`;
|
||||||
|
|
||||||
|
const classMember = new ClassMember(str, 'method');
|
||||||
|
expect(classMember.getDisplayDetails().displayText).toBe(str);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should handle public visibility', function () {
|
||||||
|
const str = `+getTime(count int)`;
|
||||||
|
|
||||||
|
const classMember = new ClassMember(str, 'method');
|
||||||
|
expect(classMember.getDisplayDetails().displayText).toBe('+getTime(count int)');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should handle private visibility', function () {
|
||||||
|
const str = `-getTime(count int)`;
|
||||||
|
|
||||||
|
const classMember = new ClassMember(str, 'method');
|
||||||
|
expect(classMember.getDisplayDetails().displayText).toBe('-getTime(count int)');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should handle protected visibility', function () {
|
||||||
|
const str = `#getTime(count int)`;
|
||||||
|
|
||||||
|
const classMember = new ClassMember(str, 'method');
|
||||||
|
expect(classMember.getDisplayDetails().displayText).toBe('#getTime(count int)');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should handle internal visibility', function () {
|
||||||
|
const str = `~getTime(count int)`;
|
||||||
|
|
||||||
|
const classMember = new ClassMember(str, 'method');
|
||||||
|
expect(classMember.getDisplayDetails().displayText).toBe('~getTime(count int)');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return correct css for static classifier', function () {
|
||||||
|
const str = `getTime(count int)$`;
|
||||||
|
|
||||||
|
const classMember = new ClassMember(str, 'method');
|
||||||
|
expect(classMember.getDisplayDetails().displayText).toBe('getTime(count int)');
|
||||||
|
expect(classMember.getDisplayDetails().cssStyle).toBe(staticCssStyle);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return correct css for abstract classifier', function () {
|
||||||
|
const str = `getTime(count int)*`;
|
||||||
|
|
||||||
|
const classMember = new ClassMember(str, 'method');
|
||||||
|
expect(classMember.getDisplayDetails().displayText).toBe('getTime(count int)');
|
||||||
|
expect(classMember.getDisplayDetails().cssStyle).toBe(abstractCssStyle);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('when method has multiple parameters', function () {
|
||||||
|
it('should parse correctly', function () {
|
||||||
|
const str = `getTime(string text, int count)`;
|
||||||
|
|
||||||
|
const classMember = new ClassMember(str, 'method');
|
||||||
|
expect(classMember.getDisplayDetails().displayText).toBe(str);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should handle public visibility', function () {
|
||||||
|
const str = `+getTime(string text, int count)`;
|
||||||
|
|
||||||
|
const classMember = new ClassMember(str, 'method');
|
||||||
|
expect(classMember.getDisplayDetails().displayText).toBe(str);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should handle private visibility', function () {
|
||||||
|
const str = `-getTime(string text, int count)`;
|
||||||
|
|
||||||
|
const classMember = new ClassMember(str, 'method');
|
||||||
|
expect(classMember.getDisplayDetails().displayText).toBe(str);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should handle protected visibility', function () {
|
||||||
|
const str = `#getTime(string text, int count)`;
|
||||||
|
|
||||||
|
const classMember = new ClassMember(str, 'method');
|
||||||
|
expect(classMember.getDisplayDetails().displayText).toBe(str);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should handle internal visibility', function () {
|
||||||
|
const str = `~getTime(string text, int count)`;
|
||||||
|
|
||||||
|
const classMember = new ClassMember(str, 'method');
|
||||||
|
expect(classMember.getDisplayDetails().displayText).toBe(str);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return correct css for static classifier', function () {
|
||||||
|
const str = `getTime(string text, int count)$`;
|
||||||
|
|
||||||
|
const classMember = new ClassMember(str, 'method');
|
||||||
|
expect(classMember.getDisplayDetails().displayText).toBe('getTime(string text, int count)');
|
||||||
|
expect(classMember.getDisplayDetails().cssStyle).toBe(staticCssStyle);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return correct css for abstract classifier', function () {
|
||||||
|
const str = `getTime(string text, int count)*`;
|
||||||
|
|
||||||
|
const classMember = new ClassMember(str, 'method');
|
||||||
|
expect(classMember.getDisplayDetails().displayText).toBe('getTime(string text, int count)');
|
||||||
|
expect(classMember.getDisplayDetails().cssStyle).toBe(abstractCssStyle);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('when method has return type', function () {
|
||||||
|
it('should parse correctly', function () {
|
||||||
|
const str = `getTime() DateTime`;
|
||||||
|
|
||||||
|
const classMember = new ClassMember(str, 'method');
|
||||||
|
expect(classMember.getDisplayDetails().displayText).toBe('getTime() : DateTime');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should handle public visibility', function () {
|
||||||
|
const str = `+getTime() DateTime`;
|
||||||
|
|
||||||
|
const classMember = new ClassMember(str, 'method');
|
||||||
|
expect(classMember.getDisplayDetails().displayText).toBe('+getTime() : DateTime');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should handle private visibility', function () {
|
||||||
|
const str = `-getTime() DateTime`;
|
||||||
|
|
||||||
|
const classMember = new ClassMember(str, 'method');
|
||||||
|
expect(classMember.getDisplayDetails().displayText).toBe('-getTime() : DateTime');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should handle protected visibility', function () {
|
||||||
|
const str = `#getTime() DateTime`;
|
||||||
|
|
||||||
|
const classMember = new ClassMember(str, 'method');
|
||||||
|
expect(classMember.getDisplayDetails().displayText).toBe('#getTime() : DateTime');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should handle internal visibility', function () {
|
||||||
|
const str = `~getTime() DateTime`;
|
||||||
|
|
||||||
|
const classMember = new ClassMember(str, 'method');
|
||||||
|
expect(classMember.getDisplayDetails().displayText).toBe('~getTime() : DateTime');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return correct css for static classifier', function () {
|
||||||
|
const str = `getTime() DateTime$`;
|
||||||
|
|
||||||
|
const classMember = new ClassMember(str, 'method');
|
||||||
|
expect(classMember.getDisplayDetails().displayText).toBe('getTime() : DateTime');
|
||||||
|
expect(classMember.getDisplayDetails().cssStyle).toBe(staticCssStyle);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return correct css for abstract classifier', function () {
|
||||||
|
const str = `getTime() DateTime*`;
|
||||||
|
|
||||||
|
const classMember = new ClassMember(str, 'method');
|
||||||
|
expect(classMember.getDisplayDetails().displayText).toBe('getTime() : DateTime');
|
||||||
|
expect(classMember.getDisplayDetails().cssStyle).toBe(abstractCssStyle);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('when method parameter is generic', function () {
|
||||||
|
it('should parse correctly', function () {
|
||||||
|
const str = `getTimes(List~T~)`;
|
||||||
|
|
||||||
|
const classMember = new ClassMember(str, 'method');
|
||||||
|
expect(classMember.getDisplayDetails().displayText).toBe('getTimes(List<T>)');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should handle public visibility', function () {
|
||||||
|
const str = `+getTimes(List~T~)`;
|
||||||
|
|
||||||
|
const classMember = new ClassMember(str, 'method');
|
||||||
|
expect(classMember.getDisplayDetails().displayText).toBe('+getTimes(List<T>)');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should handle private visibility', function () {
|
||||||
|
const str = `-getTimes(List~T~)`;
|
||||||
|
|
||||||
|
const classMember = new ClassMember(str, 'method');
|
||||||
|
expect(classMember.getDisplayDetails().displayText).toBe('-getTimes(List<T>)');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should handle protected visibility', function () {
|
||||||
|
const str = `#getTimes(List~T~)`;
|
||||||
|
|
||||||
|
const classMember = new ClassMember(str, 'method');
|
||||||
|
expect(classMember.getDisplayDetails().displayText).toBe('#getTimes(List<T>)');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should handle internal visibility', function () {
|
||||||
|
const str = `~getTimes(List~T~)`;
|
||||||
|
|
||||||
|
const classMember = new ClassMember(str, 'method');
|
||||||
|
expect(classMember.getDisplayDetails().displayText).toBe('~getTimes(List<T>)');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return correct css for static classifier', function () {
|
||||||
|
const str = `getTimes(List~T~)$`;
|
||||||
|
|
||||||
|
const classMember = new ClassMember(str, 'method');
|
||||||
|
expect(classMember.getDisplayDetails().displayText).toBe('getTimes(List<T>)');
|
||||||
|
expect(classMember.getDisplayDetails().cssStyle).toBe(staticCssStyle);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return correct css for abstract classifier', function () {
|
||||||
|
const str = `getTimes(List~T~)*`;
|
||||||
|
|
||||||
|
const classMember = new ClassMember(str, 'method');
|
||||||
|
expect(classMember.getDisplayDetails().displayText).toBe('getTimes(List<T>)');
|
||||||
|
expect(classMember.getDisplayDetails().cssStyle).toBe(abstractCssStyle);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('when method parameter contains two generic', function () {
|
||||||
|
it('should parse correctly', function () {
|
||||||
|
const str = `getTimes(List~T~, List~OT~)`;
|
||||||
|
|
||||||
|
const classMember = new ClassMember(str, 'method');
|
||||||
|
expect(classMember.getDisplayDetails().displayText).toBe('getTimes(List<T>, List<OT>)');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should handle public visibility', function () {
|
||||||
|
const str = `+getTimes(List~T~, List~OT~)`;
|
||||||
|
|
||||||
|
const classMember = new ClassMember(str, 'method');
|
||||||
|
expect(classMember.getDisplayDetails().displayText).toBe('+getTimes(List<T>, List<OT>)');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should handle private visibility', function () {
|
||||||
|
const str = `-getTimes(List~T~, List~OT~)`;
|
||||||
|
|
||||||
|
const classMember = new ClassMember(str, 'method');
|
||||||
|
expect(classMember.getDisplayDetails().displayText).toBe('-getTimes(List<T>, List<OT>)');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should handle protected visibility', function () {
|
||||||
|
const str = `#getTimes(List~T~, List~OT~)`;
|
||||||
|
|
||||||
|
const classMember = new ClassMember(str, 'method');
|
||||||
|
expect(classMember.getDisplayDetails().displayText).toBe('#getTimes(List<T>, List<OT>)');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should handle internal visibility', function () {
|
||||||
|
const str = `~getTimes(List~T~, List~OT~)`;
|
||||||
|
|
||||||
|
const classMember = new ClassMember(str, 'method');
|
||||||
|
expect(classMember.getDisplayDetails().displayText).toBe('~getTimes(List<T>, List<OT>)');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return correct css for static classifier', function () {
|
||||||
|
const str = `getTimes(List~T~, List~OT~)$`;
|
||||||
|
|
||||||
|
const classMember = new ClassMember(str, 'method');
|
||||||
|
expect(classMember.getDisplayDetails().displayText).toBe('getTimes(List<T>, List<OT>)');
|
||||||
|
expect(classMember.getDisplayDetails().cssStyle).toBe(staticCssStyle);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return correct css for abstract classifier', function () {
|
||||||
|
const str = `getTimes(List~T~, List~OT~)*`;
|
||||||
|
|
||||||
|
const classMember = new ClassMember(str, 'method');
|
||||||
|
expect(classMember.getDisplayDetails().displayText).toBe('getTimes(List<T>, List<OT>)');
|
||||||
|
expect(classMember.getDisplayDetails().cssStyle).toBe(abstractCssStyle);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('when method parameter is a nested generic', function () {
|
||||||
|
it('should parse correctly', function () {
|
||||||
|
const str = `getTimetableList(List~List~T~~)`;
|
||||||
|
|
||||||
|
const classMember = new ClassMember(str, 'method');
|
||||||
|
expect(classMember.getDisplayDetails().displayText).toBe('getTimetableList(List<List<T>>)');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should handle public visibility', function () {
|
||||||
|
const str = `+getTimetableList(List~List~T~~)`;
|
||||||
|
|
||||||
|
const classMember = new ClassMember(str, 'method');
|
||||||
|
expect(classMember.getDisplayDetails().displayText).toBe('+getTimetableList(List<List<T>>)');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should handle private visibility', function () {
|
||||||
|
const str = `-getTimetableList(List~List~T~~)`;
|
||||||
|
|
||||||
|
const classMember = new ClassMember(str, 'method');
|
||||||
|
expect(classMember.getDisplayDetails().displayText).toBe('-getTimetableList(List<List<T>>)');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should handle protected visibility', function () {
|
||||||
|
const str = `#getTimetableList(List~List~T~~)`;
|
||||||
|
|
||||||
|
const classMember = new ClassMember(str, 'method');
|
||||||
|
expect(classMember.getDisplayDetails().displayText).toBe('#getTimetableList(List<List<T>>)');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should handle internal visibility', function () {
|
||||||
|
const str = `~getTimetableList(List~List~T~~)`;
|
||||||
|
|
||||||
|
const classMember = new ClassMember(str, 'method');
|
||||||
|
expect(classMember.getDisplayDetails().displayText).toBe('~getTimetableList(List<List<T>>)');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return correct css for static classifier', function () {
|
||||||
|
const str = `getTimetableList(List~List~T~~)$`;
|
||||||
|
|
||||||
|
const classMember = new ClassMember(str, 'method');
|
||||||
|
expect(classMember.getDisplayDetails().displayText).toBe('getTimetableList(List<List<T>>)');
|
||||||
|
expect(classMember.getDisplayDetails().cssStyle).toBe(staticCssStyle);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return correct css for abstract classifier', function () {
|
||||||
|
const str = `getTimetableList(List~List~T~~)*`;
|
||||||
|
|
||||||
|
const classMember = new ClassMember(str, 'method');
|
||||||
|
expect(classMember.getDisplayDetails().displayText).toBe('getTimetableList(List<List<T>>)');
|
||||||
|
expect(classMember.getDisplayDetails().cssStyle).toBe(abstractCssStyle);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('when method parameter is a composite generic', function () {
|
||||||
|
const methodNameAndParameters = 'getTimes(List~K, V~)';
|
||||||
|
const expectedMethodNameAndParameters = 'getTimes(List<K, V>)';
|
||||||
|
it('should parse correctly', function () {
|
||||||
|
const str = methodNameAndParameters;
|
||||||
|
|
||||||
|
const classMember = new ClassMember(str, 'method');
|
||||||
|
expect(classMember.getDisplayDetails().displayText).toBe(expectedMethodNameAndParameters);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should handle public visibility', function () {
|
||||||
|
const str = '+' + methodNameAndParameters;
|
||||||
|
|
||||||
|
const classMember = new ClassMember(str, 'method');
|
||||||
|
expect(classMember.getDisplayDetails().displayText).toBe(
|
||||||
|
'+' + expectedMethodNameAndParameters
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should handle private visibility', function () {
|
||||||
|
const str = '-' + methodNameAndParameters;
|
||||||
|
const classMember = new ClassMember(str, 'method');
|
||||||
|
expect(classMember.getDisplayDetails().displayText).toBe(
|
||||||
|
'-' + expectedMethodNameAndParameters
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should handle protected visibility', function () {
|
||||||
|
const str = '#' + methodNameAndParameters;
|
||||||
|
const classMember = new ClassMember(str, 'method');
|
||||||
|
expect(classMember.getDisplayDetails().displayText).toBe(
|
||||||
|
'#' + expectedMethodNameAndParameters
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should handle internal visibility', function () {
|
||||||
|
const str = '~' + methodNameAndParameters;
|
||||||
|
|
||||||
|
const classMember = new ClassMember(str, 'method');
|
||||||
|
expect(classMember.getDisplayDetails().displayText).toBe(
|
||||||
|
'~' + expectedMethodNameAndParameters
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return correct css for static classifier', function () {
|
||||||
|
const str = methodNameAndParameters + '$';
|
||||||
|
const classMember = new ClassMember(str, 'method');
|
||||||
|
expect(classMember.getDisplayDetails().displayText).toBe(expectedMethodNameAndParameters);
|
||||||
|
expect(classMember.getDisplayDetails().cssStyle).toBe(staticCssStyle);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return correct css for abstract classifier', function () {
|
||||||
|
const str = methodNameAndParameters + '*';
|
||||||
|
const classMember = new ClassMember(str, 'method');
|
||||||
|
expect(classMember.getDisplayDetails().displayText).toBe(expectedMethodNameAndParameters);
|
||||||
|
expect(classMember.getDisplayDetails().cssStyle).toBe(abstractCssStyle);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('when method return type is generic', function () {
|
||||||
|
it('should parse correctly', function () {
|
||||||
|
const str = `getTimes() List~T~`;
|
||||||
|
|
||||||
|
const classMember = new ClassMember(str, 'method');
|
||||||
|
expect(classMember.getDisplayDetails().displayText).toBe('getTimes() : List<T>');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should handle public visibility', function () {
|
||||||
|
const str = `+getTimes() List~T~`;
|
||||||
|
|
||||||
|
const classMember = new ClassMember(str, 'method');
|
||||||
|
expect(classMember.getDisplayDetails().displayText).toBe('+getTimes() : List<T>');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should handle private visibility', function () {
|
||||||
|
const str = `-getTimes() List~T~`;
|
||||||
|
|
||||||
|
const classMember = new ClassMember(str, 'method');
|
||||||
|
expect(classMember.getDisplayDetails().displayText).toBe('-getTimes() : List<T>');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should handle protected visibility', function () {
|
||||||
|
const str = `#getTimes() List~T~`;
|
||||||
|
|
||||||
|
const classMember = new ClassMember(str, 'method');
|
||||||
|
expect(classMember.getDisplayDetails().displayText).toBe('#getTimes() : List<T>');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should handle internal visibility', function () {
|
||||||
|
const str = `~getTimes() List~T~`;
|
||||||
|
|
||||||
|
const classMember = new ClassMember(str, 'method');
|
||||||
|
expect(classMember.getDisplayDetails().displayText).toBe('~getTimes() : List<T>');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return correct css for static classifier', function () {
|
||||||
|
const str = `getTimes() List~T~$`;
|
||||||
|
|
||||||
|
const classMember = new ClassMember(str, 'method');
|
||||||
|
expect(classMember.getDisplayDetails().displayText).toBe('getTimes() : List<T>');
|
||||||
|
expect(classMember.getDisplayDetails().cssStyle).toBe(staticCssStyle);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return correct css for abstract classifier', function () {
|
||||||
|
const str = `getTimes() List~T~*`;
|
||||||
|
|
||||||
|
const classMember = new ClassMember(str, 'method');
|
||||||
|
expect(classMember.getDisplayDetails().displayText).toBe('getTimes() : List<T>');
|
||||||
|
expect(classMember.getDisplayDetails().cssStyle).toBe(abstractCssStyle);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('when method return type is a nested generic', function () {
|
||||||
|
it('should parse correctly', function () {
|
||||||
|
const str = `getTimetableList() List~List~T~~`;
|
||||||
|
|
||||||
|
const classMember = new ClassMember(str, 'method');
|
||||||
|
expect(classMember.getDisplayDetails().displayText).toBe(
|
||||||
|
'getTimetableList() : List<List<T>>'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should handle public visibility', function () {
|
||||||
|
const str = `+getTimetableList() List~List~T~~`;
|
||||||
|
|
||||||
|
const classMember = new ClassMember(str, 'method');
|
||||||
|
expect(classMember.getDisplayDetails().displayText).toBe(
|
||||||
|
'+getTimetableList() : List<List<T>>'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should handle private visibility', function () {
|
||||||
|
const str = `-getTimetableList() List~List~T~~`;
|
||||||
|
|
||||||
|
const classMember = new ClassMember(str, 'method');
|
||||||
|
expect(classMember.getDisplayDetails().displayText).toBe(
|
||||||
|
'-getTimetableList() : List<List<T>>'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should handle protected visibility', function () {
|
||||||
|
const str = `#getTimetableList() List~List~T~~`;
|
||||||
|
|
||||||
|
const classMember = new ClassMember(str, 'method');
|
||||||
|
expect(classMember.getDisplayDetails().displayText).toBe(
|
||||||
|
'#getTimetableList() : List<List<T>>'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should handle internal visibility', function () {
|
||||||
|
const str = `~getTimetableList() List~List~T~~`;
|
||||||
|
|
||||||
|
const classMember = new ClassMember(str, 'method');
|
||||||
|
expect(classMember.getDisplayDetails().displayText).toBe(
|
||||||
|
'~getTimetableList() : List<List<T>>'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return correct css for static classifier', function () {
|
||||||
|
const str = `getTimetableList() List~List~T~~$`;
|
||||||
|
|
||||||
|
const classMember = new ClassMember(str, 'method');
|
||||||
|
expect(classMember.getDisplayDetails().displayText).toBe(
|
||||||
|
'getTimetableList() : List<List<T>>'
|
||||||
|
);
|
||||||
|
expect(classMember.getDisplayDetails().cssStyle).toBe(staticCssStyle);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return correct css for abstract classifier', function () {
|
||||||
|
const str = `getTimetableList() List~List~T~~*`;
|
||||||
|
|
||||||
|
const classMember = new ClassMember(str, 'method');
|
||||||
|
expect(classMember.getDisplayDetails().displayText).toBe(
|
||||||
|
'getTimetableList() : List<List<T>>'
|
||||||
|
);
|
||||||
|
expect(classMember.getDisplayDetails().cssStyle).toBe(abstractCssStyle);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
describe('--uncategorized tests--', function () {
|
describe('--uncategorized tests--', function () {
|
||||||
it('member name should handle double colons', function () {
|
it('member name should handle double colons', function () {
|
||||||
const str = `std::map ~int,string~ pMap;`;
|
const str = `std::map ~int,string~ pMap;`;
|
||||||
@@ -25,82 +680,83 @@ describe('given text representing a method, ', function () {
|
|||||||
expect(classMember.getDisplayDetails().cssStyle).toBe(staticCssStyle);
|
expect(classMember.getDisplayDetails().cssStyle).toBe(staticCssStyle);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
|
||||||
describe('Edge Cases and Additional Scenarios', () => {
|
describe('given text representing an attribute', () => {
|
||||||
it('should handle method with special characters in name', function () {
|
describe('when the attribute has no modifiers', () => {
|
||||||
const str = `operator++(int value)`;
|
it('should parse the display text correctly', () => {
|
||||||
const classMember = new ClassMember(str, 'method');
|
const str = 'name String';
|
||||||
expect(classMember.getDisplayDetails().displayText).toBe('operator++(int value)');
|
|
||||||
expect(classMember.id).toBe('operator++');
|
const displayDetails = new ClassMember(str, 'attribute').getDisplayDetails();
|
||||||
|
|
||||||
|
expect(displayDetails.displayText).toBe('name String');
|
||||||
|
expect(displayDetails.cssStyle).toBe('');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should handle method with numbers in name', function () {
|
describe('when the attribute has public "+" modifier', () => {
|
||||||
const str = `method123(param)`;
|
it('should parse the display text correctly', () => {
|
||||||
const classMember = new ClassMember(str, 'method');
|
const str = '+name String';
|
||||||
expect(classMember.getDisplayDetails().displayText).toBe('method123(param)');
|
|
||||||
expect(classMember.id).toBe('method123');
|
const displayDetails = new ClassMember(str, 'attribute').getDisplayDetails();
|
||||||
|
|
||||||
|
expect(displayDetails.displayText).toBe('+name String');
|
||||||
|
expect(displayDetails.cssStyle).toBe('');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should handle method with underscores and hyphens', function () {
|
describe('when the attribute has protected "#" modifier', () => {
|
||||||
const str = `get_user_data(user_id int)`;
|
it('should parse the display text correctly', () => {
|
||||||
const classMember = new ClassMember(str, 'method');
|
const str = '#name String';
|
||||||
expect(classMember.getDisplayDetails().displayText).toBe('get_user_data(user_id int)');
|
|
||||||
expect(classMember.id).toBe('get_user_data');
|
const displayDetails = new ClassMember(str, 'attribute').getDisplayDetails();
|
||||||
|
|
||||||
|
expect(displayDetails.displayText).toBe('#name String');
|
||||||
|
expect(displayDetails.cssStyle).toBe('');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should handle method with no spaces around parentheses', function () {
|
describe('when the attribute has private "-" modifier', () => {
|
||||||
const str = `method(param)`;
|
it('should parse the display text correctly', () => {
|
||||||
const classMember = new ClassMember(str, 'method');
|
const str = '-name String';
|
||||||
expect(classMember.getDisplayDetails().displayText).toBe('method(param)');
|
|
||||||
|
const displayDetails = new ClassMember(str, 'attribute').getDisplayDetails();
|
||||||
|
|
||||||
|
expect(displayDetails.displayText).toBe('-name String');
|
||||||
|
expect(displayDetails.cssStyle).toBe('');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should handle method with array parameters', function () {
|
describe('when the attribute has internal "~" modifier', () => {
|
||||||
const str = `processArray(int[] numbers)`;
|
it('should parse the display text correctly', () => {
|
||||||
const classMember = new ClassMember(str, 'method');
|
const str = '~name String';
|
||||||
expect(classMember.getDisplayDetails().displayText).toBe('processArray(int[] numbers)');
|
|
||||||
|
const displayDetails = new ClassMember(str, 'attribute').getDisplayDetails();
|
||||||
|
|
||||||
|
expect(displayDetails.displayText).toBe('~name String');
|
||||||
|
expect(displayDetails.cssStyle).toBe('');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should handle method with function pointer parameter', function () {
|
describe('when the attribute has static "$" modifier', () => {
|
||||||
const str = `callback(void (*fn)(int))`;
|
it('should parse the display text correctly and apply static css style', () => {
|
||||||
const classMember = new ClassMember(str, 'method');
|
const str = 'name String$';
|
||||||
expect(classMember.getDisplayDetails().displayText).toBe('callback(void (*fn)(int))');
|
|
||||||
|
const displayDetails = new ClassMember(str, 'attribute').getDisplayDetails();
|
||||||
|
|
||||||
|
expect(displayDetails.displayText).toBe('name String');
|
||||||
|
expect(displayDetails.cssStyle).toBe(staticCssStyle);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should handle method with complex nested generics (HTML encoded)', function () {
|
describe('when the attribute has abstract "*" modifier', () => {
|
||||||
const str = `process(Map<String, List<Map<Integer, String>>> data)`;
|
it('should parse the display text correctly and apply abstract css style', () => {
|
||||||
const classMember = new ClassMember(str, 'method');
|
const str = 'name String*';
|
||||||
// Current behavior: parseGenericTypes converts < > to HTML entities
|
|
||||||
expect(classMember.getDisplayDetails().displayText).toBe('process(Map>> data)');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should handle method with colon in return type', function () {
|
const displayDetails = new ClassMember(str, 'attribute').getDisplayDetails();
|
||||||
const str = `getNamespace() std::string`;
|
|
||||||
const classMember = new ClassMember(str, 'method');
|
|
||||||
expect(classMember.getDisplayDetails().displayText).toBe('getNamespace() : std::string');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should handle malformed input gracefully - no parentheses', function () {
|
expect(displayDetails.displayText).toBe('name String');
|
||||||
const str = `not_a_method_missing_parentheses`;
|
expect(displayDetails.cssStyle).toBe(abstractCssStyle);
|
||||||
const classMember = new ClassMember(str, 'method');
|
|
||||||
// This will not match the method regex, so should handle gracefully
|
|
||||||
// But currently throws when parseGenericTypes gets undefined
|
|
||||||
expect(() => classMember.getDisplayDetails()).toThrow();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should handle empty parameter list with classifier', function () {
|
|
||||||
const str = `emptyMethod()$*`;
|
|
||||||
const classMember = new ClassMember(str, 'method');
|
|
||||||
expect(classMember.getDisplayDetails().displayText).toBe('emptyMethod()');
|
|
||||||
expect(classMember.getDisplayDetails().cssStyle).toBe(
|
|
||||||
'text-decoration:underline;font-style:italic;'
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should handle method with constructor-like name', function () {
|
|
||||||
const str = `Class()`;
|
|
||||||
const classMember = new ClassMember(str, 'method');
|
|
||||||
expect(classMember.getDisplayDetails().displayText).toBe('Class()');
|
|
||||||
expect(classMember.id).toBe('Class');
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ export interface ClassNode {
|
|||||||
id: string;
|
id: string;
|
||||||
type: string;
|
type: string;
|
||||||
label: string;
|
label: string;
|
||||||
shape: string;
|
shape: 'classBox';
|
||||||
text: string;
|
text: string;
|
||||||
cssClasses: string;
|
cssClasses: string;
|
||||||
methods: ClassMember[];
|
methods: ClassMember[];
|
||||||
@@ -81,42 +81,64 @@ export class ClassMember {
|
|||||||
let potentialClassifier = '';
|
let potentialClassifier = '';
|
||||||
|
|
||||||
if (this.memberType === 'method') {
|
if (this.memberType === 'method') {
|
||||||
const methodRegEx = /([#+~-])?(.+)\((.*)\)([$*]{0,2})(.*?)([$*]{0,2})$/;
|
const methodRegEx = /([#+~-])?(.+)\((.*)\)([\s$*])?(.*)([$*])?/;
|
||||||
const match = methodRegEx.exec(input);
|
const match = methodRegEx.exec(input);
|
||||||
if (match) {
|
if (match) {
|
||||||
this.visibility = (match[1] ? match[1].trim() : '') as Visibility;
|
const detectedVisibility = match[1] ? match[1].trim() : '';
|
||||||
this.id = match[2].trim();
|
|
||||||
|
if (visibilityValues.includes(detectedVisibility)) {
|
||||||
|
this.visibility = detectedVisibility as Visibility;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.id = match[2];
|
||||||
this.parameters = match[3] ? match[3].trim() : '';
|
this.parameters = match[3] ? match[3].trim() : '';
|
||||||
potentialClassifier = match[4] ? match[4].trim() : '';
|
potentialClassifier = match[4] ? match[4].trim() : '';
|
||||||
this.returnType = match[5] ? match[5].trim() : '';
|
this.returnType = match[5] ? match[5].trim() : '';
|
||||||
|
|
||||||
if (potentialClassifier === '') {
|
if (potentialClassifier === '') {
|
||||||
potentialClassifier = match[6] ? match[6].trim() : '';
|
const lastChar = this.returnType.substring(this.returnType.length - 1);
|
||||||
|
if (/[$*]/.exec(lastChar)) {
|
||||||
|
potentialClassifier = lastChar;
|
||||||
|
this.returnType = this.returnType.substring(0, this.returnType.length - 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
const fieldRegEx = /([#+~-])?(.*?)([$*]{0,2})$/;
|
const length = input.length;
|
||||||
const match = fieldRegEx.exec(input);
|
const firstChar = input.substring(0, 1);
|
||||||
|
const lastChar = input.substring(length - 1);
|
||||||
|
|
||||||
if (match) {
|
if (visibilityValues.includes(firstChar)) {
|
||||||
this.visibility = (match[1] ? match[1].trim() : '') as Visibility;
|
this.visibility = firstChar as Visibility;
|
||||||
this.id = match[2] ? match[2].trim() : '';
|
|
||||||
potentialClassifier = match[3] ? match[3].trim() : '';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (/[$*]/.exec(lastChar)) {
|
||||||
|
potentialClassifier = lastChar;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.id = input.substring(
|
||||||
|
this.visibility === '' ? 0 : 1,
|
||||||
|
potentialClassifier === '' ? length : length - 1
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.classifier = potentialClassifier;
|
this.classifier = potentialClassifier;
|
||||||
|
// Preserve one space only
|
||||||
|
this.id = this.id.startsWith(' ') ? ' ' + this.id.trim() : this.id.trim();
|
||||||
|
|
||||||
|
const combinedText = `${this.visibility ? '\\' + this.visibility : ''}${parseGenericTypes(this.id)}${this.memberType === 'method' ? `(${parseGenericTypes(this.parameters)})${this.returnType ? ' : ' + parseGenericTypes(this.returnType) : ''}` : ''}`;
|
||||||
|
this.text = combinedText.replaceAll('<', '<').replaceAll('>', '>');
|
||||||
|
if (this.text.startsWith('\\<')) {
|
||||||
|
this.text = this.text.replace('\\<', '~');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
parseClassifier() {
|
parseClassifier() {
|
||||||
switch (this.classifier) {
|
switch (this.classifier) {
|
||||||
case '$':
|
|
||||||
return 'text-decoration:underline;';
|
|
||||||
case '*':
|
case '*':
|
||||||
return 'font-style:italic;';
|
return 'font-style:italic;';
|
||||||
case '$*':
|
case '$':
|
||||||
case '*$':
|
return 'text-decoration:underline;';
|
||||||
return 'text-decoration:underline;font-style:italic;';
|
|
||||||
default:
|
default:
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
@@ -127,6 +149,8 @@ export interface ClassNote {
|
|||||||
id: string;
|
id: string;
|
||||||
class: string;
|
class: string;
|
||||||
text: string;
|
text: string;
|
||||||
|
index: number;
|
||||||
|
parent?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ClassRelation {
|
export interface ClassRelation {
|
||||||
@@ -155,6 +179,7 @@ export interface NamespaceNode {
|
|||||||
id: string;
|
id: string;
|
||||||
domId: string;
|
domId: string;
|
||||||
classes: ClassMap;
|
classes: ClassMap;
|
||||||
|
notes: ClassNoteMap;
|
||||||
children: NamespaceMap;
|
children: NamespaceMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -165,4 +190,5 @@ export interface StyleClass {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export type ClassMap = Map<string, ClassNode>;
|
export type ClassMap = Map<string, ClassNode>;
|
||||||
|
export type ClassNoteMap = Map<string, ClassNote>;
|
||||||
export type NamespaceMap = Map<string, NamespaceNode>;
|
export type NamespaceMap = Map<string, NamespaceNode>;
|
||||||
|
|||||||
@@ -275,8 +275,8 @@ statement
|
|||||||
;
|
;
|
||||||
|
|
||||||
namespaceStatement
|
namespaceStatement
|
||||||
: namespaceIdentifier STRUCT_START classStatements STRUCT_STOP { yy.addClassesToNamespace($1, $3); }
|
: namespaceIdentifier STRUCT_START classStatements STRUCT_STOP { yy.addClassesToNamespace($1, $3[0], $3[1]); }
|
||||||
| namespaceIdentifier STRUCT_START NEWLINE classStatements STRUCT_STOP { yy.addClassesToNamespace($1, $4); }
|
| namespaceIdentifier STRUCT_START NEWLINE classStatements STRUCT_STOP { yy.addClassesToNamespace($1, $4[0], $4[1]); }
|
||||||
;
|
;
|
||||||
|
|
||||||
namespaceIdentifier
|
namespaceIdentifier
|
||||||
@@ -284,9 +284,12 @@ namespaceIdentifier
|
|||||||
;
|
;
|
||||||
|
|
||||||
classStatements
|
classStatements
|
||||||
: classStatement {$$=[$1]}
|
: classStatement {$$=[[$1], []]}
|
||||||
| classStatement NEWLINE {$$=[$1]}
|
| classStatement NEWLINE {$$=[[$1], []]}
|
||||||
| classStatement NEWLINE classStatements {$3.unshift($1); $$=$3}
|
| classStatement NEWLINE classStatements {$3[0].unshift($1); $$=$3}
|
||||||
|
| noteStatement {$$=[[], [$1]]}
|
||||||
|
| noteStatement NEWLINE {$$=[[], [$1]]}
|
||||||
|
| noteStatement NEWLINE classStatements {$3[1].unshift($1); $$=$3}
|
||||||
;
|
;
|
||||||
|
|
||||||
classStatement
|
classStatement
|
||||||
@@ -333,8 +336,8 @@ relationStatement
|
|||||||
;
|
;
|
||||||
|
|
||||||
noteStatement
|
noteStatement
|
||||||
: NOTE_FOR className noteText { yy.addNote($3, $2); }
|
: NOTE_FOR className noteText { $$ = yy.addNote($3, $2); }
|
||||||
| NOTE noteText { yy.addNote($2); }
|
| NOTE noteText { $$ = yy.addNote($2); }
|
||||||
;
|
;
|
||||||
|
|
||||||
classDefStatement
|
classDefStatement
|
||||||
|
|||||||
@@ -333,7 +333,7 @@ const renderKatexUnsanitized = async (text: string, config: MermaidConfig): Prom
|
|||||||
return text.replace(katexRegex, 'MathML is unsupported in this environment.');
|
return text.replace(katexRegex, 'MathML is unsupported in this environment.');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (includeLargeFeatures) {
|
if (injected.includeLargeFeatures) {
|
||||||
const { default: katex } = await import('katex');
|
const { default: katex } = await import('katex');
|
||||||
const outputMode =
|
const outputMode =
|
||||||
config.forceLegacyMathML || (!isMathMLSupported() && config.legacyMathML)
|
config.forceLegacyMathML || (!isMathMLSupported() && config.legacyMathML)
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
import type { InfoFields, InfoDB } from './infoTypes.js';
|
import type { InfoFields, InfoDB } from './infoTypes.js';
|
||||||
import packageJson from '../../../package.json' assert { type: 'json' };
|
|
||||||
|
|
||||||
export const DEFAULT_INFO_DB: InfoFields = {
|
export const DEFAULT_INFO_DB: InfoFields = {
|
||||||
version: packageJson.version + (includeLargeFeatures ? '' : '-tiny'),
|
version: injected.version + (injected.includeLargeFeatures ? '' : '-tiny'),
|
||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
export const getVersion = (): string => DEFAULT_INFO_DB.version;
|
export const getVersion = (): string => DEFAULT_INFO_DB.version;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import type { MarkdownOptions } from 'vitepress';
|
import type { MarkdownOptions } from 'vitepress';
|
||||||
import { defineConfig } from 'vitepress';
|
import { defineConfig } from 'vitepress';
|
||||||
import packageJson from '../../../package.json' assert { type: 'json' };
|
import packageJson from '../../../package.json' with { type: 'json' };
|
||||||
import { addCanonicalUrls } from './canonical-urls.js';
|
import { addCanonicalUrls } from './canonical-urls.js';
|
||||||
import MermaidExample from './mermaid-markdown-all.js';
|
import MermaidExample from './mermaid-markdown-all.js';
|
||||||
|
|
||||||
|
|||||||
@@ -52,6 +52,8 @@ To add an integration to this list, see the [Integrations - create page](./integ
|
|||||||
- [GitHub Writer](https://github.com/ckeditor/github-writer)
|
- [GitHub Writer](https://github.com/ckeditor/github-writer)
|
||||||
- [SVG diagram generator](https://github.com/SimonKenyonShepard/mermaidjs-github-svg-generator)
|
- [SVG diagram generator](https://github.com/SimonKenyonShepard/mermaidjs-github-svg-generator)
|
||||||
- [GitLab](https://docs.gitlab.com/ee/user/markdown.html#diagrams-and-flowcharts) ✅
|
- [GitLab](https://docs.gitlab.com/ee/user/markdown.html#diagrams-and-flowcharts) ✅
|
||||||
|
- [GNU Octave](https://octave.org/) ✅
|
||||||
|
- [octave_mermaid_js](https://github.com/CNOCTAVE/octave_mermaid_js) ✅
|
||||||
- [Mermaid Plugin for JetBrains IDEs](https://plugins.jetbrains.com/plugin/20146-mermaid)
|
- [Mermaid Plugin for JetBrains IDEs](https://plugins.jetbrains.com/plugin/20146-mermaid)
|
||||||
- [MonsterWriter](https://www.monsterwriter.com/) ✅
|
- [MonsterWriter](https://www.monsterwriter.com/) ✅
|
||||||
- [Joplin](https://joplinapp.org) ✅
|
- [Joplin](https://joplinapp.org) ✅
|
||||||
@@ -267,6 +269,7 @@ Communication tools and platforms
|
|||||||
- [reveal.js-mermaid-plugin](https://github.com/ludwick/reveal.js-mermaid-plugin)
|
- [reveal.js-mermaid-plugin](https://github.com/ludwick/reveal.js-mermaid-plugin)
|
||||||
- [Reveal CK](https://github.com/jedcn/reveal-ck)
|
- [Reveal CK](https://github.com/jedcn/reveal-ck)
|
||||||
- [reveal-ck-mermaid-plugin](https://github.com/tmtm/reveal-ck-mermaid-plugin)
|
- [reveal-ck-mermaid-plugin](https://github.com/tmtm/reveal-ck-mermaid-plugin)
|
||||||
|
- [speccharts: Turn your test suites into specification diagrams](https://github.com/arnaudrenaud/speccharts)
|
||||||
- [Vitepress Plugin](https://github.com/sametcn99/vitepress-mermaid-renderer)
|
- [Vitepress Plugin](https://github.com/sametcn99/vitepress-mermaid-renderer)
|
||||||
|
|
||||||
<!--- cspell:ignore Blazorade HueHive --->
|
<!--- cspell:ignore Blazorade HueHive --->
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ Try the Ultimate AI, Mermaid, and Visual Diagramming Suite by creating an accoun
|
|||||||
|
|
||||||
## Plans
|
## Plans
|
||||||
|
|
||||||
- **Free** - A free plan that includes three diagrams.
|
- **Free** - A free plan that includes six diagrams.
|
||||||
|
|
||||||
- **Pro** - A paid plan that includes unlimited diagrams, access to the collaboration feature, and more.
|
- **Pro** - A paid plan that includes unlimited diagrams, access to the collaboration feature, and more.
|
||||||
|
|
||||||
|
|||||||
@@ -175,7 +175,6 @@ To describe the visibility (or encapsulation) of an attribute or method/function
|
|||||||
>
|
>
|
||||||
> - `*` Abstract e.g.: `someAbstractMethod()*` or `someAbstractMethod() int*`
|
> - `*` Abstract e.g.: `someAbstractMethod()*` or `someAbstractMethod() int*`
|
||||||
> - `$` Static e.g.: `someStaticMethod()$` or `someStaticMethod() String$`
|
> - `$` Static e.g.: `someStaticMethod()$` or `someStaticMethod() String$`
|
||||||
> - `$*` OR `*$` Both e.g: `someAbstractStaticMethod()$*` or `someAbstractStaticMethod() int$*`
|
|
||||||
|
|
||||||
> _note_ you can also include additional _classifiers_ to a field definition by adding the following notation to the very end:
|
> _note_ you can also include additional _classifiers_ to a field definition by adding the following notation to the very end:
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import { select } from 'd3';
|
|||||||
import { compile, serialize, stringify } from 'stylis';
|
import { compile, serialize, stringify } from 'stylis';
|
||||||
import DOMPurify from 'dompurify';
|
import DOMPurify from 'dompurify';
|
||||||
import isEmpty from 'lodash-es/isEmpty.js';
|
import isEmpty from 'lodash-es/isEmpty.js';
|
||||||
import packageJson from '../package.json' assert { type: 'json' };
|
|
||||||
import { addSVGa11yTitleDescription, setA11yDiagramInfo } from './accessibility.js';
|
import { addSVGa11yTitleDescription, setA11yDiagramInfo } from './accessibility.js';
|
||||||
import assignWithDepth from './assignWithDepth.js';
|
import assignWithDepth from './assignWithDepth.js';
|
||||||
import * as configApi from './config.js';
|
import * as configApi from './config.js';
|
||||||
@@ -421,12 +420,12 @@ const render = async function (
|
|||||||
// -------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------
|
||||||
// Draw the diagram with the renderer
|
// Draw the diagram with the renderer
|
||||||
try {
|
try {
|
||||||
await diag.renderer.draw(text, id, packageJson.version, diag);
|
await diag.renderer.draw(text, id, injected.version, diag);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (config.suppressErrorRendering) {
|
if (config.suppressErrorRendering) {
|
||||||
removeTempElements();
|
removeTempElements();
|
||||||
} else {
|
} else {
|
||||||
errorRenderer.draw(text, id, packageJson.version);
|
errorRenderer.draw(text, id, injected.version);
|
||||||
}
|
}
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ const registerDefaultLayoutLoaders = () => {
|
|||||||
name: 'dagre',
|
name: 'dagre',
|
||||||
loader: async () => await import('./layout-algorithms/dagre/index.js'),
|
loader: async () => await import('./layout-algorithms/dagre/index.js'),
|
||||||
},
|
},
|
||||||
...(includeLargeFeatures
|
...(injected.includeLargeFeatures
|
||||||
? [
|
? [
|
||||||
{
|
{
|
||||||
name: 'cose-bilkent',
|
name: 'cose-bilkent',
|
||||||
|
|||||||
5
packages/mermaid/src/type.d.ts
vendored
5
packages/mermaid/src/type.d.ts
vendored
@@ -1,2 +1,5 @@
|
|||||||
// eslint-disable-next-line no-var
|
// eslint-disable-next-line no-var
|
||||||
declare var includeLargeFeatures: boolean;
|
declare var injected: {
|
||||||
|
version: string;
|
||||||
|
includeLargeFeatures: boolean;
|
||||||
|
};
|
||||||
|
|||||||
@@ -1,5 +1,15 @@
|
|||||||
# @mermaid-js/parser
|
# @mermaid-js/parser
|
||||||
|
|
||||||
|
## 0.6.3
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- [#7051](https://github.com/mermaid-js/mermaid/pull/7051) [`63df702`](https://github.com/mermaid-js/mermaid/commit/63df7021462e8dc1f2aaecb9c5febbbbde4c38e3) Thanks [@shubhamparikh2704](https://github.com/shubhamparikh2704)! - Add validation for negative values in pie charts:
|
||||||
|
|
||||||
|
Prevents crashes during parsing by validating values post-parsing.
|
||||||
|
|
||||||
|
Provides clearer, user-friendly error messages for invalid negative inputs.
|
||||||
|
|
||||||
## 0.6.2
|
## 0.6.2
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@mermaid-js/parser",
|
"name": "@mermaid-js/parser",
|
||||||
"version": "0.6.2",
|
"version": "0.6.3",
|
||||||
"description": "MermaidJS parser",
|
"description": "MermaidJS parser",
|
||||||
"author": "Yokozuna59",
|
"author": "Yokozuna59",
|
||||||
"contributors": [
|
"contributors": [
|
||||||
|
|||||||
@@ -1,5 +1,30 @@
|
|||||||
# mermaid
|
# mermaid
|
||||||
|
|
||||||
|
## 11.12.1
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- [#7107](https://github.com/mermaid-js/mermaid/pull/7107) [`cbf8946`](https://github.com/mermaid-js/mermaid/commit/cbf89462acecac7a06f19843e8d48cb137df0753) Thanks [@shubhamparikh2704](https://github.com/shubhamparikh2704)! - fix: Updated the dependency dagre-d3-es to 7.0.13 to fix GHSA-cc8p-78qf-8p7q
|
||||||
|
|
||||||
|
## 11.12.0
|
||||||
|
|
||||||
|
### Minor Changes
|
||||||
|
|
||||||
|
- [#6921](https://github.com/mermaid-js/mermaid/pull/6921) [`764b315`](https://github.com/mermaid-js/mermaid/commit/764b315dc16d0359add7c6b8e3ef7592e9bdc09c) Thanks [@quilicicf](https://github.com/quilicicf)! - feat: Add IDs in architecture diagrams
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- [#6950](https://github.com/mermaid-js/mermaid/pull/6950) [`a957908`](https://github.com/mermaid-js/mermaid/commit/a9579083bfba367a4f4678547ec37ed7b61b9f5b) Thanks [@shubhamparikh2704](https://github.com/shubhamparikh2704)! - chore: Fix mindmap rendering in docs and apply tidytree layout
|
||||||
|
|
||||||
|
- [#6826](https://github.com/mermaid-js/mermaid/pull/6826) [`1d36810`](https://github.com/mermaid-js/mermaid/commit/1d3681053b9168354e48e5763023b6305cd1ca72) Thanks [@darshanr0107](https://github.com/darshanr0107)! - fix: Ensure edge label color is applied when using classDef with edge IDs
|
||||||
|
|
||||||
|
- [#6945](https://github.com/mermaid-js/mermaid/pull/6945) [`d318f1a`](https://github.com/mermaid-js/mermaid/commit/d318f1a13cd7429334a29c70e449074ec1cb9f68) Thanks [@darshanr0107](https://github.com/darshanr0107)! - fix: Resolve gantt chart crash due to invalid array length
|
||||||
|
|
||||||
|
- [#6918](https://github.com/mermaid-js/mermaid/pull/6918) [`cfe9238`](https://github.com/mermaid-js/mermaid/commit/cfe9238882cbe95416db1feea3112456a71b6aaf) Thanks [@shubhamparikh2704](https://github.com/shubhamparikh2704)! - chore: revert marked dependency from ^15.0.7 to ^16.0.0
|
||||||
|
- Reverted marked package version to ^16.0.0 for better compatibility
|
||||||
|
- This is a dependency update that maintains API compatibility
|
||||||
|
- All tests pass with the updated version
|
||||||
|
|
||||||
## 11.11.0
|
## 11.11.0
|
||||||
|
|
||||||
### Minor Changes
|
### Minor Changes
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@mermaid-js/tiny",
|
"name": "@mermaid-js/tiny",
|
||||||
"version": "11.11.0",
|
"version": "11.12.1",
|
||||||
"description": "Tiny version of mermaid",
|
"description": "Tiny version of mermaid",
|
||||||
"type": "commonjs",
|
"type": "commonjs",
|
||||||
"main": "./dist/mermaid.tiny.js",
|
"main": "./dist/mermaid.tiny.js",
|
||||||
|
|||||||
10
pnpm-lock.yaml
generated
10
pnpm-lock.yaml
generated
@@ -251,8 +251,8 @@ importers:
|
|||||||
specifier: ^0.12.3
|
specifier: ^0.12.3
|
||||||
version: 0.12.3
|
version: 0.12.3
|
||||||
dagre-d3-es:
|
dagre-d3-es:
|
||||||
specifier: 7.0.11
|
specifier: 7.0.13
|
||||||
version: 7.0.11
|
version: 7.0.13
|
||||||
dayjs:
|
dayjs:
|
||||||
specifier: ^1.11.18
|
specifier: ^1.11.18
|
||||||
version: 1.11.18
|
version: 1.11.18
|
||||||
@@ -4900,8 +4900,8 @@ packages:
|
|||||||
resolution: {integrity: sha512-e1U46jVP+w7Iut8Jt8ri1YsPOvFpg46k+K8TpCb0P+zjCkjkPnV7WzfDJzMHy1LnA+wj5pLT1wjO901gLXeEhA==}
|
resolution: {integrity: sha512-e1U46jVP+w7Iut8Jt8ri1YsPOvFpg46k+K8TpCb0P+zjCkjkPnV7WzfDJzMHy1LnA+wj5pLT1wjO901gLXeEhA==}
|
||||||
engines: {node: '>=12'}
|
engines: {node: '>=12'}
|
||||||
|
|
||||||
dagre-d3-es@7.0.11:
|
dagre-d3-es@7.0.13:
|
||||||
resolution: {integrity: sha512-tvlJLyQf834SylNKax8Wkzco/1ias1OPw8DcUMDE7oUIoSEW25riQVuiu/0OWEFqT0cxHT3Pa9/D82Jr47IONw==}
|
resolution: {integrity: sha512-efEhnxpSuwpYOKRm/L5KbqoZmNNukHa/Flty4Wp62JRvgH2ojwVgPgdYyr4twpieZnyRDdIH7PY2mopX26+j2Q==}
|
||||||
|
|
||||||
dashdash@1.14.1:
|
dashdash@1.14.1:
|
||||||
resolution: {integrity: sha512-jRFi8UDGo6j+odZiEpjazZaWqEal3w/basFjQHQEwVtZJGDpxbH1MeYluwCS8Xq5wmLJooDlMgvVarmWfGM44g==}
|
resolution: {integrity: sha512-jRFi8UDGo6j+odZiEpjazZaWqEal3w/basFjQHQEwVtZJGDpxbH1MeYluwCS8Xq5wmLJooDlMgvVarmWfGM44g==}
|
||||||
@@ -15161,7 +15161,7 @@ snapshots:
|
|||||||
d3-transition: 3.0.1(d3-selection@3.0.0)
|
d3-transition: 3.0.1(d3-selection@3.0.0)
|
||||||
d3-zoom: 3.0.0
|
d3-zoom: 3.0.0
|
||||||
|
|
||||||
dagre-d3-es@7.0.11:
|
dagre-d3-es@7.0.13:
|
||||||
dependencies:
|
dependencies:
|
||||||
d3: 7.9.0
|
d3: 7.9.0
|
||||||
lodash-es: 4.17.21
|
lodash-es: 4.17.21
|
||||||
|
|||||||
@@ -35,7 +35,8 @@ export default defineConfig({
|
|||||||
},
|
},
|
||||||
define: {
|
define: {
|
||||||
// Needs to be string
|
// Needs to be string
|
||||||
includeLargeFeatures: 'true',
|
'injected.includeLargeFeatures': 'true',
|
||||||
'import.meta.vitest': 'undefined',
|
'import.meta.vitest': 'undefined',
|
||||||
|
packageVersion: "'0.0.0'",
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user