From 55eebd9309af5c8a865cd7f548c19c6075b6e6a1 Mon Sep 17 00:00:00 2001 From: Ashish Jain Date: Wed, 29 Sep 2021 17:13:14 +0200 Subject: [PATCH 1/2] 2292 Fix for broken class diagram on space after the '{' curly brace --- src/diagrams/class/parser/classDiagram.jison | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/diagrams/class/parser/classDiagram.jison b/src/diagrams/class/parser/classDiagram.jison index 8b0ee4332..cd4ff75a2 100644 --- a/src/diagrams/class/parser/classDiagram.jison +++ b/src/diagrams/class/parser/classDiagram.jison @@ -29,7 +29,8 @@ ((?:(?!\}\%\%).|\n)*) return 'arg_directive'; \%\%(?!\{)*[^\n]*(\r?\n?)+ /* skip comments */ \%\%[^\n]*(\r?\n)* /* skip comments */ -(\r?\n)+ return 'NEWLINE'; + +\s*(\r?\n)+ return 'NEWLINE'; \s+ /* skip whitespace */ "classDiagram-v2" return 'CLASS_DIAGRAM'; "classDiagram" return 'CLASS_DIAGRAM'; @@ -262,7 +263,7 @@ classStatement ; annotationStatement - : ANNOTATION_START alphaNumToken ANNOTATION_END className { yy.addAnnotation($4,$2); } + :ANNOTATION_START alphaNumToken ANNOTATION_END className { yy.addAnnotation($4,$2); } ; members From 8ee3155f2a953995ab6a20b9c3e8e1bd28639581 Mon Sep 17 00:00:00 2001 From: Knut Sveidqvist Date: Wed, 29 Sep 2021 20:20:44 +0200 Subject: [PATCH 2/2] Fix for broken test --- cypress/integration/rendering/classDiagram-v2.spec.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cypress/integration/rendering/classDiagram-v2.spec.js b/cypress/integration/rendering/classDiagram-v2.spec.js index eea11aaf3..f8c973c6b 100644 --- a/cypress/integration/rendering/classDiagram-v2.spec.js +++ b/cypress/integration/rendering/classDiagram-v2.spec.js @@ -375,7 +375,7 @@ describe('Class diagram V2', () => { imgSnapshotTest( ` classDiagram-v2 - Foo { + class Foo { +String bar$ } `, @@ -408,7 +408,7 @@ describe('Class diagram V2', () => { ); cy.get('svg'); }); - + it('18: should handle the direction statemnent with LR', () => { imgSnapshotTest( `