From c15326b8969c8a02d279b1f0b56f3a353d1e429f Mon Sep 17 00:00:00 2001 From: Tom PERRILLAT-COLLOMB Date: Thu, 22 Dec 2022 13:59:49 +0100 Subject: [PATCH] test(flowchart): add test on multiple classes declaration --- .../diagrams/flowchart/parser/flow-style.spec.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/packages/mermaid/src/diagrams/flowchart/parser/flow-style.spec.js b/packages/mermaid/src/diagrams/flowchart/parser/flow-style.spec.js index 050d64f91..c5017da96 100644 --- a/packages/mermaid/src/diagrams/flowchart/parser/flow-style.spec.js +++ b/packages/mermaid/src/diagrams/flowchart/parser/flow-style.spec.js @@ -113,6 +113,22 @@ describe('[Style] when parsing', () => { expect(classes['exClass'].styles[1]).toBe('border:1px solid red'); }); + it('should be possible to declare multiple classes', function () { + const res = flow.parser.parse( + 'graph TD;classDef firstClass,secondClass background:#bbb,border:1px solid red;' + ); + + const classes = flow.parser.yy.getClasses(); + + expect(classes['firstClass'].styles.length).toBe(2); + expect(classes['firstClass'].styles[0]).toBe('background:#bbb'); + expect(classes['firstClass'].styles[1]).toBe('border:1px solid red'); + + expect(classes['secondClass'].styles.length).toBe(2); + expect(classes['secondClass'].styles[0]).toBe('background:#bbb'); + expect(classes['secondClass'].styles[1]).toBe('border:1px solid red'); + }); + it('should be possible to declare a class with a dot in the style', function () { const res = flow.parser.parse( 'graph TD;classDef exClass background:#bbb,border:1.5px solid red;'