mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-10-27 00:44:08 +01:00
Merge pull request #3075 from mermaid-js/3074_access
Separation between title and accessibility title (sometimes)
This commit is contained in:
@@ -30,7 +30,54 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="mermaid" style="width: 50%;">
|
<div class="mermaid2" style="width: 50%;">
|
||||||
|
journey
|
||||||
|
title Adding journey diagram functionality to mermaid
|
||||||
|
accTitle: Adding acc journey diagram functionality to mermaid
|
||||||
|
accDescr {
|
||||||
|
My multi-line description
|
||||||
|
of the diagram
|
||||||
|
}
|
||||||
|
section Order from website
|
||||||
|
</div>
|
||||||
|
<div class="mermaid2" style="width: 50%;">
|
||||||
|
pie
|
||||||
|
accTitle: My Pie Chart Accessibility Title
|
||||||
|
accDescr: My Pie Chart Accessibility Description
|
||||||
|
|
||||||
|
title Key elements in Product X
|
||||||
|
"Calcium" : 42.96
|
||||||
|
"Potassium" : 50.05
|
||||||
|
"Magnesium" : 10.01
|
||||||
|
"Iron" : 5
|
||||||
|
</div>
|
||||||
|
<div class="mermaid2" style="width: 50%;">
|
||||||
|
gitGraph
|
||||||
|
accTitle: My Gitgraph Accessibility Title
|
||||||
|
accDescr: My Gitgraph Accessibility Description
|
||||||
|
|
||||||
|
commit
|
||||||
|
commit
|
||||||
|
branch develop
|
||||||
|
checkout develop
|
||||||
|
commit
|
||||||
|
commit
|
||||||
|
checkout main
|
||||||
|
merge develop
|
||||||
|
commit
|
||||||
|
commit
|
||||||
|
</div>
|
||||||
|
<div class="mermaid" style="width: 50%;">
|
||||||
|
sequenceDiagram
|
||||||
|
title: My Sequence Diagram Title
|
||||||
|
accTitle: My Acc Sequence Diagram
|
||||||
|
accDescr: My Sequence Diagram Description
|
||||||
|
|
||||||
|
Alice->>John: Hello John, how are you?
|
||||||
|
John-->>Alice: Great!
|
||||||
|
Alice-)John: See you later!
|
||||||
|
</div>
|
||||||
|
<div class="mermaid2" style="width: 50%;">
|
||||||
graph TD
|
graph TD
|
||||||
A -->|000| B
|
A -->|000| B
|
||||||
B -->|111| C
|
B -->|111| C
|
||||||
@@ -38,18 +85,23 @@ graph TD
|
|||||||
linkStyle 1 stroke:#ff3,stroke-width:4px,color:red;
|
linkStyle 1 stroke:#ff3,stroke-width:4px,color:red;
|
||||||
</div>
|
</div>
|
||||||
<div class="mermaid2" style="width: 100%;">
|
<div class="mermaid2" style="width: 100%;">
|
||||||
journey
|
journey
|
||||||
title My working day
|
accTitle: My User Journey Diagram
|
||||||
section Go to work
|
accDescr: My User Journey Diagram Description
|
||||||
Make tea: 5: Me
|
|
||||||
Go upstairs: 3: Me
|
title My working day
|
||||||
Do work: 1: Me, Cat
|
section Go to work
|
||||||
section Go home
|
Make tea: 5: Me
|
||||||
Go downstairs: 5: Me
|
Go upstairs: 3: Me
|
||||||
Sit down: 5: Me
|
Do work: 1: Me, Cat
|
||||||
|
section Go home
|
||||||
|
Go downstairs: 5: Me
|
||||||
|
Sit down: 5: Me
|
||||||
</div>
|
</div>
|
||||||
<div class="mermaid2" style="width: 100%;">
|
<div class="mermaid2" style="width: 100%;">
|
||||||
requirementDiagram
|
requirementDiagram
|
||||||
|
accTitle: My req Diagram
|
||||||
|
accDescr: My req Diagram Description
|
||||||
|
|
||||||
requirement test_req {
|
requirement test_req {
|
||||||
id: 1
|
id: 1
|
||||||
@@ -89,6 +141,8 @@ requirementDiagram
|
|||||||
</div>
|
</div>
|
||||||
<div class="mermaid2" style="width: 100%;">
|
<div class="mermaid2" style="width: 100%;">
|
||||||
erDiagram
|
erDiagram
|
||||||
|
accTitle: My er Diagram
|
||||||
|
accDescr: My er Diagram Description
|
||||||
CUSTOMER }|..|{ DELIVERY-ADDRESS : has
|
CUSTOMER }|..|{ DELIVERY-ADDRESS : has
|
||||||
CUSTOMER ||--o{ ORDER : places
|
CUSTOMER ||--o{ ORDER : places
|
||||||
CUSTOMER ||--o{ INVOICE : "liable for"
|
CUSTOMER ||--o{ INVOICE : "liable for"
|
||||||
@@ -100,12 +154,16 @@ requirementDiagram
|
|||||||
</div>
|
</div>
|
||||||
<div class="mermaid2" style="width: 100%;">
|
<div class="mermaid2" style="width: 100%;">
|
||||||
graph TB
|
graph TB
|
||||||
|
accTitle: My flowchart
|
||||||
|
accDescr: My flowchart Description
|
||||||
subgraph One
|
subgraph One
|
||||||
a1-->a2-->a3
|
a1-->a2-->a3
|
||||||
end
|
end
|
||||||
</div>
|
</div>
|
||||||
<div class="mermaid2" style="width: 100%;">
|
<div class="mermaid2" style="width: 100%;">
|
||||||
gantt
|
gantt
|
||||||
|
accTitle: My gantt chart
|
||||||
|
accDescr: My my gantt chart Description
|
||||||
dateFormat YYYY-MM-DD
|
dateFormat YYYY-MM-DD
|
||||||
axisFormat %d/%m
|
axisFormat %d/%m
|
||||||
title Adding GANTT diagram to mermaid
|
title Adding GANTT diagram to mermaid
|
||||||
@@ -146,6 +204,8 @@ requirementDiagram
|
|||||||
</div>
|
</div>
|
||||||
<div class="mermaid2" style="width: 100%;">
|
<div class="mermaid2" style="width: 100%;">
|
||||||
classDiagram
|
classDiagram
|
||||||
|
accTitle: My class diagram
|
||||||
|
accDescr: My class diagram Description
|
||||||
Class01 <|-- AveryLongClass : Cool
|
Class01 <|-- AveryLongClass : Cool
|
||||||
Class09 --> C2 : Where am i?
|
Class09 --> C2 : Where am i?
|
||||||
Class09 --* C3
|
Class09 --* C3
|
||||||
@@ -162,6 +222,8 @@ class Class10 {
|
|||||||
</div>
|
</div>
|
||||||
<div class="mermaid2" style="width: 100%;">
|
<div class="mermaid2" style="width: 100%;">
|
||||||
stateDiagram
|
stateDiagram
|
||||||
|
accTitle: Apa
|
||||||
|
accDescr: One that can climb better then any man
|
||||||
[*] --> S1
|
[*] --> S1
|
||||||
state "Some long name" as S1
|
state "Some long name" as S1
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -9,9 +9,9 @@ This is the API to be used when optionally handling the integration with the web
|
|||||||
using the default integration provided by mermaid.js.
|
using the default integration provided by mermaid.js.
|
||||||
|
|
||||||
The core of this api is the [**render**][2] function which, given a graph
|
The core of this api is the [**render**][2] function which, given a graph
|
||||||
definition as text, renders the graph/diagram and returns an SVG element for the graph.
|
definition as text, renders the graph/diagram and returns an svg element for the graph.
|
||||||
|
|
||||||
It is is then up to the user of the API to make use of the SVG, either insert it somewhere in the
|
It is is then up to the user of the API to make use of the svg, either insert it somewhere in the
|
||||||
page or do something completely different.
|
page or do something completely different.
|
||||||
|
|
||||||
In addition to the render function, a number of behavioral configuration options are available.
|
In addition to the render function, a number of behavioral configuration options are available.
|
||||||
@@ -1012,7 +1012,7 @@ Pushes in a directive to the configuration
|
|||||||
|
|
||||||
## render
|
## render
|
||||||
|
|
||||||
Function that renders an SVG with a graph from a chart definition. Usage example below.
|
Function that renders an svg with a graph from a chart definition. Usage example below.
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
mermaidAPI.initialize({
|
mermaidAPI.initialize({
|
||||||
@@ -1031,7 +1031,7 @@ $(function () {
|
|||||||
|
|
||||||
- `id` **any** The id of the element to be rendered
|
- `id` **any** The id of the element to be rendered
|
||||||
- `_txt` **any** The graph definition
|
- `_txt` **any** The graph definition
|
||||||
- `cb` **any** Callback which is called after rendering is finished with the SVG code as inparam.
|
- `cb` **any** Callback which is called after rendering is finished with the svg code as inparam.
|
||||||
- `container` **any** Selector to element in which a div with the graph temporarily will be
|
- `container` **any** Selector to element in which a div with the graph temporarily will be
|
||||||
inserted. In one is provided a hidden div will be inserted in the body of the page instead. The
|
inserted. In one is provided a hidden div will be inserted in the body of the page instead. The
|
||||||
element will be removed when rendering is completed.
|
element will be removed when rendering is completed.
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* This method will add a basic title and description element to a chart. The yy parser will need to
|
* This method will add a basic title and description element to a chart. The yy parser will need to
|
||||||
* respond to getTitle and getAccDescription, where the title is the title element on the chart,
|
* respond to getAccTitle and getAccDescription, where the title is the title element on the chart,
|
||||||
* which is generally not displayed and the accDescription is the description element on the chart,
|
* which is generally not displayed and the accDescription is the description element on the chart,
|
||||||
* which is never displayed.
|
* which is never displayed.
|
||||||
*
|
*
|
||||||
@@ -15,7 +15,7 @@ export default function addSVGAccessibilityFields(yy_parser, svg, id) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let title_string = yy_parser.getTitle();
|
let title_string = yy_parser.getAccTitle();
|
||||||
let description = yy_parser.getAccDescription();
|
let description = yy_parser.getAccDescription();
|
||||||
svg.attr('role', 'img').attr('aria-labelledby', 'chart-title-' + id + ' chart-desc-' + id);
|
svg.attr('role', 'img').attr('aria-labelledby', 'chart-title-' + id + ' chart-desc-' + id);
|
||||||
svg
|
svg
|
||||||
|
|||||||
@@ -1,20 +1,22 @@
|
|||||||
import { sanitizeText as _sanitizeText } from './diagrams/common/common';
|
import { sanitizeText as _sanitizeText } from './diagrams/common/common';
|
||||||
import { getConfig } from './config';
|
import { getConfig } from './config';
|
||||||
let title = '';
|
let title = '';
|
||||||
|
let diagramTitle = '';
|
||||||
let description = '';
|
let description = '';
|
||||||
const sanitizeText = (txt) => _sanitizeText(txt, getConfig());
|
const sanitizeText = (txt) => _sanitizeText(txt, getConfig());
|
||||||
|
|
||||||
export const clear = function () {
|
export const clear = function () {
|
||||||
title = '';
|
title = '';
|
||||||
description = '';
|
description = '';
|
||||||
|
diagramTitle = '';
|
||||||
};
|
};
|
||||||
|
|
||||||
export const setAccTitle = function (txt) {
|
export const setAccTitle = function (txt) {
|
||||||
title = sanitizeText(txt).replace(/^\s+/g, '');
|
title = sanitizeText(txt).replace(/^\s+/g, '');
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getTitle = function () {
|
export const getAccTitle = function () {
|
||||||
return title;
|
return title || diagramTitle;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const setAccDescription = function (txt) {
|
export const setAccDescription = function (txt) {
|
||||||
@@ -25,9 +27,19 @@ export const getAccDescription = function () {
|
|||||||
return description;
|
return description;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const setDiagramTitle = function (txt) {
|
||||||
|
diagramTitle = sanitizeText(txt);
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getDiagramTitle = function () {
|
||||||
|
return diagramTitle;
|
||||||
|
};
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
setAccTitle,
|
setAccTitle,
|
||||||
getTitle,
|
getAccTitle,
|
||||||
|
setDiagramTitle,
|
||||||
|
getDiagramTitle: getDiagramTitle,
|
||||||
getAccDescription,
|
getAccDescription,
|
||||||
setAccDescription,
|
setAccDescription,
|
||||||
clear,
|
clear,
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import utils from '../../utils';
|
|||||||
import mermaidAPI from '../../mermaidAPI';
|
import mermaidAPI from '../../mermaidAPI';
|
||||||
import {
|
import {
|
||||||
setAccTitle,
|
setAccTitle,
|
||||||
getTitle,
|
getAccTitle,
|
||||||
getAccDescription,
|
getAccDescription,
|
||||||
setAccDescription,
|
setAccDescription,
|
||||||
clear as commonClear,
|
clear as commonClear,
|
||||||
@@ -356,7 +356,7 @@ const setDirection = (dir) => {
|
|||||||
export default {
|
export default {
|
||||||
parseDirective,
|
parseDirective,
|
||||||
setAccTitle,
|
setAccTitle,
|
||||||
getTitle,
|
getAccTitle,
|
||||||
getAccDescription,
|
getAccDescription,
|
||||||
setAccDescription,
|
setAccDescription,
|
||||||
getConfig: () => configApi.getConfig().class,
|
getConfig: () => configApi.getConfig().class,
|
||||||
|
|||||||
@@ -550,7 +550,7 @@ foo()
|
|||||||
`;
|
`;
|
||||||
|
|
||||||
parser.parse(str);
|
parser.parse(str);
|
||||||
expect(parser.yy.getTitle()).toBe('My Title');
|
expect(parser.yy.getAccTitle()).toBe('My Title');
|
||||||
expect(parser.yy.getAccDescription()).toBe('My Description');
|
expect(parser.yy.getAccDescription()).toBe('My Description');
|
||||||
});
|
});
|
||||||
it('should handle accTitle and multiline accDescr', function () {
|
it('should handle accTitle and multiline accDescr', function () {
|
||||||
@@ -565,7 +565,7 @@ foo()
|
|||||||
`;
|
`;
|
||||||
|
|
||||||
parser.parse(str);
|
parser.parse(str);
|
||||||
expect(parser.yy.getTitle()).toBe('My Title');
|
expect(parser.yy.getAccTitle()).toBe('My Title');
|
||||||
expect(parser.yy.getAccDescription()).toBe('This is mu multi\nline description');
|
expect(parser.yy.getAccDescription()).toBe('This is mu multi\nline description');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import * as configApi from '../../config';
|
|||||||
import common from '../common/common';
|
import common from '../common/common';
|
||||||
import {
|
import {
|
||||||
setAccTitle,
|
setAccTitle,
|
||||||
getTitle,
|
getAccTitle,
|
||||||
getAccDescription,
|
getAccDescription,
|
||||||
setAccDescription,
|
setAccDescription,
|
||||||
clear as commonClear,
|
clear as commonClear,
|
||||||
@@ -94,7 +94,7 @@ export default {
|
|||||||
getRelationships,
|
getRelationships,
|
||||||
clear,
|
clear,
|
||||||
setAccTitle,
|
setAccTitle,
|
||||||
getTitle,
|
getAccTitle,
|
||||||
setAccDescription,
|
setAccDescription,
|
||||||
getAccDescription,
|
getAccDescription,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -191,7 +191,7 @@ describe('when parsing ER diagram it...', function () {
|
|||||||
accDescr: this graph is about stuff
|
accDescr: this graph is about stuff
|
||||||
${line1}`
|
${line1}`
|
||||||
);
|
);
|
||||||
expect(erDb.getTitle()).toBe('graph title');
|
expect(erDb.getAccTitle()).toBe('graph title');
|
||||||
expect(erDb.getAccDescription()).toBe('this graph is about stuff');
|
expect(erDb.getAccDescription()).toBe('this graph is about stuff');
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -207,7 +207,7 @@ describe('when parsing ER diagram it...', function () {
|
|||||||
}\n
|
}\n
|
||||||
${line1}`
|
${line1}`
|
||||||
);
|
);
|
||||||
expect(erDb.getTitle()).toBe('graph title');
|
expect(erDb.getAccTitle()).toBe('graph title');
|
||||||
expect(erDb.getAccDescription()).toBe('this graph is about stuff');
|
expect(erDb.getAccDescription()).toBe('this graph is about stuff');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import mermaidAPI from '../../mermaidAPI';
|
|||||||
import { log } from '../../logger';
|
import { log } from '../../logger';
|
||||||
import {
|
import {
|
||||||
setAccTitle,
|
setAccTitle,
|
||||||
getTitle,
|
getAccTitle,
|
||||||
getAccDescription,
|
getAccDescription,
|
||||||
setAccDescription,
|
setAccDescription,
|
||||||
clear as commonClear,
|
clear as commonClear,
|
||||||
@@ -747,7 +747,7 @@ export default {
|
|||||||
parseDirective,
|
parseDirective,
|
||||||
defaultConfig: () => configApi.defaultConfig.flowchart,
|
defaultConfig: () => configApi.defaultConfig.flowchart,
|
||||||
setAccTitle,
|
setAccTitle,
|
||||||
getTitle,
|
getAccTitle,
|
||||||
getAccDescription,
|
getAccDescription,
|
||||||
setAccDescription,
|
setAccDescription,
|
||||||
addVertex,
|
addVertex,
|
||||||
|
|||||||
@@ -168,7 +168,7 @@ describe('parsing a flow chart', function () {
|
|||||||
`;
|
`;
|
||||||
|
|
||||||
flow.parser.parse(flowChart);
|
flow.parser.parse(flowChart);
|
||||||
expect(flow.parser.yy.getTitle()).toBe('Big decisions');
|
expect(flow.parser.yy.getAccTitle()).toBe('Big decisions');
|
||||||
expect(flow.parser.yy.getAccDescription()).toBe('Flow chart of the decision making process');
|
expect(flow.parser.yy.getAccDescription()).toBe('Flow chart of the decision making process');
|
||||||
});
|
});
|
||||||
it('should add accTitle and a multi line accDescr to flow chart', function () {
|
it('should add accTitle and a multi line accDescr to flow chart', function () {
|
||||||
@@ -187,7 +187,7 @@ describe('parsing a flow chart', function () {
|
|||||||
`;
|
`;
|
||||||
|
|
||||||
flow.parser.parse(flowChart);
|
flow.parser.parse(flowChart);
|
||||||
expect(flow.parser.yy.getTitle()).toBe('Big decisions');
|
expect(flow.parser.yy.getAccTitle()).toBe('Big decisions');
|
||||||
expect(flow.parser.yy.getAccDescription()).toBe(
|
expect(flow.parser.yy.getAccDescription()).toBe(
|
||||||
`Flow chart of the decision making process
|
`Flow chart of the decision making process
|
||||||
with a second line`
|
with a second line`
|
||||||
|
|||||||
@@ -7,10 +7,12 @@ import mermaidAPI from '../../mermaidAPI';
|
|||||||
import common from '../common/common';
|
import common from '../common/common';
|
||||||
import {
|
import {
|
||||||
setAccTitle,
|
setAccTitle,
|
||||||
getTitle,
|
getAccTitle,
|
||||||
getAccDescription,
|
getAccDescription,
|
||||||
setAccDescription,
|
setAccDescription,
|
||||||
clear as commonClear,
|
clear as commonClear,
|
||||||
|
setDiagramTitle,
|
||||||
|
getDiagramTitle,
|
||||||
} from '../../commonDb';
|
} from '../../commonDb';
|
||||||
|
|
||||||
let dateFormat = '';
|
let dateFormat = '';
|
||||||
@@ -642,7 +644,9 @@ export default {
|
|||||||
setTodayMarker,
|
setTodayMarker,
|
||||||
getTodayMarker,
|
getTodayMarker,
|
||||||
setAccTitle,
|
setAccTitle,
|
||||||
getTitle,
|
getAccTitle,
|
||||||
|
setDiagramTitle,
|
||||||
|
getDiagramTitle,
|
||||||
setAccDescription,
|
setAccDescription,
|
||||||
getAccDescription,
|
getAccDescription,
|
||||||
addSection,
|
addSection,
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ describe('when using the ganttDb', function () {
|
|||||||
it.each`
|
it.each`
|
||||||
fn | expected
|
fn | expected
|
||||||
${'getTasks'} | ${[]}
|
${'getTasks'} | ${[]}
|
||||||
${'getTitle'} | ${''}
|
${'getAccTitle'} | ${''}
|
||||||
${'getAccDescription'} | ${''}
|
${'getAccDescription'} | ${''}
|
||||||
${'getDateFormat'} | ${''}
|
${'getDateFormat'} | ${''}
|
||||||
${'getAxisFormat'} | ${''}
|
${'getAxisFormat'} | ${''}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import moment from 'moment-mini';
|
import moment from 'moment-mini';
|
||||||
|
import { log } from '../../logger';
|
||||||
import {
|
import {
|
||||||
select,
|
select,
|
||||||
scaleTime,
|
scaleTime,
|
||||||
@@ -19,11 +20,9 @@ import addSVGAccessibilityFields from '../../accessibility';
|
|||||||
|
|
||||||
parser.yy = ganttDb;
|
parser.yy = ganttDb;
|
||||||
export const setConf = function () {
|
export const setConf = function () {
|
||||||
// const keys = Object.keys(cnf);
|
log.debug('Something is calling, setConf, remove the call');
|
||||||
// keys.forEach(function(key) {
|
|
||||||
// conf[key] = cnf[key];
|
|
||||||
// });
|
|
||||||
};
|
};
|
||||||
|
|
||||||
let w;
|
let w;
|
||||||
export const draw = function (text, id) {
|
export const draw = function (text, id) {
|
||||||
const conf = getConfig().gantt;
|
const conf = getConfig().gantt;
|
||||||
@@ -110,7 +109,7 @@ export const draw = function (text, id) {
|
|||||||
|
|
||||||
svg
|
svg
|
||||||
.append('text')
|
.append('text')
|
||||||
.text(parser.yy.getTitle())
|
.text(parser.yy.getAccTitle())
|
||||||
.attr('x', w / 2)
|
.attr('x', w / 2)
|
||||||
.attr('y', conf.titleTopMargin)
|
.attr('y', conf.titleTopMargin)
|
||||||
.attr('class', 'titleText');
|
.attr('class', 'titleText');
|
||||||
|
|||||||
@@ -128,7 +128,7 @@ statement
|
|||||||
| excludes {yy.setExcludes($1.substr(9));$$=$1.substr(9);}
|
| excludes {yy.setExcludes($1.substr(9));$$=$1.substr(9);}
|
||||||
| includes {yy.setIncludes($1.substr(9));$$=$1.substr(9);}
|
| includes {yy.setIncludes($1.substr(9));$$=$1.substr(9);}
|
||||||
| todayMarker {yy.setTodayMarker($1.substr(12));$$=$1.substr(12);}
|
| todayMarker {yy.setTodayMarker($1.substr(12));$$=$1.substr(12);}
|
||||||
| title {yy.setAccTitle($1.substr(6));$$=$1.substr(6);}
|
| title {yy.setDiagramTitle($1.substr(6));$$=$1.substr(6);}
|
||||||
| acc_title acc_title_value { $$=$2.trim();yy.setAccTitle($$); }
|
| acc_title acc_title_value { $$=$2.trim();yy.setAccTitle($$); }
|
||||||
| acc_descr acc_descr_value { $$=$2.trim();yy.setAccDescription($$); }
|
| acc_descr acc_descr_value { $$=$2.trim();yy.setAccDescription($$); }
|
||||||
| acc_descr_multiline_value { $$=$1.trim();yy.setAccDescription($$); } | section {yy.addSection($1.substr(8));$$=$1.substr(8);}
|
| acc_descr_multiline_value { $$=$1.trim();yy.setAccDescription($$); } | section {yy.addSection($1.substr(8));$$=$1.substr(8);}
|
||||||
|
|||||||
@@ -169,7 +169,7 @@ describe('when parsing a gantt diagram it', function () {
|
|||||||
|
|
||||||
parser.parse(ganttString);
|
parser.parse(ganttString);
|
||||||
|
|
||||||
expect(ganttDb.getTitle()).toBe(expectedTitle);
|
expect(ganttDb.getAccTitle()).toBe(expectedTitle);
|
||||||
expect(ganttDb.getAccDescription()).toBe(expectedAccDescription);
|
expect(ganttDb.getAccDescription()).toBe(expectedAccDescription);
|
||||||
});
|
});
|
||||||
it('should allow for a accessibility title and multiline description (accDescr)', function () {
|
it('should allow for a accessibility title and multiline description (accDescr)', function () {
|
||||||
@@ -187,7 +187,7 @@ row2`;
|
|||||||
|
|
||||||
parser.parse(ganttString);
|
parser.parse(ganttString);
|
||||||
|
|
||||||
expect(ganttDb.getTitle()).toBe(expectedTitle);
|
expect(ganttDb.getAccTitle()).toBe(expectedTitle);
|
||||||
expect(ganttDb.getAccDescription()).toBe(expectedAccDescription);
|
expect(ganttDb.getAccDescription()).toBe(expectedAccDescription);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import { getConfig } from '../../config';
|
|||||||
import common from '../common/common';
|
import common from '../common/common';
|
||||||
import {
|
import {
|
||||||
setAccTitle,
|
setAccTitle,
|
||||||
getTitle,
|
getAccTitle,
|
||||||
getAccDescription,
|
getAccDescription,
|
||||||
setAccDescription,
|
setAccDescription,
|
||||||
clear as commonClear,
|
clear as commonClear,
|
||||||
@@ -413,7 +413,7 @@ export default {
|
|||||||
getDirection,
|
getDirection,
|
||||||
getHead,
|
getHead,
|
||||||
setAccTitle,
|
setAccTitle,
|
||||||
getTitle,
|
getAccTitle,
|
||||||
getAccDescription,
|
getAccDescription,
|
||||||
setAccDescription,
|
setAccDescription,
|
||||||
commitType,
|
commitType,
|
||||||
|
|||||||
@@ -660,7 +660,7 @@ describe('when parsing a gitGraph', function () {
|
|||||||
commit
|
commit
|
||||||
`;
|
`;
|
||||||
parser.parse(str);
|
parser.parse(str);
|
||||||
expect(parser.yy.getTitle()).toBe('This is a title');
|
expect(parser.yy.getAccTitle()).toBe('This is a title');
|
||||||
expect(parser.yy.getAccDescription()).toBe('This is a description');
|
expect(parser.yy.getAccDescription()).toBe('This is a description');
|
||||||
});
|
});
|
||||||
it('should handle a title and a multiline description (accDescr)', () => {
|
it('should handle a title and a multiline description (accDescr)', () => {
|
||||||
@@ -673,7 +673,7 @@ describe('when parsing a gitGraph', function () {
|
|||||||
commit
|
commit
|
||||||
`;
|
`;
|
||||||
parser.parse(str);
|
parser.parse(str);
|
||||||
expect(parser.yy.getTitle()).toBe('This is a title');
|
expect(parser.yy.getAccTitle()).toBe('This is a title');
|
||||||
expect(parser.yy.getAccDescription()).toBe('This is a description\nusing multiple lines');
|
expect(parser.yy.getAccDescription()).toBe('This is a description\nusing multiple lines');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ line
|
|||||||
statement
|
statement
|
||||||
:
|
:
|
||||||
| txt value { yy.addSection($1,yy.cleanupValue($2)); }
|
| txt value { yy.addSection($1,yy.cleanupValue($2)); }
|
||||||
| title title_value { $$=$2.trim();yy.setPieTitle($$); }
|
| title title_value { $$=$2.trim();yy.setDiagramTitle($$); }
|
||||||
| acc_title acc_title_value { $$=$2.trim();yy.setAccTitle($$); }
|
| acc_title acc_title_value { $$=$2.trim();yy.setAccTitle($$); }
|
||||||
| acc_descr acc_descr_value { $$=$2.trim();yy.setAccDescription($$); }
|
| acc_descr acc_descr_value { $$=$2.trim();yy.setAccDescription($$); }
|
||||||
| acc_descr_multiline_value { $$=$1.trim();yy.setAccDescription($$); } | section {yy.addSection($1.substr(8));$$=$1.substr(8);}
|
| acc_descr_multiline_value { $$=$1.trim();yy.setAccDescription($$); } | section {yy.addSection($1.substr(8));$$=$1.substr(8);}
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ pie
|
|||||||
"bat" : 40
|
"bat" : 40
|
||||||
`);
|
`);
|
||||||
const sections = pieDb.getSections();
|
const sections = pieDb.getSections();
|
||||||
const title = pieDb.getPieTitle();
|
const title = pieDb.getDiagramTitle();
|
||||||
const section1 = sections['ash'];
|
const section1 = sections['ash'];
|
||||||
expect(section1).toBe(60);
|
expect(section1).toBe(60);
|
||||||
expect(title).toBe('a 60/40 pie');
|
expect(title).toBe('a 60/40 pie');
|
||||||
@@ -69,7 +69,7 @@ pie
|
|||||||
`);
|
`);
|
||||||
|
|
||||||
const sections = pieDb.getSections();
|
const sections = pieDb.getSections();
|
||||||
const title = pieDb.getPieTitle();
|
const title = pieDb.getDiagramTitle();
|
||||||
const description = pieDb.getAccDescription();
|
const description = pieDb.getAccDescription();
|
||||||
const section1 = sections['ash'];
|
const section1 = sections['ash'];
|
||||||
expect(section1).toBe(60);
|
expect(section1).toBe(60);
|
||||||
@@ -85,7 +85,7 @@ pie
|
|||||||
`);
|
`);
|
||||||
|
|
||||||
const sections = pieDb.getSections();
|
const sections = pieDb.getSections();
|
||||||
const title = pieDb.getPieTitle();
|
const title = pieDb.getDiagramTitle();
|
||||||
const description = pieDb.getAccDescription();
|
const description = pieDb.getAccDescription();
|
||||||
const section1 = sections['ash'];
|
const section1 = sections['ash'];
|
||||||
expect(section1).toBe(60);
|
expect(section1).toBe(60);
|
||||||
@@ -103,7 +103,7 @@ pie
|
|||||||
`);
|
`);
|
||||||
|
|
||||||
const sections = pieDb.getSections();
|
const sections = pieDb.getSections();
|
||||||
const title = pieDb.getPieTitle();
|
const title = pieDb.getDiagramTitle();
|
||||||
const description = pieDb.getAccDescription();
|
const description = pieDb.getAccDescription();
|
||||||
const section1 = sections['ash'];
|
const section1 = sections['ash'];
|
||||||
expect(section1).toBe(60);
|
expect(section1).toBe(60);
|
||||||
|
|||||||
@@ -4,7 +4,9 @@ import * as configApi from '../../config';
|
|||||||
import common from '../common/common';
|
import common from '../common/common';
|
||||||
import {
|
import {
|
||||||
setAccTitle,
|
setAccTitle,
|
||||||
getTitle,
|
getAccTitle,
|
||||||
|
setDiagramTitle,
|
||||||
|
getDiagramTitle,
|
||||||
getAccDescription,
|
getAccDescription,
|
||||||
setAccDescription,
|
setAccDescription,
|
||||||
clear as commonClear,
|
clear as commonClear,
|
||||||
@@ -52,15 +54,6 @@ const clear = function () {
|
|||||||
commonClear();
|
commonClear();
|
||||||
};
|
};
|
||||||
|
|
||||||
export const setPieTitle = function (txt) {
|
|
||||||
let sanitizedText = common.sanitizeText(txt, configApi.getConfig());
|
|
||||||
title = sanitizedText;
|
|
||||||
};
|
|
||||||
|
|
||||||
export const getPieTitle = function () {
|
|
||||||
return title;
|
|
||||||
};
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
parseDirective,
|
parseDirective,
|
||||||
getConfig: () => configApi.getConfig().pie,
|
getConfig: () => configApi.getConfig().pie,
|
||||||
@@ -69,9 +62,9 @@ export default {
|
|||||||
cleanupValue,
|
cleanupValue,
|
||||||
clear,
|
clear,
|
||||||
setAccTitle,
|
setAccTitle,
|
||||||
getTitle,
|
getAccTitle,
|
||||||
setPieTitle,
|
setDiagramTitle,
|
||||||
getPieTitle,
|
getDiagramTitle,
|
||||||
setShowData,
|
setShowData,
|
||||||
getShowData,
|
getShowData,
|
||||||
getAccDescription,
|
getAccDescription,
|
||||||
|
|||||||
@@ -136,7 +136,7 @@ export const draw = (txt, id) => {
|
|||||||
|
|
||||||
svg
|
svg
|
||||||
.append('text')
|
.append('text')
|
||||||
.text(parser.yy.getPieTitle())
|
.text(parser.yy.getDiagramTitle())
|
||||||
.attr('x', 0)
|
.attr('x', 0)
|
||||||
.attr('y', -(height - 50) / 2)
|
.attr('y', -(height - 50) / 2)
|
||||||
.attr('class', 'pieTitleText');
|
.attr('class', 'pieTitleText');
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ describe('when parsing requirement diagram it...', function () {
|
|||||||
|
|
||||||
reqDiagram.parser.parse(doc);
|
reqDiagram.parser.parse(doc);
|
||||||
|
|
||||||
expect(requirementDb.getTitle()).toBe(expectedTitle);
|
expect(requirementDb.getAccTitle()).toBe(expectedTitle);
|
||||||
expect(requirementDb.getAccDescription()).toBe(expectedAccDescription);
|
expect(requirementDb.getAccDescription()).toBe(expectedAccDescription);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -107,7 +107,7 @@ line 2`;
|
|||||||
|
|
||||||
reqDiagram.parser.parse(doc);
|
reqDiagram.parser.parse(doc);
|
||||||
|
|
||||||
expect(requirementDb.getTitle()).toBe(expectedTitle);
|
expect(requirementDb.getAccTitle()).toBe(expectedTitle);
|
||||||
expect(requirementDb.getAccDescription()).toBe(expectedAccDescription);
|
expect(requirementDb.getAccDescription()).toBe(expectedAccDescription);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import mermaidAPI from '../../mermaidAPI';
|
|||||||
import common from '../common/common';
|
import common from '../common/common';
|
||||||
import {
|
import {
|
||||||
setAccTitle,
|
setAccTitle,
|
||||||
getTitle,
|
getAccTitle,
|
||||||
getAccDescription,
|
getAccDescription,
|
||||||
setAccDescription,
|
setAccDescription,
|
||||||
clear as commonClear,
|
clear as commonClear,
|
||||||
@@ -163,7 +163,7 @@ export default {
|
|||||||
setNewReqRisk,
|
setNewReqRisk,
|
||||||
setNewReqVerifyMethod,
|
setNewReqVerifyMethod,
|
||||||
setAccTitle,
|
setAccTitle,
|
||||||
getTitle,
|
getAccTitle,
|
||||||
setAccDescription,
|
setAccDescription,
|
||||||
getAccDescription,
|
getAccDescription,
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,9 @@ import { log } from '../../logger';
|
|||||||
import { sanitizeText } from '../common/common';
|
import { sanitizeText } from '../common/common';
|
||||||
import {
|
import {
|
||||||
setAccTitle,
|
setAccTitle,
|
||||||
getTitle,
|
getAccTitle,
|
||||||
|
setDiagramTitle,
|
||||||
|
getDiagramTitle,
|
||||||
getAccDescription,
|
getAccDescription,
|
||||||
setAccDescription,
|
setAccDescription,
|
||||||
clear as commonClear,
|
clear as commonClear,
|
||||||
@@ -331,15 +333,6 @@ export const getActorProperty = function (actor, key) {
|
|||||||
return undefined;
|
return undefined;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const setDiagramTitle = function (txt) {
|
|
||||||
let sanitizedText = sanitizeText(txt, configApi.getConfig());
|
|
||||||
diagramTitle = sanitizedText;
|
|
||||||
};
|
|
||||||
|
|
||||||
export const getDiagramTitle = function () {
|
|
||||||
return diagramTitle;
|
|
||||||
};
|
|
||||||
|
|
||||||
export const apply = function (param) {
|
export const apply = function (param) {
|
||||||
if (param instanceof Array) {
|
if (param instanceof Array) {
|
||||||
param.forEach(function (item) {
|
param.forEach(function (item) {
|
||||||
@@ -450,8 +443,9 @@ export default {
|
|||||||
getActor,
|
getActor,
|
||||||
getActorKeys,
|
getActorKeys,
|
||||||
getActorProperty,
|
getActorProperty,
|
||||||
getTitle,
|
getAccTitle,
|
||||||
getDiagramTitle,
|
getDiagramTitle,
|
||||||
|
setDiagramTitle,
|
||||||
parseDirective,
|
parseDirective,
|
||||||
getConfig: () => configApi.getConfig().sequence,
|
getConfig: () => configApi.getConfig().sequence,
|
||||||
clear,
|
clear,
|
||||||
@@ -461,7 +455,6 @@ export default {
|
|||||||
PLACEMENT,
|
PLACEMENT,
|
||||||
addNote,
|
addNote,
|
||||||
setAccTitle,
|
setAccTitle,
|
||||||
setDiagramTitle,
|
|
||||||
apply,
|
apply,
|
||||||
setAccDescription,
|
setAccDescription,
|
||||||
getAccDescription,
|
getAccDescription,
|
||||||
|
|||||||
@@ -119,7 +119,7 @@ Alice->Bob:Hello Bob, how are you?
|
|||||||
|
|
||||||
mermaidAPI.parse(str);
|
mermaidAPI.parse(str);
|
||||||
expect(parser.yy.getDiagramTitle()).toBe('Diagram Title');
|
expect(parser.yy.getDiagramTitle()).toBe('Diagram Title');
|
||||||
expect(parser.yy.getTitle()).toBe('This is the title');
|
expect(parser.yy.getAccTitle()).toBe('This is the title');
|
||||||
expect(parser.yy.getAccDescription()).toBe('Accessibility Description');
|
expect(parser.yy.getAccDescription()).toBe('Accessibility Description');
|
||||||
const messages = parser.yy.getMessages();
|
const messages = parser.yy.getMessages();
|
||||||
});
|
});
|
||||||
@@ -135,7 +135,7 @@ Alice->Bob:Hello Bob, how are you?
|
|||||||
`;
|
`;
|
||||||
|
|
||||||
mermaidAPI.parse(str);
|
mermaidAPI.parse(str);
|
||||||
expect(parser.yy.getTitle()).toBe('This is the title');
|
expect(parser.yy.getAccTitle()).toBe('This is the title');
|
||||||
expect(parser.yy.getAccDescription()).toBe('Accessibility\nDescription');
|
expect(parser.yy.getAccDescription()).toBe('Accessibility\nDescription');
|
||||||
const messages = parser.yy.getMessages();
|
const messages = parser.yy.getMessages();
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import common from '../common/common';
|
|||||||
import * as configApi from '../../config';
|
import * as configApi from '../../config';
|
||||||
import {
|
import {
|
||||||
setAccTitle,
|
setAccTitle,
|
||||||
getTitle,
|
getAccTitle,
|
||||||
getAccDescription,
|
getAccDescription,
|
||||||
setAccDescription,
|
setAccDescription,
|
||||||
clear as commonClear,
|
clear as commonClear,
|
||||||
@@ -92,7 +92,7 @@ const extract = (_doc) => {
|
|||||||
// doc = root;
|
// doc = root;
|
||||||
// }
|
// }
|
||||||
log.info(doc);
|
log.info(doc);
|
||||||
clear();
|
clear(true);
|
||||||
|
|
||||||
log.info('Extract', doc);
|
log.info('Extract', doc);
|
||||||
|
|
||||||
@@ -171,7 +171,7 @@ export const addState = function (id, type, doc, descr, note) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export const clear = function () {
|
export const clear = function (saveCommon) {
|
||||||
documents = {
|
documents = {
|
||||||
root: newDoc(),
|
root: newDoc(),
|
||||||
};
|
};
|
||||||
@@ -182,7 +182,9 @@ export const clear = function () {
|
|||||||
startCnt = 0;
|
startCnt = 0;
|
||||||
endCnt = 0; // eslint-disable-line
|
endCnt = 0; // eslint-disable-line
|
||||||
classes = [];
|
classes = [];
|
||||||
commonClear();
|
if (!saveCommon) {
|
||||||
|
commonClear();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getState = function (id) {
|
export const getState = function (id) {
|
||||||
@@ -283,7 +285,6 @@ export default {
|
|||||||
addRelation,
|
addRelation,
|
||||||
getDividerId,
|
getDividerId,
|
||||||
setDirection,
|
setDirection,
|
||||||
// addDescription,
|
|
||||||
cleanupLabel,
|
cleanupLabel,
|
||||||
lineType,
|
lineType,
|
||||||
relationType,
|
relationType,
|
||||||
@@ -293,7 +294,7 @@ export default {
|
|||||||
getRootDocV2,
|
getRootDocV2,
|
||||||
extract,
|
extract,
|
||||||
trimColon,
|
trimColon,
|
||||||
getTitle,
|
getAccTitle,
|
||||||
setAccTitle,
|
setAccTitle,
|
||||||
getAccDescription,
|
getAccDescription,
|
||||||
setAccDescription,
|
setAccDescription,
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ describe('state diagram, ', function () {
|
|||||||
`;
|
`;
|
||||||
|
|
||||||
parser.parse(str);
|
parser.parse(str);
|
||||||
const title = stateDb.getTitle();
|
const title = stateDb.getAccTitle();
|
||||||
expect(title).toBe('a simple title of the diagram');
|
expect(title).toBe('a simple title of the diagram');
|
||||||
});
|
});
|
||||||
it('simple with directive', function () {
|
it('simple with directive', function () {
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ describe('state diagram, ', function () {
|
|||||||
`;
|
`;
|
||||||
|
|
||||||
parser.parse(str);
|
parser.parse(str);
|
||||||
const title = stateDb.getTitle();
|
const title = stateDb.getAccTitle();
|
||||||
expect(title).toBe('a simple title of the diagram');
|
expect(title).toBe('a simple title of the diagram');
|
||||||
});
|
});
|
||||||
it('simple with directive', function () {
|
it('simple with directive', function () {
|
||||||
|
|||||||
@@ -3,7 +3,9 @@ import * as configApi from '../../config';
|
|||||||
import common from '../common/common';
|
import common from '../common/common';
|
||||||
import {
|
import {
|
||||||
setAccTitle,
|
setAccTitle,
|
||||||
getTitle,
|
getAccTitle,
|
||||||
|
setDiagramTitle,
|
||||||
|
getDiagramTitle,
|
||||||
getAccDescription,
|
getAccDescription,
|
||||||
setAccDescription,
|
setAccDescription,
|
||||||
clear as commonClear,
|
clear as commonClear,
|
||||||
@@ -126,8 +128,10 @@ export default {
|
|||||||
parseDirective,
|
parseDirective,
|
||||||
getConfig: () => configApi.getConfig().journey,
|
getConfig: () => configApi.getConfig().journey,
|
||||||
clear,
|
clear,
|
||||||
|
setDiagramTitle,
|
||||||
|
getDiagramTitle,
|
||||||
setAccTitle,
|
setAccTitle,
|
||||||
getTitle,
|
getAccTitle,
|
||||||
setAccDescription,
|
setAccDescription,
|
||||||
getAccDescription,
|
getAccDescription,
|
||||||
addSection,
|
addSection,
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ describe('when using the journeyDb', function () {
|
|||||||
it.each`
|
it.each`
|
||||||
fn | expected
|
fn | expected
|
||||||
${'getTasks'} | ${[]}
|
${'getTasks'} | ${[]}
|
||||||
${'getTitle'} | ${''}
|
${'getAccTitle'} | ${''}
|
||||||
${'getSections'} | ${[]}
|
${'getSections'} | ${[]}
|
||||||
${'getActors'} | ${[]}
|
${'getActors'} | ${[]}
|
||||||
`('should clear $fn', ({ fn, expected }) => {
|
`('should clear $fn', ({ fn, expected }) => {
|
||||||
@@ -34,7 +34,7 @@ describe('when using the journeyDb', function () {
|
|||||||
it.each`
|
it.each`
|
||||||
fn | expected
|
fn | expected
|
||||||
${'getTasks'} | ${[]}
|
${'getTasks'} | ${[]}
|
||||||
${'getTitle'} | ${''}
|
${'getAccTitle'} | ${''}
|
||||||
${'getAccDescription'} | ${''}
|
${'getAccDescription'} | ${''}
|
||||||
${'getSections'} | ${[]}
|
${'getSections'} | ${[]}
|
||||||
`('should clear $fn', ({ fn, expected }) => {
|
`('should clear $fn', ({ fn, expected }) => {
|
||||||
@@ -52,7 +52,7 @@ describe('when using the journeyDb', function () {
|
|||||||
journeyDb.addSection('Do shopping');
|
journeyDb.addSection('Do shopping');
|
||||||
journeyDb.addTask('Go shopping', ':5:Mum');
|
journeyDb.addTask('Go shopping', ':5:Mum');
|
||||||
|
|
||||||
expect(journeyDb.getTitle()).toEqual('Shopping');
|
expect(journeyDb.getAccTitle()).toEqual('Shopping');
|
||||||
expect(journeyDb.getAccDescription()).toEqual('A user journey for family shopping');
|
expect(journeyDb.getAccDescription()).toEqual('A user journey for family shopping');
|
||||||
expect(journeyDb.getTasks()).toEqual([
|
expect(journeyDb.getTasks()).toEqual([
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ export const draw = function (text, id) {
|
|||||||
svgDraw.initGraphics(diagram);
|
svgDraw.initGraphics(diagram);
|
||||||
|
|
||||||
const tasks = parser.yy.getTasks();
|
const tasks = parser.yy.getTasks();
|
||||||
const title = parser.yy.getTitle();
|
const title = parser.yy.getDiagramTitle();
|
||||||
|
|
||||||
const actorNames = parser.yy.getActors();
|
const actorNames = parser.yy.getActors();
|
||||||
for (let member in actors) delete actors[member];
|
for (let member in actors) delete actors[member];
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ directive
|
|||||||
;
|
;
|
||||||
|
|
||||||
statement
|
statement
|
||||||
: title {yy.setAccTitle($1.substr(6));$$=$1.substr(6);}
|
: title {yy.setDiagramTitle($1.substr(6));$$=$1.substr(6);}
|
||||||
| acc_title acc_title_value { $$=$2.trim();yy.setAccTitle($$); }
|
| acc_title acc_title_value { $$=$2.trim();yy.setAccTitle($$); }
|
||||||
| acc_descr acc_descr_value { $$=$2.trim();yy.setAccDescription($$); }
|
| acc_descr acc_descr_value { $$=$2.trim();yy.setAccDescription($$); }
|
||||||
| acc_descr_multiline_value { $$=$1.trim();yy.setAccDescription($$); }
|
| acc_descr_multiline_value { $$=$1.trim();yy.setAccDescription($$); }
|
||||||
|
|||||||
@@ -36,11 +36,13 @@ describe('when parsing a journey diagram it', function () {
|
|||||||
family shopping
|
family shopping
|
||||||
}` +
|
}` +
|
||||||
'title Adding journey diagram functionality to mermaid\n' +
|
'title Adding journey diagram functionality to mermaid\n' +
|
||||||
|
'accTitle: Adding acc journey diagram functionality to mermaid\n' +
|
||||||
'section Order from website';
|
'section Order from website';
|
||||||
|
|
||||||
expect(parserFnConstructor(str)).not.toThrow();
|
expect(parserFnConstructor(str)).not.toThrow();
|
||||||
expect(journeyDb.getAccDescription()).toBe('A user journey for\nfamily shopping');
|
expect(journeyDb.getAccDescription()).toBe('A user journey for\nfamily shopping');
|
||||||
expect(journeyDb.getTitle()).toBe('Adding journey diagram functionality to mermaid');
|
expect(journeyDb.getDiagramTitle()).toBe('Adding journey diagram functionality to mermaid');
|
||||||
|
expect(journeyDb.getAccTitle()).toBe('Adding acc journey diagram functionality to mermaid');
|
||||||
});
|
});
|
||||||
it('it should handle an accessibility title (accDescr)', function () {
|
it('it should handle an accessibility title (accDescr)', function () {
|
||||||
const str = `journey
|
const str = `journey
|
||||||
@@ -49,7 +51,7 @@ describe('when parsing a journey diagram it', function () {
|
|||||||
|
|
||||||
expect(parserFnConstructor(str)).not.toThrow();
|
expect(parserFnConstructor(str)).not.toThrow();
|
||||||
expect(journeyDb.getAccDescription()).toBe('');
|
expect(journeyDb.getAccDescription()).toBe('');
|
||||||
expect(journeyDb.getTitle()).toBe('The title');
|
expect(journeyDb.getAccTitle()).toBe('The title');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should handle a section definition', function () {
|
it('should handle a section definition', function () {
|
||||||
|
|||||||
Reference in New Issue
Block a user