@@ -6,7 +6,7 @@ open Plotly.NET.LayoutObjects
6
6
open Plotly.NET .ConfigObjects
7
7
open DynamicObj
8
8
9
- open TestUtils.LayoutObjects
9
+ open TestUtils.Objects
10
10
11
11
let config =
12
12
Config.init(
@@ -94,4 +94,48 @@ let ``Config json tests`` =
94
94
testCase " globalTransforms" ( fun _ -> config |> jsonFieldIsSetWith " globalTransforms" " \" function(x) => {return x}\" " )
95
95
testCase " locale" ( fun _ -> config |> jsonFieldIsSetWith " locale" " \" de-DE\" " )
96
96
testCase " locales" ( fun _ -> config |> jsonFieldIsSetWith " locales" """ {"yes":"no"}""" )
97
+ ]
98
+
99
+
100
+ let combined =
101
+ Config.combine
102
+ ( Config.init(
103
+ ModeBarButtonsToRemove = [ StyleParam.ModeBarButton.AutoScale2d],
104
+ ModeBarButtonsToAdd = [ StyleParam.ModeBarButton.DrawCircle],
105
+ ModeBarButtons = [[ StyleParam.ModeBarButton.DrawClosedPath; StyleParam.ModeBarButton.DrawOpenPath]]
106
+ ))
107
+ ( Config.init(
108
+ ModeBarButtonsToRemove = [ StyleParam.ModeBarButton.DrawCircle],
109
+ ModeBarButtonsToAdd = [ StyleParam.ModeBarButton.AutoScale2d],
110
+ ModeBarButtons = [[ StyleParam.ModeBarButton.OrbitRotation]]
111
+ ))
112
+
113
+ let expectedCombined =
114
+ Config.init(
115
+ ModeBarButtonsToRemove = [ StyleParam.ModeBarButton.AutoScale2d; StyleParam.ModeBarButton.DrawCircle],
116
+ ModeBarButtonsToAdd = [ StyleParam.ModeBarButton.DrawCircle; StyleParam.ModeBarButton.AutoScale2d],
117
+ ModeBarButtons = [[ StyleParam.ModeBarButton.DrawClosedPath; StyleParam.ModeBarButton.DrawOpenPath];[ StyleParam.ModeBarButton.OrbitRotation]]
118
+ )
119
+
120
+ [<Tests>]
121
+ let ``Config API tests`` =
122
+ testList " ConfigObjects.Config API" [
123
+ testCase " combine ModeBarButtonsToRemove" ( fun _ ->
124
+ Expect.sequenceEqual
125
+ ( combined.TryGetTypedValue< seq< string>>( " modeBarButtonsToRemove" )) .Value
126
+ ( expectedCombined.TryGetTypedValue< seq< string>>( " modeBarButtonsToRemove" )) .Value
127
+ " Config.combine did not return the correct object"
128
+ )
129
+ testCase " combine ModeBarButtonsToAdd" ( fun _ ->
130
+ Expect.sequenceEqual
131
+ ( combined.TryGetTypedValue< seq< string>>( " modeBarButtonsToAdd" )) .Value
132
+ ( expectedCombined.TryGetTypedValue< seq< string>>( " modeBarButtonsToAdd" )) .Value
133
+ " Config.combine did not return the correct object"
134
+ )
135
+ testCase " combine ModeBarButtons" ( fun _ ->
136
+ Expect.sequenceEqual
137
+ ( Seq.concat ( combined.TryGetTypedValue< seq< seq< string>>>( " modeBarButtons" )) .Value)
138
+ ( Seq.concat ( expectedCombined.TryGetTypedValue< seq< seq< string>>>( " modeBarButtons" )) .Value)
139
+ " Config.combine did not return the correct object"
140
+ )
97
141
]
0 commit comments