File tree Expand file tree Collapse file tree 2 files changed +31
-0
lines changed
packages/mermaid/src/diagrams/quadrant-chart Expand file tree Collapse file tree 2 files changed +31
-0
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ ' mermaid ' : major
3
+ ---
4
+
5
+ ensure quadrant titles wrap and stay within bounds
Original file line number Diff line number Diff line change 1
1
import quadrantDb from './quadrantDb.js' ;
2
+ // @ts -ignore: JISON doesn't support types
3
+ import parser from './parser/quadrant.jison' ;
2
4
3
5
describe ( 'quadrant unit tests' , ( ) => {
4
6
it ( 'should parse the styles array and return a StylesObject' , ( ) => {
@@ -47,4 +49,28 @@ describe('quadrant unit tests', () => {
47
49
'value for stroke-width 30 is invalid, please use a valid number of pixels (eg. 10px)'
48
50
) ;
49
51
} ) ;
52
+ it ( 'should store long quadrant titles correctly (wrap handled in renderer)' , ( ) => {
53
+ const input = `
54
+ quadrantChart
55
+ quadrant-1 "🔥 This is a very long quadrant title that should wrap properly inside the box"
56
+ quadrant-2 "💡 Another long label that should be parsed fully"
57
+ quadrant-3 "Short"
58
+ quadrant-4 "🚀 Final test case with long label"
59
+ ` ;
60
+
61
+ quadrantDb . clear ( ) ;
62
+ parser . yy = quadrantDb ;
63
+ parser . quadrantDb ( input ) ;
64
+
65
+ expect ( quadrantDb . getQuadrantData ( ) . quadrants [ 0 ] . text . text ) . toBe (
66
+ '🔥 This is a very long quadrant title that should wrap properly inside the box'
67
+ ) ;
68
+ expect ( quadrantDb . getQuadrantData ( ) . quadrants [ 1 ] . text . text ) . toBe (
69
+ '💡 Another long label that should be parsed fully'
70
+ ) ;
71
+ expect ( quadrantDb . getQuadrantData ( ) . quadrants [ 2 ] . text . text ) . toBe ( 'Short' ) ;
72
+ expect ( quadrantDb . getQuadrantData ( ) . quadrants [ 3 ] . text . text ) . toBe (
73
+ '🚀 Final test case with long label'
74
+ ) ;
75
+ } ) ;
50
76
} ) ;
You can’t perform that action at this time.
0 commit comments