Skip to content

Commit 87e2cdd

Browse files
committed
fix Layout.init not setting selections, add selection combine test
1 parent 1042e9a commit 87e2cdd

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

src/Plotly.NET/Layout/Layout.fs

+1
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,7 @@ type Layout() =
224224
?IcicleColorWay = IcicleColorWay,
225225
?Annotations = Annotations,
226226
?Shapes = Shapes,
227+
?Selections = Selections,
227228
?Images = Images,
228229
?Sliders = Sliders,
229230
?UpdateMenus = UpdateMenus

tests/Plotly.NET.Tests/ChartAPIs/Combine.fs

+11-2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ let testAnnotations2 = [Annotation.init(Text = "another one")]
1313
let testShapes1 = [Shape.init(X0 = 42)]
1414
let testShapes2 = [Shape.init(X0 = 69)]
1515

16+
let testSelections1 = [Selection.init(X0 = 42)]
17+
let testSelections2 = [Selection.init(X0 = 69)]
18+
1619
let testImages1 = [LayoutImage.init(Name = "image1")]
1720
let testImages2 = [LayoutImage.init(Name = "image2")]
1821

@@ -30,7 +33,8 @@ let chart1 =
3033
Shapes = testShapes1,
3134
Images = testImages1,
3235
Sliders = testSliders1,
33-
HiddenLabels = testHiddenLabels1
36+
HiddenLabels = testHiddenLabels1,
37+
Selections = testSelections1
3438
)
3539
)
3640

@@ -42,7 +46,8 @@ let chart2 =
4246
Shapes = testShapes2,
4347
Images = testImages2,
4448
Sliders = testSliders2,
45-
HiddenLabels = testHiddenLabels2
49+
HiddenLabels = testHiddenLabels2,
50+
Selections = testSelections2
4651
)
4752
)
4853

@@ -72,6 +77,10 @@ let ``Chart.Combine layouts tests`` =
7277
testCase "should combine hidden labels" (fun _ ->
7378
let actual = combined |> GenericChart.getLayout |> fun l -> l?hiddenlabels |> unbox<seq<string>>
7479
Expect.sequenceEqual actual (Seq.append testHiddenLabels1 testHiddenLabels2) "combined chart layout did not contain correct hidden labels"
80+
)
81+
testCase "should combine selections" (fun _ ->
82+
let actual = combined |> GenericChart.getLayout |> fun l -> l?("selections") |> unbox<seq<Selection>>
83+
Expect.sequenceEqual actual (Seq.append testSelections1 testSelections2) "combined chart layout did not contain correct selections"
7584
)
7685
]
7786
]

0 commit comments

Comments
 (0)