-
Notifications
You must be signed in to change notification settings - Fork 16
/
testrunner.html
275 lines (268 loc) · 19.5 KB
/
testrunner.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
<!-- Copy Paste the index.html code as-is and include the Mocha Chai components at the end of the file below -->
<!DOCTYPE html>
<meta charset="utf-8">
<head>
<title>d3-molecule</title>
<link rel="shortcut icon" type="image/png" href="assets/favicon.png" />
<script src="node_modules/jquery/dist/jquery.min.js"></script>
<link href="node_modules/jquery-ui-dist/jquery-ui.min.css" rel="stylesheet">
<link href="node_modules/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet">
<link href="node_modules/bootstrap/dist/css/bootstrap-theme.min.css" rel="stylesheet">
<script src="node_modules/bootstrap/dist/js/bootstrap.min.js"></script>
<script src="node_modules/jquery-ui-dist/jquery-ui.min.js"></script>
<link rel="stylesheet" href="lib/font-awesome-4.7.0/css/font-awesome.min.css">
<script src="node_modules/blueimp-canvas-to-blob/js/canvas-to-blob.min.js"></script>
<script src="node_modules/file-saver/FileSaver.min.js"></script>
<script src="node_modules/d3/d3.min.js"></script>
<link href="dist/css/Molecule.css" rel="stylesheet">
</head>
<body>
<div class="container-fluid">
<div id="header">
<div style="margin-top:16px;margin-bottom:16px;">
<a href="#" class="navbar-left"><img src="assets/logo-md.png" class="img img-responsive" width="50"></a><span style="font-size:32px;">d3-molecule</span>
</div>
<div id="content">
<ul id="tabs" class="nav nav-tabs" data-tabs="tabs">
<li class="active"><a href="#moleculeConfig" data-toggle="tab">Molecule</a></li>
<li><a href="#atomConfig" data-toggle="tab">Atom</a></li>
<li><a href="#bondConfig" data-toggle="tab">Bond</a></li>
<li><a href="#canvasConfig" data-toggle="tab">Canvas</a></li>
<li><a href="#molecularForceConfig" data-toggle="tab">Molecular Forces</a></li>
</ul>
<div id="my-tab-content" class="tab-content">
<div class="tab-pane active" id="moleculeConfig">
<br>
<form class="form-inline">
<div class="form-group">
<select class="form-control " id="MoleculeId"></select>
<input type="button" class="btn btn-lg btn-default fa" id='new' onclick="newMolecule()" title="add new molecule" value="">
<input type="button" class="btn btn-lg btn-default fa" id='refresh' onclick="refreshMolecule()" title="refresh molecule" value="">
<input type="button" class="btn btn-lg btn-default fa" id='recycle' onclick="recycleMolecule()" title="recycle molecule" value="">
<input type="button" class="btn btn-lg btn-default fa" id='delete' onclick="deleteMolecule()" title="delete molecule" value="">
<input type="button" class="btn btn-lg btn-default fa" id='save' onclick="exportSvgAsPNG()" title="export molecule as png" value="">
<div class="input-group">
<span class="input-group-addon">Filename</span>
<input style="width:75px" id="filename" type="text" class="form-control" placeholder="text">
</div>
</div>
</form>
</div>
<div class="tab-pane" id="atomConfig">
<div class="panel-body">
<form class="form-inline">
<div class="form-group">
<select class="form-control " id="Atom"></select>
<select id="Charge" class="form-control">
<option value="" selected>No Charge</option>
<option value="+">Positive</option>
<option value="-">Negative</option>
</select>
<div class="input-group">
<span class="input-group-addon"># Charge</span>
<input style="width:75px" id="noOfCharges" type="number" class="form-control" min=1 value=1 placeholder="number">
</div>
<input type="button" class="btn btn-lg btn-default fa" id="addNode" onclick="addNewNode()" title="add atom" value="">
</div>
</form>
<br>
<form class="form-inline">
<div class="form-group">
<div class="input-group">
<span class="input-group-addon">Node Id</span>
<input style="width:75px" id="nodeId" type="number" class="form-control" min=0 placeholder="num">
</div>
<input type="button" class="btn btn-lg btn-default fa" id='removeNode' onclick="removeExistingNode()" value="" title="remove atom">
<input type="button" class="btn btn-lg btn-default fa" id="hideNodeID" onclick="hideNode()" value="" title="hide atom">
<input type="button" class="btn btn-lg btn-default fa" id="showNodeID" onclick="showNode()" value="" title="show atom">
<input type="button" class="btn btn-lg btn-default fa fa-icon" id="fixAtom" onclick="fixNode()" value="" title="fix atom">
<input type="button" class="btn btn-lg btn-default fa fa-icon" id="unfixAtom" onclick="unfixNode()" value="" title="unfix atom">
<input type="button" class="btn btn-lg btn-default fa" id='removeAllNodes' onclick="removeNodes()" value=" All" title="remove all atoms and links">
<input type="button" class="btn btn-lg btn-default fa" id="hideNodesID" onclick="hideNodes()" value=" All" title="hide all atoms">
<input type="button" class="btn btn-lg btn-default fa" id="showNodesID" onclick="showNodes()" value=" All" title="show all atoms">
<input type="button" class="btn btn-lg btn-default fa" id="fixAllAtoms" onclick="fixAllNodes()" value=" All" title="fix all atoms">
<input type="button" class="btn btn-lg btn-default fa" id="unfixAllAtoms" onclick="unfixAllNodes()" value=" All" title="unfix all atoms">
</div>
</form>
<br>
<form class="form-inline">
<div class="form-group">
<div class="input-group">
<span class="input-group-addon">Size Basis</span>
<select id="atomSizeBasis" class="form-control ">
<option value="Atomic Weight" selected>Atomic Weight</option>
<option value="Atomic Radius">Atomic Radius</option>
</select>
</div>
<div class="input-group">
<span class="input-group-addon">Max Radius</span>
<input style="width:75px" id="maxAtomRadius" type="number" value=6 min=1 class="form-control " placeholder="pixels">
</div>
<div class="input-group">
<span class="input-group-addon">Text Color</span>
<input style="width:75px" id="atomTextColor" type="color" value="#000000" class="form-control " placeholder="text">
</div>
<div class="input-group">
<span class="input-group-addon">Border Thickness</span>
<input style="width:75px" id="atomBorderThickness" type="number" value=1 min=0 class="form-control " placeholder="pixels">
</div>
<div class="input-group">
<span class="input-group-addon">Border Color</span>
<input style="width:75px" id="atomBorderColor" type="color" value="#000000" class="form-control " placeholder="text">
</div>
</div>
</form>
</div>
</div>
<div class="tab-pane" id="bondConfig">
<div class="panel-body">
<form class="form-inline">
<div class="form-group">
<div class="input-group">
<span class="input-group-addon">Source Id</span>
<input style="width:75px" id="linkSourceId" type="number" class="form-control" min=0 placeholder="num">
</div>
<div class="input-group">
<span class="input-group-addon">Target Id</span>
<input style="width:75px" id="linkTargetId" type="number" class="form-control" min=0 placeholder="num">
</div>
<div class="input-group">
<span class="input-group-addon">Bond Type</span>
<select id="Bond" class="form-control ">
<option value=1 selected>Single</option>
<option value=2>Double</option>
<option value=3>Triple</option>
<option value=4>Quadruple</option>
<option value=5>Dotted</option>
<option value=6>Dashed (Gradient)</option>
<option value=7>Dashed (Stripe)</option>
<option value=8>Wedged</option>
<option value=9>Wavy</option>
<option value=10>Arc</option>
</select>
</div>
<input type="button" class="btn btn-lg btn-default fa" id='addLink' onclick="addNewLink()" value="" title="add bond">
<input type="button" class="btn btn-lg btn-default fa" id='removeLink' onclick="removeExistingLink()" value="" title="remove bond">
<input type="button" class="btn btn-lg btn-default fa" id='removeAllLinks' onclick="removeLinks()" value=" All" title="remove all bonds">
</div>
<div class="form-group">
<div class="input-group">
<span class="input-group-addon">Thickness</span>
<input style="width:75px" id="bondThickness" type="number" value=2 min=0 class="form-control" placeholder="pixels">
</div>
<div class="input-group">
<span class="input-group-addon">Color</span>
<input style="width:75px" id="bondColor" type="color" value="#000000" class="form-control" placeholder="text">
</div>
</div>
</form>
</div>
</div>
<div class="tab-pane" id="canvasConfig">
<div class="panel-body">
<form class="form-inline">
<div class="form-group">
<div class="input-group">
<span class="input-group-addon"><i class="fa fa-lg fa-arrows-h"></i></span>
<input style="width:75px" id="canvasWidth" type="number" value=300 min=0 class="form-control " placeholder="pixels">
</div>
<div class="input-group">
<span class="input-group-addon"><i class="fa fa-lg fa-arrows-v"></i></span>
<input style="width:75px" id="canvasHeight" type="number" value=300 min=0 class="form-control " placeholder="pixels">
</div>
<div class="input-group">
<span class="input-group-addon">Background</span>
<input style="width:75px" id="canvasBackgroundColor" type="color" value="#ffffff" class="form-control " placeholder="text">
</div>
<div class="input-group">
<span class="input-group-addon">Border Thickness</span>
<input style="width:75px" id="canvasBorderThickness" type="number" value=1 min=0 class="form-control " placeholder="pixels">
</div>
<div class="input-group">
<span class="input-group-addon">Border Radius X</span>
<input style="width:75px" id="canvasBorderRadiusX" type="number" value=15 min=0 class="form-control " placeholder="pixels">
</div>
<div class="input-group">
<span class="input-group-addon">Border Radius Y</span>
<input style="width:75px" id="canvasBorderRadiusY" type="number" value=15 min=0 class="form-control " placeholder="pixels">
</div>
<div class="input-group">
<span class="input-group-addon">Border Color</span>
<input style="width:75px" id="canvasBorderColor" type="color" value="#000000" class="form-control " placeholder="text">
</div>
<div class="form-control ">
<div class="checkbox-inline">
<label>
<input id="canvasAsBoundingBox" type="checkbox" checked>Bounding Box</label>
</div>
</div>
</div>
</form>
</div>
</div>
<div class="tab-pane" id="molecularForceConfig">
<div class="panel-body">
<form class="form-inline">
<div class="form-group">
<div class="input-group">
<span class="input-group-addon"><i class="fa fa-sm fa-magnet"></i> Charge</span>
<input style="width:75px" id="charge" type="number" value=-1000 class="form-control " placeholder="pixels">
</div>
<div class="input-group">
<span class="input-group-addon"><i class="fa fa-sm fa-magnet"></i> Friction</span>
<input style="width:75px" id="friction" type="number" value=0.9 class="form-control " placeholder="pixels">
</div>
<div class="input-group">
<span class="input-group-addon"><i class="fa fa-sm fa-grav"></i> Gravity</span>
<input style="width:75px" id="gravity" type="number" value=0.1 class="form-control " placeholder="pixels">
</div>
<div class="input-group">
<span class="input-group-addon"><i class="fa fa-sm fa-magnet"></i> Theta</span>
<input style="width:75px" id="theta" type="number" value=0.8 class="form-control " placeholder="pixels">
</div>
<div class="input-group">
<span class="input-group-addon"><i class="fa fa-sm fa-magnet"></i> Link Strength</span>
<input style="width:75px" id="linkStrength" type="number" value=1 class="form-control " placeholder="pixels">
</div>
<div class="input-group">
<span class="input-group-addon"><i class="fa fa-sm fa-magnet"></i> Alpha</span>
<input style="width:75px" id="alpha" type="number" value=0.1 class="form-control " placeholder="pixels">
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
<br>
<div class="row" id="container"></div>
</div>
<script type="text/javascript" src="dist/js/Elements.js"></script>
<script type="text/javascript" src="dist/js/Examples.js"></script>
<script type="text/javascript" src="dist/js/Molecule.js"></script>
<script type="text/javascript" src="dist/js/Main.js"></script>
</body>
<script>
fillDropdownWithExamples();
loadPeriodicTableElements();
$('#tabs').tab();
</script>
<!-- Adding Mocha, Chai CSS and JS files. Setting up bdd and the test files. -->
<!-- Executing the Mocha Runner thereafter... -->
<link rel="stylesheet" href="node_modules/mocha/mocha.css">
<div id="mocha"></div>
<script src="node_modules/mocha/mocha.js"></script>
<script src="node_modules/chai/chai.js"></script>
<script src="node_modules/sinon/pkg/sinon.js"></script>
<script src="node_modules/chai-things/lib/chai-things.js"></script>
<script>
mocha.setup('bdd')
</script>
<!-- load your test files here -->
<script src="test/module_test.js"></script>
<script>
mocha.run();
</script>
</body>
</html>