Skip to content

Commit 30a704f

Browse files
committed
Extended set of features tested
1 parent 883c409 commit 30a704f

2 files changed

Lines changed: 174 additions & 32 deletions

File tree

plantuml-to-drawio/diagrams/sequence/CLAUDE.md

Lines changed: 46 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ else other condition — new section with condition
185185
end — closes the innermost fragment
186186
```
187187

188-
**All fragment types**: `alt`, `loop`, `opt`, `par`, `par2`, `break`, `critical`, `group`.
188+
**All fragment types**: `alt`, `loop`, `opt`, `par`, `par2`, `break`, `critical`, `group`, `partition`.
189189

190190
**Nesting**: Uses a `fragmentStack` array. Opening a fragment pushes; `end` pops and adds the fragment to the current context (which may be another fragment's section, enabling nesting).
191191

@@ -688,23 +688,28 @@ Each element type consumes vertical space:
688688
| Feature | Parser | Model | Emitter | Notes |
689689
|---|---|---|---|---|
690690
| Autonumber |||| Need to prefix labels with computed numbers |
691+
| Autonumber resume |||| Parsed and tested in comprehensive.puml |
691692
| Return messages | ✅ (partial) || ❌ (just advances Y) | Need activation stack to resolve source/target |
692693
| Multicast || ✅ (stored) || `msg.multicast[]` populated but not emitted as extra arrows |
693694
| Parallel `&` || ✅ (flag) || `msg.isParallel` set but no Y-sharing logic |
694695
| Title |||| `diagram.title` stored but not rendered |
695696
| Participant stereotypes |||| `p.stereotype` stored but not rendered |
697+
| Participant colors |||| `p.color` stored but not rendered |
698+
| Participant ordering |||| `p.order` stored but not rendered |
696699
| Arrow `bold` / `hidden` | ✅ (parsed) ||| `ArrowBody.BOLD`/`HIDDEN` not mapped to styles |
697700
| Arrow part (top/bottom) |||| `ArrowPart.TOP_PART`/`BOTTOM_PART` not visually distinct |
698701
| Exo arrow direction ||| ⚠️ (partial) | Direction logic for `[<-` and `->]` variants may be wrong — needs visual testing |
702+
| Autoactivate |||| `autoactivate on/off` parsed but not used in emitter |
703+
| Newpage |||| Parsed but not emitted (single-page output only) |
704+
| Hide/show footbox |||| `hide footbox` parsed but footer boxes always omitted |
705+
| Fragment colors |||| `alt #LightPink` parsed but color not applied in emitter |
706+
| Partition |||| Same as `group` in model, tested in comprehensive.puml |
699707

700708
### Deferred Features (Tier 3 — not parsed)
701709

702710
- Angle specifications on arrows
703-
- Partial arrows (top/bottom half)
704711
- Link anchors
705-
- `autoactivate`
706-
- `newpage`
707-
- Complex autonumber formats with `resume`/`inc`
712+
- Complex autonumber formats with `inc`
708713
- `!include` / preprocessor directives
709714
- `skinparam` (style customization)
710715
- `header` / `footer` / `caption`
@@ -752,37 +757,51 @@ Each element type consumes vertical space:
752757
- Diagram type detection
753758
- No-wrap mode (wrapInDocument=false, wrapInGroup=false)
754759

755-
### Test Gaps
760+
### Test Gaps (unit tests in test.js)
756761

757-
- No tests for exo arrows parsing
758-
- No tests for multicast parsing
759-
- No tests for `hnote`/`rnote` style parsing
760-
- No tests for note across
761-
- No tests for note on arrow
762-
- No tests for `create` (standalone or inline `**`)
763-
- No tests for color modifiers on arrows (`-[#red]>`)
764-
- No tests for participant ordering
765-
- No tests for combined activation specs (`++--`, `--++`)
766-
- No tests for `autonumber stop`/`resume`
767-
- No tests for ref multi-line
768-
- No tests that verify emitter output geometry/positions
769-
- No tests that verify z-order in output
762+
- No unit tests for exo arrows parsing
763+
- No unit tests for multicast parsing
764+
- No unit tests for `hnote`/`rnote` style parsing
765+
- No unit tests for note across
766+
- No unit tests for note on arrow
767+
- No unit tests for `create` (standalone or inline `**`)
768+
- No unit tests for color modifiers on arrows (`-[#red]>`)
769+
- No unit tests for participant ordering
770+
- No unit tests for combined activation specs (`++--`, `--++`)
771+
- No unit tests for `autonumber stop`/`resume`
772+
- No unit tests for ref multi-line
773+
- No unit tests that verify emitter output geometry/positions
774+
- No unit tests that verify z-order in output
770775

771-
### Visual Test (generate-comprehensive-test.js)
776+
Note: Most of the above are covered in `comprehensive.puml` for visual testing but lack programmatic assertions in `test.js`.
777+
778+
### Visual Test (comprehensive.puml)
772779

773780
The comprehensive test `.puml` exercises every feature in one diagram:
774781
- All 8 participant types + alias + box grouping
782+
- Participant modifiers: `order`, stereotype (`<<service>>`), color (`#LightGreen`)
775783
- Arrow types: `->`, `-->`, `->>`, `-->>`, `<-`, `<--`, `<->`, `->x`, `o->`, `o->o`, `x->`
784+
- Half-arrows: `-\` (top), `-/` (bottom)
785+
- Arrow inline styles: `[#blue]`, `[#red]`, `[dashed]`, `[dotted]`, `[hidden]`
786+
- Multi-line message labels (`\n`)
776787
- Self message
788+
- Multicast messages (`Alice -> Bob & Controller & DB`)
789+
- Parallel messages (`& Alice -> Controller`)
777790
- Dividers between sections
778-
- Explicit activate/deactivate
779-
- Inline `++`, `--`, `++--`
780-
- Create + destroy lifecycle
791+
- Explicit activate/deactivate (including colored: `activate Bob #salmon`)
792+
- Inline `++`, `--`, `++--`, `--++`, `++ #gold` (with color)
793+
- Inline create `**` and destroy `!!`
794+
- Create + destroy lifecycle (explicit `create`/`destroy` keywords)
781795
- Return keyword
782-
- All fragment types: alt/else, loop, opt, par, break, critical, group, nested
783-
- Notes: right, left, over, over-two, multi-line, across, hnote, rnote, on-arrow
784-
- Delay, HSpace, Reference
785-
- Autonumber (start/stop)
796+
- `autoactivate on/off`
797+
- All fragment types: alt/else, alt/else/also, loop, opt, par (with else branches), break, critical, group, partition, nested
798+
- Colored fragments: `alt #LightPink ... else #LightGreen`
799+
- Notes: right, left, over, over-two, multi-line, across, hnote, rnote, on-arrow (right and left)
800+
- Exogenous (boundary) messages: `[->`, `->]`, `[<-`, `<-]`, `]->`, dotted variants
801+
- Delay (with and without label), HSpace, Reference
802+
- Autonumber: start/stop, start+increment (`autonumber 10 5`), resume
803+
- `newpage` (creates second page)
804+
- `hide footbox`
786805
- Messages to every participant type
787806
- Colored arrow
788807
- Box grouping with color

plantuml-to-drawio/tests/sequence/comprehensive.puml

Lines changed: 128 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,15 @@ collections LogList
1414
' ── Participant with alias and ordering ──
1515
participant "Long Display Name" as LDN
1616

17+
' ── Participant with explicit order ──
18+
participant Zed order 99
19+
20+
' ── Participant with stereotype ──
21+
participant Styled <<service>>
22+
23+
' ── Participant with color ──
24+
participant Colored #LightGreen
25+
1726
' ── Box grouping ──
1827
box "Internal Services" #LightBlue
1928
participant SvcA
@@ -39,9 +48,26 @@ Alice o-> Bob : circle start (o->)
3948
Alice o->o Bob : circle both (o->o)
4049
Alice x-> Bob : cross start (x->)
4150

51+
' ── Half-arrow (top/bottom part) ──
52+
Alice -\ Bob : top half (-\)
53+
Alice -/ Bob : bottom half (-/)
54+
4255
' ── Self message ──
4356
Alice -> Alice : self call
4457

58+
' ── Multicast (message to multiple participants) ──
59+
Alice -> Bob & Controller & DB : multicast message
60+
61+
' ── Arrow with inline style ──
62+
Alice -[#blue]> Bob : blue arrow
63+
Alice -[#red]-> Bob : red dotted arrow
64+
Alice -[dashed]-> Bob : dashed style
65+
Alice -[dotted]-> Bob : dotted style
66+
Alice -[hidden]-> Bob : hidden arrow
67+
68+
' ── Multi-line message label ──
69+
Alice -> Bob : first line\nsecond line
70+
4571
' ── Divider ──
4672
== Section: Activation & Lifecycle ==
4773

@@ -55,14 +81,36 @@ deactivate Controller
5581
Bob --> Alice : response
5682
deactivate Bob
5783

84+
' ── Activate with color ──
85+
Alice -> Bob : colored activation
86+
activate Bob #salmon
87+
88+
Bob --> Alice : done
89+
deactivate Bob
90+
5891
' ── Inline activation (++ / --) ──
5992
Alice -> Bob ++ : inline activate
6093
Bob --> Alice -- : inline deactivate
6194

95+
' ── Inline activation with color ──
96+
Alice -> Bob ++ #gold : inline activate colored
97+
Bob --> Alice -- : inline deactivate
98+
6299
' ── Combined inline (++--) ──
63100
Alice -> Bob ++-- : activate target, deactivate source
64101

65-
' ── Create and destroy ──
102+
' ── Combined inline (--++) ──
103+
Alice -> Bob --++ : deactivate source, activate target
104+
Bob --> Alice -- : back
105+
106+
' ── Inline destroy (!!) ──
107+
Alice -> Bob ++ : doSomething()
108+
Bob --> Alice -- : done
109+
create Zed
110+
Alice -> Zed ** : create via arrow
111+
Alice -> Zed !! : destroy via arrow
112+
113+
' ── Create and destroy (explicit) ──
66114
create UserEntity
67115
Alice -> UserEntity : new()
68116
Alice -> UserEntity : use()
@@ -72,6 +120,12 @@ destroy UserEntity
72120
Alice -> Bob ++ : doWork()
73121
return result
74122

123+
' ── Autoactivate ──
124+
autoactivate on
125+
Alice -> Bob : auto-activated call
126+
Bob --> Alice : auto-deactivated return
127+
autoactivate off
128+
75129
== Section: Fragments ==
76130

77131
' ── Alt / else ──
@@ -81,6 +135,22 @@ else failure case
81135
Alice -> Bob : error path
82136
end
83137

138+
' ── Alt with multiple else (also) ──
139+
alt case A
140+
Alice -> Bob : path A
141+
else case B
142+
Alice -> Bob : path B
143+
also case C
144+
Alice -> Bob : path C
145+
end
146+
147+
' ── Colored grouping ──
148+
alt #LightPink success
149+
Alice -> Bob : colored fragment
150+
else #LightGreen failure
151+
Alice -> Bob : colored else
152+
end
153+
84154
' ── Loop ──
85155
loop 10 times
86156
Alice -> Bob : repeated call
@@ -91,11 +161,10 @@ opt optional step
91161
Alice -> Controller : maybe
92162
end
93163

94-
' ── Par ──
164+
' ── Par with else branches ──
95165
par parallel A
96166
Alice -> Bob : branch A
97-
end
98-
par parallel B
167+
else parallel B
99168
Alice -> Controller : branch B
100169
end
101170

@@ -118,6 +187,11 @@ group custom label
118187
Alice -> Bob : inside group
119188
end
120189

190+
' ── Partition ──
191+
partition processing
192+
Alice -> Bob : in partition
193+
end
194+
121195
' ── Nested fragments ──
122196
alt outer
123197
loop inner
@@ -155,11 +229,39 @@ rnote right of Bob : Rounded note
155229
Alice -> Bob : annotated message
156230
note right : Arrow annotation
157231

232+
' ── Note on arrow left side ──
233+
Alice -> Bob : another annotated
234+
note left : Left arrow note
235+
236+
== Section: Exogenous Messages ==
237+
238+
' ── Incoming from left boundary ──
239+
[-> Alice : from left
240+
[-> Bob : from left to Bob
241+
242+
' ── Outgoing to right boundary ──
243+
Alice ->] : to right
244+
Bob ->] : Bob to right
245+
246+
' ── Incoming from right boundary ──
247+
Alice <-] : from right
248+
]-> Alice : from right alt syntax
249+
250+
' ── Outgoing to left boundary ──
251+
[<- Alice : to left
252+
253+
' ── Dotted exogenous ──
254+
[--> Alice : dotted from left
255+
Alice -->] : dotted to right
256+
158257
== Section: Other Elements ==
159258

160259
' ── Delay ──
161260
... waiting ...
162261

262+
' ── Delay without label ──
263+
...
264+
163265
' ── HSpace ──
164266
||20||
165267

@@ -173,6 +275,23 @@ Alice -> Bob : numbered 2
173275
Alice -> Bob : numbered 3
174276
autonumber stop
175277

278+
' ── Autonumber with start and increment ──
279+
autonumber 10 5
280+
Alice -> Bob : numbered 10
281+
Alice -> Bob : numbered 15
282+
283+
' ── Autonumber resume ──
284+
autonumber resume
285+
Alice -> Bob : resumed
286+
287+
autonumber stop
288+
289+
' ── Newpage ──
290+
newpage Second page
291+
292+
' ── Show/hide footbox ──
293+
hide footbox
294+
176295
' ── Messages to all participant types ──
177296
Alice -> FrontEnd : to boundary
178297
Alice -> Controller : to control
@@ -187,4 +306,8 @@ SvcA -> SvcB : internal
187306
' ── Arrow with color ──
188307
Alice -[#red]> Bob : red arrow
189308

190-
@enduml
309+
' ── Parallel messages ──
310+
Alice -> Bob : first parallel
311+
& Alice -> Controller : second parallel
312+
313+
@enduml

0 commit comments

Comments
 (0)