Skip to content

Commit c849e78

Browse files
committed
Move SimpleCharts tests into the respective ChartAPI based modules
1 parent 3d5cdd8 commit c849e78

4 files changed

Lines changed: 473 additions & 235 deletions

File tree

tests/CoreTests/CoreTests/CoreTests.fsproj

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
<EmbeddedResource Include="..\..\..\src\Plotly.NET\plotly-2.19.1.min.js.LICENSE.txt" />
1313
<!--Test charts-->
1414
<Compile Include="HTMLCodegen\Chart2D.fs" />
15+
<Compile Include="HtmlCodegen\ChartDomain.fs" />
1516
<!--HTMLCodegen-->
1617

1718
<Compile Include="ChartAPIs\WithAxis.fs" />
@@ -27,7 +28,6 @@
2728
<Compile Include="Traces\TraceID.fs" />
2829
<Compile Include="HtmlCodegen\SimpleTests.fs" />
2930
<Compile Include="HtmlCodegen\ChartLayout.fs" />
30-
<Compile Include="HtmlCodegen\SimpleCharts.fs" />
3131
<Compile Include="HtmlCodegen\Charts3D.fs" />
3232
<Compile Include="HtmlCodegen\DistributionCharts.fs" />
3333
<Compile Include="HtmlCodegen\GeoMapCharts.fs" />
@@ -42,8 +42,6 @@
4242
<Compile Include="Main.fs" />
4343
</ItemGroup>
4444

45-
<ItemGroup />
46-
4745
<ItemGroup>
4846
<PackageReference Include="Deedle" Version="2.4.1" />
4947
<PackageReference Include="Expecto" Version="9.*" />

tests/CoreTests/CoreTests/HTMLCodegen/Chart2D.fs

Lines changed: 324 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
module CoreTests.HTMLCodegen.ChartDomain
2+
3+
open Expecto
4+
open Plotly.NET
5+
open Plotly.NET.LayoutObjects
6+
open Plotly.NET.TraceObjects
7+
open Plotly.NET.GenericChart
8+
9+
open TestUtils.HtmlCodegen
10+
open ChartDomainTestCharts
11+
12+
module Pie =
13+
[<Tests>]
14+
let ``Pie chart HTML codegeneration tests`` =
15+
testList "HTMLCodegen.ChartDomain" [
16+
testList "Pie" [
17+
testCase "Pie data" ( fun () ->
18+
"""var data = [{"type":"pie","values":[19,26,55],"labels":["Residential","Non-Residential","Utility"],"marker":{"line":{}}}];"""
19+
|> chartGeneratedContains Pie.``Simple pie chart``
20+
);
21+
testCase "Pie layout" ( fun () ->
22+
emptyLayout Pie.``Simple pie chart``
23+
);
24+
testCase "Pie styled data" ( fun () ->
25+
"""var data = [{"type":"pie","values":[19,26,55],"labels":["Residential","Non-Residential","Utility"],"pull":[0.0,0.3,0.0],"text":["Some","More","Stuff"],"textposition":["inside","outside","inside"],"marker":{"colors":["rgba(0, 255, 255, 1.0)","rgba(250, 128, 114, 1.0)","rgba(210, 180, 140, 1.0)"],"line":{"color":"rgba(0, 0, 0, 1.0)","width":2.0}},"rotation":45.0}];"""
26+
|> chartGeneratedContains Pie.``Styled pie chart``
27+
);
28+
testCase "Pie styled layout" ( fun () ->
29+
emptyLayout Pie.``Styled pie chart``
30+
);
31+
]
32+
]
33+
34+
module Doughnut =
35+
[<Tests>]
36+
let ``Doughnut chart HTML codegeneration tests`` =
37+
testList "HTMLCodegen.ChartDomain" [
38+
testList "Doughnut" [
39+
testCase "Doughnut data" ( fun () ->
40+
"""var data = [{"type":"pie","values":[19,26,55],"labels":["Residential","Non-Residential","Utility"],"text":["Residential","Non-Residential","Utility"],"marker":{"line":{}},"hole":0.3}];"""
41+
|> chartGeneratedContains Doughnut.``Simple doughnut chart``
42+
);
43+
testCase "Doughnut layout" ( fun () ->
44+
emptyLayout Doughnut.``Simple doughnut chart``
45+
);
46+
]
47+
]
48+
49+
module FunnelArea =
50+
[<Tests>]
51+
let ``FunnelArea chart HTML codegeneration tests`` =
52+
testList "HTMLCodegen.ChartDomain" [
53+
testList "FunnelArea" [
54+
]
55+
]
56+
57+
module Sunburst =
58+
[<Tests>]
59+
let ``Sunburst chart HTML codegeneration tests`` =
60+
testList "HTMLCodegen.ChartDomain" [
61+
testList "Sunburst" [
62+
]
63+
]
64+
65+
module Treemap =
66+
[<Tests>]
67+
let ``Treemap chart HTML codegeneration tests`` =
68+
testList "HTMLCodegen.ChartDomain" [
69+
testList "Treemap" [
70+
]
71+
]
72+
73+
module ParralelCoord =
74+
[<Tests>]
75+
let ``ParralelCoord chart HTML codegeneration tests`` =
76+
testList "HTMLCodegen.ChartDomain" [
77+
testList "ParralelCoord" [
78+
]
79+
]
80+
81+
module ParralelCategories =
82+
[<Tests>]
83+
let ``ParralelCategories chart HTML codegeneration tests`` =
84+
testList "HTMLCodegen.ChartDomain" [
85+
testList "ParralelCategories" [
86+
]
87+
]
88+
89+
module Sankey =
90+
[<Tests>]
91+
let ``Sankey chart HTML codegeneration tests`` =
92+
testList "HTMLCodegen.ChartDomain" [
93+
testList "Sankey" [
94+
]
95+
]
96+
97+
module Table =
98+
[<Tests>]
99+
let ``Table chart HTML codegeneration tests`` =
100+
testList "HTMLCodegen.ChartDomain" [
101+
testList "Table" [
102+
testCase "First table data" ( fun () ->
103+
"""var data = [{"type":"table","cells":{"fill":{},"line":{},"values":[["0","1"],["I","little"],["am","example"],["a","!"]]},"header":{"fill":{},"line":{},"values":["<b>RowIndex</b>","A","simple","table"]}}];"""
104+
|> chartGeneratedContains Table.``Simple table chart``
105+
);
106+
testCase "First table layout" ( fun () ->
107+
emptyLayout Table.``Simple table chart``
108+
);
109+
testCase "Styled table data" ( fun () ->
110+
"""var data = [{"type":"table","columnorder":[1,2,3,4],"columnwidth":[70.0,50.0,100.0,70.0],"cells":{"align":["left","center","right"],"fill":{"color":["#deebf7","lightgrey","#deebf7","lightgrey"]},"line":{},"values":[["0","1"],["I","little"],["am","example"],["a","!"]]},"header":{"align":"center","fill":{"color":"#45546a"},"height":30,"line":{"color":"black","width":2.0},"values":["<b>RowIndex</b>","A","simple","table"]}}];"""
111+
|> chartGeneratedContains Table.``Styled table chart``
112+
);
113+
testCase "Styled table layout" ( fun () ->
114+
emptyLayout Table.``Styled table chart``
115+
);
116+
testCase "Color dependent chart data" ( fun () ->
117+
"""var data = [{"type":"table","cells":{"fill":{"color":[["white","white","white","white","white","white","white"],["rgba(255, 255, 0, 1.0)","rgba(255, 245, 10, 1.0)","rgba(255, 204, 51, 1.0)","rgba(255, 204, 51, 1.0)","rgba(255, 153, 102, 1.0)","rgba(255, 148, 107, 1.0)","rgba(255, 26, 229, 1.0)"],["rgba(255, 250, 5, 1.0)","rgba(255, 153, 102, 1.0)","rgba(255, 174, 81, 1.0)","rgba(255, 215, 40, 1.0)","rgba(255, 153, 102, 1.0)","rgba(255, 153, 102, 1.0)","rgba(255, 102, 153, 1.0)"],["rgba(255, 240, 15, 1.0)","rgba(255, 51, 204, 1.0)","rgba(255, 164, 91, 1.0)","rgba(255, 179, 76, 1.0)","rgba(255, 148, 107, 1.0)","rgba(255, 164, 91, 1.0)","rgba(255, 153, 102, 1.0)"],["rgba(255, 245, 10, 1.0)","rgba(255, 0, 255, 1.0)","rgba(255, 143, 112, 1.0)","rgba(255, 220, 35, 1.0)","rgba(255, 159, 96, 1.0)","rgba(255, 148, 107, 1.0)","rgba(255, 128, 127, 1.0)"]]},"line":{},"values":[[10004.0,10001.0,10005.0,10006.0,10007.0,10002.0,10003.0],[0.0,0.2,1.0,1.0,2.0,2.1,4.5],[0.1,2.0,1.6,0.8,2.0,2.0,3.0],[0.3,4.0,1.8,1.5,2.1,1.8,2.0],[0.2,5.0,2.2,0.7,1.9,2.1,2.5]]},"header":{"fill":{},"line":{},"values":["Identifier","T0","T1","T2","T3"]}}];"""
118+
|> chartGeneratedContains Table.``Cell color dependent table chart``
119+
);
120+
testCase "Color dependent chart layout" ( fun () ->
121+
emptyLayout Table.``Cell color dependent table chart``
122+
);
123+
testCase "Sequence presentation table data" ( fun () ->
124+
"""var data = [{"type":"table","columnwidth":[50.0,10.0],"cells":{"align":["right","center"],"fill":{"color":[["white","white","white","white","white"],["#5050FF","#5050FF","#00C000","#5050FF","white"],["#E6E600","#E00000","#E6E600","#E00000","white"],["#00C000","#00C000","#E00000","#00C000","white"],["#5050FF","#E6E600","#00C000","#E6E600","white"],["#00C000","#E00000","#5050FF","#E00000","white"],["#5050FF","#00C000","#E6E600","#00C000","white"],["#E00000","#5050FF","#5050FF","#5050FF","white"],["#00C000","#E6E600","#00C000","#E6E600","white"],["#E6E600","#5050FF","#5050FF","#5050FF","white"],["#E00000","#00C000","#E00000","#00C000","white"],["#00C000","#5050FF","#00C000","#5050FF","white"],["#5050FF","#E00000","#E6E600","#E00000","white"],["#00C000","#00C000","#E00000","#E00000","white"],["#5050FF","#E6E600","#00C000","#00C000","white"],["#E00000","#E00000","#5050FF","#E6E600","white"],["#E6E600","#00C000","#E6E600","#5050FF","white"],["#00C000","#5050FF","#5050FF","#00C000","white"],["#5050FF","#E6E600","#00C000","#5050FF","white"],["#E6E600","#5050FF","#5050FF","#E00000","white"],["#5050FF","#00C000","#00C000","#00C000","white"],["#00C000","#5050FF","#5050FF","#E6E600","white"],["#5050FF","#00C000","#E6E600","#E00000","white"],["#E00000","#E6E600","#5050FF","#00C000","white"],["#00C000","#5050FF","#00C000","#5050FF","white"],["#E6E600","#E6E600","#5050FF","#E6E600","white"],["#E00000","#5050FF","#E00000","#5050FF","white"],["#00C000","#00C000","#00C000","#00C000","white"],["#5050FF","#5050FF","#E6E600","#5050FF","white"],["#E6E600","#E00000","#E00000","#E00000","white"],["#5050FF","#E00000","#00C000","#00C000","white"],["#00C000","#00C000","#5050FF","#E6E600","white"],["#5050FF","#E6E600","#E6E600","#E00000","white"],["#E00000","#00C000","#5050FF","#00C000","white"],["#00C000","#5050FF","#00C000","#5050FF","white"],["#E6E600","#E6E600","#5050FF","#E6E600","white"],["#E00000","#5050FF","#E00000","#5050FF","white"],["#00C000","#00C000","#E00000","#00C000","white"],["#5050FF","#5050FF","#00C000","#5050FF","white"],["#E6E600","#E00000","#E6E600","#E00000","white"],["#5050FF","#00C000","#5050FF","#E00000","white"],["#00C000","#E6E600","#E6E600","#00C000","white"],["#5050FF","#E00000","#5050FF","#E6E600","white"],["#E00000","#00C000","#00C000","white"],["#E00000","#5050FF","#5050FF","white"],["#00C000","#00C000","#5050FF","white"],["#5050FF","#5050FF","#00C000","white"],["#E6E600","#5050FF","#5050FF","white"],["#5050FF","#00C000","#E00000","white"],["#00C000","#5050FF","#00C000","white"],["#5050FF","#E00000","#E6E600","white"],["#E00000","#00C000","#E00000","white"],["#E6E600","#E6E600","#00C000","white"],["#E00000","#E00000","#5050FF","white"],["#00C000","#00C000","#E6E600","white"],["#E6E600","#5050FF","#5050FF","white"],["#00C000","#E6E600","#00C000","white"],["#5050FF","#5050FF","#5050FF","white"],["#E6E600","#00C000","#E6E600","white"],["#5050FF","#5050FF","#5050FF","white"],["#00C000","#E00000","#00C000","white"]]},"height":20,"line":{"color":"white","width":0.0},"values":[["0","60","120","180"],["A","A","G","A"],["T","C","T","C"],["G","G","C","G"],["A","T","G","T"],["G","C","A","C"],["A","G","T","G"],["C","A","A","A"],["G","T","G","T"],["T","A","A","A"],["C","G","C","G"],["G","A","G","A"],["A","C","T","C"],["G","G","C","C"],["A","T","G","G"],["C","C","A","T"],["T","G","T","A"],["G","A","A","G"],["A","T","G","A"],["T","A","A","C"],["A","G","G","G"],["G","A","A","T"],["A","G","T","C"],["C","T","A","G"],["G","A","G","A"],["T","T","A","T"],["C","A","C","A"],["G","G","G","G"],["A","A","T","A"],["T","C","C","C"],["A","C","G","G"],["G","G","A","T"],["A","T","T","C"],["C","G","A","G"],["G","A","G","A"],["T","T","A","T"],["C","A","C","A"],["G","G","C","G"],["A","A","G","A"],["T","C","T","C"],["A","G","A","C"],["G","T","T","G"],["A","C","A","T"],["C","G","G"],["C","A","A"],["G","G","A"],["A","A","G"],["T","A","A"],["A","G","C"],["G","A","G"],["A","C","T"],["C","G","C"],["T","T","G"],["C","C","A"],["G","G","T"],["T","A","A"],["G","T","G"],["A","A","A"],["T","G","T"],["A","A","A"],["G","C","G"]]},"header":{"fill":{},"line":{"color":"white","width":0.0},"values":["","","","","","","","","","","|","","","","","","","","","","|","","","","","","","","","","|","","","","","","","","","","|","","","","","","","","","","|","","","","","","","","","","|"]}}];"""
125+
|> chartGeneratedContains Table.``Sequence representation table chart``
126+
);
127+
testCase "Sequence presentation table layout" ( fun () ->
128+
"var layout = {\"width\":650,\"title\":{\"text\":\"Sequence A\"}};"
129+
|> chartGeneratedContains Table.``Sequence representation table chart``
130+
);
131+
]
132+
]
133+
134+
module Indicator =
135+
[<Tests>]
136+
let ``Indicator chart HTML codegeneration tests`` =
137+
testList "HTMLCodegen.ChartDomain" [
138+
testList "Indicator" [
139+
]
140+
]
141+
142+
module Icicle =
143+
[<Tests>]
144+
let ``Icicle chart HTML codegeneration tests`` =
145+
testList "HTMLCodegen.ChartDomain" [
146+
testList "Icicle" [
147+
]
148+
]

0 commit comments

Comments
 (0)