@@ -154,5 +154,125 @@ describe('GReference Object', () => {
154
154
) ;
155
155
} ) ;
156
156
} ) ;
157
+
158
+ describe ( 'Verifying HTML Generation...' , ( ) => {
159
+ it ( 'generates the proper html for a code' , ( ) => {
160
+ const g = new GReference ( ) ;
161
+ const html = g . getCodeAsHTML ( 'G1' , false ) ;
162
+ expect ( html ) . to . equal (
163
+ '<!DOCTYPE html>\n' +
164
+ '<html lang="en"\n' +
165
+ '<head>\n' +
166
+ '<meta charset="utf-8">\n' +
167
+ '</head>\n' +
168
+ '<h1>G1 - Linear Interpolation Motion</h1>\n' +
169
+ '\n' +
170
+ '<h2>Description</h2>\n' +
171
+ '\n' +
172
+ '<p>G01 is used to move machine axes at specified feedrate.</p>\n' +
173
+ '\n' +
174
+ '<h3>Modal: true</h3>\n' +
175
+ '\n' +
176
+ '<h2>Parameters</h2>\n' +
177
+ '\n' +
178
+ '<table>\n' +
179
+ '<thead>\n' +
180
+ '<tr>\n' +
181
+ '<th>Parameter</th>\n' +
182
+ '<th>Description</th>\n' +
183
+ '<th>Optional</th>\n' +
184
+ '</tr>\n' +
185
+ '</thead>\n' +
186
+ '<tbody>\n' +
187
+ '<tr>\n' +
188
+ '<td>X</td>\n' +
189
+ '<td>X-Axis motion command</td>\n' +
190
+ '<td>true\n' +
191
+ '</tr>\n' +
192
+ '<tr>\n' +
193
+ '<td>Y</td>\n' +
194
+ '<td>Y-Axis motion command</td>\n' +
195
+ '<td>true\n' +
196
+ '</tr>\n' +
197
+ '<tr>\n' +
198
+ '<td>Z</td>\n' +
199
+ '<td>Z-Axis motion command</td>\n' +
200
+ '<td>true\n' +
201
+ '</tr>\n' +
202
+ '<tr>\n' +
203
+ '<td>A</td>\n' +
204
+ '<td>A-Axis motion command</td>\n' +
205
+ '<td>true\n' +
206
+ '</tr>\n' +
207
+ '<tr>\n' +
208
+ '<td>B</td>\n' +
209
+ '<td>B-Axis motion command</td>\n' +
210
+ '<td>true\n' +
211
+ '</tr>\n' +
212
+ '<tr>\n' +
213
+ '<td>C</td>\n' +
214
+ '<td>C-Axis motion command</td>\n' +
215
+ '<td>true\n' +
216
+ '</tr>\n' +
217
+ '</html>' ,
218
+ ) ;
219
+ } ) ;
220
+
221
+ it ( 'generates the proper partial html for a code' , ( ) => {
222
+ const g = new GReference ( ) ;
223
+ const html = g . getCodeAsHTML ( 'G1' , true ) ;
224
+ expect ( html ) . to . equal (
225
+ '<h1>G1 - Linear Interpolation Motion</h1>\n' +
226
+ '\n' +
227
+ '<h2>Description</h2>\n' +
228
+ '\n' +
229
+ '<p>G01 is used to move machine axes at specified feedrate.</p>\n' +
230
+ '\n' +
231
+ '<h3>Modal: true</h3>\n' +
232
+ '\n' +
233
+ '<h2>Parameters</h2>\n' +
234
+ '\n' +
235
+ '<table>\n' +
236
+ '<thead>\n' +
237
+ '<tr>\n' +
238
+ '<th>Parameter</th>\n' +
239
+ '<th>Description</th>\n' +
240
+ '<th>Optional</th>\n' +
241
+ '</tr>\n' +
242
+ '</thead>\n' +
243
+ '<tbody>\n' +
244
+ '<tr>\n' +
245
+ '<td>X</td>\n' +
246
+ '<td>X-Axis motion command</td>\n' +
247
+ '<td>true\n' +
248
+ '</tr>\n' +
249
+ '<tr>\n' +
250
+ '<td>Y</td>\n' +
251
+ '<td>Y-Axis motion command</td>\n' +
252
+ '<td>true\n' +
253
+ '</tr>\n' +
254
+ '<tr>\n' +
255
+ '<td>Z</td>\n' +
256
+ '<td>Z-Axis motion command</td>\n' +
257
+ '<td>true\n' +
258
+ '</tr>\n' +
259
+ '<tr>\n' +
260
+ '<td>A</td>\n' +
261
+ '<td>A-Axis motion command</td>\n' +
262
+ '<td>true\n' +
263
+ '</tr>\n' +
264
+ '<tr>\n' +
265
+ '<td>B</td>\n' +
266
+ '<td>B-Axis motion command</td>\n' +
267
+ '<td>true\n' +
268
+ '</tr>\n' +
269
+ '<tr>\n' +
270
+ '<td>C</td>\n' +
271
+ '<td>C-Axis motion command</td>\n' +
272
+ '<td>true\n' +
273
+ '</tr>' ,
274
+ ) ;
275
+ } ) ;
276
+ } ) ;
157
277
} ) ;
158
278
} ) ;
0 commit comments