Skip to content

Commit

Permalink
(gree) Fix bug #55.
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxWilson committed Jan 27, 2024
1 parent 9a4d00b commit 9b7726a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/Core/Menus.fs
Original file line number Diff line number Diff line change
Expand Up @@ -96,15 +96,15 @@ let render (render: 'reactElement RenderApi) (menus: MenuOutput list) =
for (isChecked, key, child) in selections do
let renderChild (label: string, children) =
if isChecked then render.checked'(label, key, children) else render.unchecked(label, key)
let childReact = recur isChecked ((if collapse then collapsedRender key else render), renderChild) child
let childReact = recur (not isChecked) ((if collapse then collapsedRender key else render), renderChild) child
childReact
]
if collapse then
render.combine children
else
renderMe(defaultArg label "Choose one:", children)
| And(label, grants) ->
let childReacts = grants |> List.map (recur true (render, render.unconditional))
let childReacts = grants |> List.map (recur shortCircuit (render, render.unconditional))
match label with
| Some label ->
renderMe(label, childReacts)
Expand Down
10 changes: 6 additions & 4 deletions test/Chargen.Accept.fs
Original file line number Diff line number Diff line change
Expand Up @@ -234,11 +234,13 @@ let units = testList "Unit.Chargen" [
pseudoActual
(Fragment [
Checked("Sword and Dagger", key "Sword and Dagger", [
Unchecked("Rapier +4", key "Sword and Dagger-Rapier")
Unchecked("Broadsword +4", key "Sword and Dagger-Broadsword")
Unchecked("Shortsword +4", key "Sword and Dagger-Shortsword")
Checked("Choose one:", key "Sword and Dagger", [
Unchecked("Rapier +4", key "Sword and Dagger-Rapier")
Unchecked("Broadsword +4", key "Sword and Dagger-Broadsword")
Unchecked("Shortsword +4", key "Sword and Dagger-Shortsword")
])
Checked("Main-gauche +1", key "Sword and Dagger", [])
])
Checked("Main-gauche +1", key "Sword and Dagger", [])
])
]
[<Tests>]
Expand Down

0 comments on commit 9b7726a

Please sign in to comment.