mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-08-31 14:16:42 +02:00
Correct classDef and class grammar
Previously, you were allowed to define a class called 'default' but were not allowed to use it because the classStatement grammar expected an alphanum, which did not include the word DEFAULT
This commit is contained in:
@@ -891,4 +891,15 @@ graph TD
|
|||||||
{ htmlLabels: true, flowchart: { htmlLabels: true }, securityLevel: 'loose' }
|
{ htmlLabels: true, flowchart: { htmlLabels: true }, securityLevel: 'loose' }
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
it('66: apply class called default on node called default', () => {
|
||||||
|
imgSnapshotTest(
|
||||||
|
`
|
||||||
|
graph TD
|
||||||
|
classDef default fill:#000,stroke:#000,stroke-width:4px,color:#fff
|
||||||
|
default --> default2
|
||||||
|
class default,default2 default
|
||||||
|
`,
|
||||||
|
{ htmlLabels: true, flowchart: { htmlLabels: true }, securityLevel: 'loose' }
|
||||||
|
);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
@@ -507,8 +507,8 @@ classDefStatement:CLASSDEF SPACE idString SPACE stylesOpt
|
|||||||
{$$ = $CLASSDEF;yy.addClass($idString,$stylesOpt);}
|
{$$ = $CLASSDEF;yy.addClass($idString,$stylesOpt);}
|
||||||
;
|
;
|
||||||
|
|
||||||
classStatement:CLASS SPACE idString SPACE alphaNum
|
classStatement:CLASS SPACE idString\[vertex] SPACE idString\[class]
|
||||||
{$$ = $CLASS;yy.setClass($idString, $alphaNum);}
|
{$$ = $CLASS;yy.setClass($vertex, $class);}
|
||||||
;
|
;
|
||||||
|
|
||||||
clickStatement
|
clickStatement
|
||||||
|
Reference in New Issue
Block a user