@pie-lib/graphing-solution-set 4.0.13 → 4.1.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. package/CHANGELOG.md +0 -44
  2. package/lib/__tests__/bg.test.js +282 -0
  3. package/lib/__tests__/bg.test.js.map +1 -0
  4. package/lib/__tests__/coordinates-label.test.js +276 -0
  5. package/lib/__tests__/coordinates-label.test.js.map +1 -0
  6. package/lib/__tests__/graph-with-controls.test.js +256 -0
  7. package/lib/__tests__/graph-with-controls.test.js.map +1 -0
  8. package/lib/__tests__/graph.test.js +113 -0
  9. package/lib/__tests__/graph.test.js.map +1 -0
  10. package/lib/__tests__/grid-setup.test.js +729 -0
  11. package/lib/__tests__/grid-setup.test.js.map +1 -0
  12. package/lib/__tests__/grid.test.js +29 -0
  13. package/lib/__tests__/grid.test.js.map +1 -0
  14. package/lib/__tests__/labels.test.js +45 -0
  15. package/lib/__tests__/labels.test.js.map +1 -0
  16. package/lib/__tests__/mark-label.test.js +133 -0
  17. package/lib/__tests__/mark-label.test.js.map +1 -0
  18. package/lib/__tests__/toggle-bar.test.js +146 -0
  19. package/lib/__tests__/toggle-bar.test.js.map +1 -0
  20. package/lib/__tests__/tool-menu.test.js +540 -0
  21. package/lib/__tests__/tool-menu.test.js.map +1 -0
  22. package/lib/__tests__/undo-redo.test.js +31 -0
  23. package/lib/__tests__/undo-redo.test.js.map +1 -0
  24. package/lib/__tests__/use-debounce.test.js +24 -0
  25. package/lib/__tests__/use-debounce.test.js.map +1 -0
  26. package/lib/__tests__/utils.js +70 -0
  27. package/lib/__tests__/utils.js.map +1 -0
  28. package/lib/__tests__/utils.test.js +123 -0
  29. package/lib/__tests__/utils.test.js.map +1 -0
  30. package/lib/axis/__tests__/arrow.test.js +60 -0
  31. package/lib/axis/__tests__/arrow.test.js.map +1 -0
  32. package/lib/axis/__tests__/axes.test.js +160 -0
  33. package/lib/axis/__tests__/axes.test.js.map +1 -0
  34. package/lib/container/__tests__/actions.test.js +108 -0
  35. package/lib/container/__tests__/actions.test.js.map +1 -0
  36. package/lib/container/__tests__/index.test.js +346 -0
  37. package/lib/container/__tests__/index.test.js.map +1 -0
  38. package/lib/container/__tests__/marks.test.js +259 -0
  39. package/lib/container/__tests__/marks.test.js.map +1 -0
  40. package/lib/container/__tests__/middleware.test.js +244 -0
  41. package/lib/container/__tests__/middleware.test.js.map +1 -0
  42. package/lib/container/__tests__/reducer.test.js +450 -0
  43. package/lib/container/__tests__/reducer.test.js.map +1 -0
  44. package/lib/tools/line/__tests__/component.test.js +45 -0
  45. package/lib/tools/line/__tests__/component.test.js.map +1 -0
  46. package/lib/tools/polygon/__tests__/component.test.js +501 -0
  47. package/lib/tools/polygon/__tests__/component.test.js.map +1 -0
  48. package/lib/tools/polygon/__tests__/index.test.js +92 -0
  49. package/lib/tools/polygon/__tests__/index.test.js.map +1 -0
  50. package/lib/tools/polygon/__tests__/line.test.js +30 -0
  51. package/lib/tools/polygon/__tests__/line.test.js.map +1 -0
  52. package/lib/tools/polygon/__tests__/polygon.test.js +61 -0
  53. package/lib/tools/polygon/__tests__/polygon.test.js.map +1 -0
  54. package/lib/tools/shared/__tests__/arrow-head.test.js +45 -0
  55. package/lib/tools/shared/__tests__/arrow-head.test.js.map +1 -0
  56. package/lib/tools/shared/line/__tests__/index.test.js +725 -0
  57. package/lib/tools/shared/line/__tests__/index.test.js.map +1 -0
  58. package/lib/tools/shared/line/__tests__/line-path.test.js +64 -0
  59. package/lib/tools/shared/line/__tests__/line-path.test.js.map +1 -0
  60. package/lib/tools/shared/line/__tests__/with-root-edge.test.js +618 -0
  61. package/lib/tools/shared/line/__tests__/with-root-edge.test.js.map +1 -0
  62. package/lib/tools/shared/point/__tests__/arrow-point.test.js +127 -0
  63. package/lib/tools/shared/point/__tests__/arrow-point.test.js.map +1 -0
  64. package/lib/tools/shared/point/__tests__/arrow.test.js +619 -0
  65. package/lib/tools/shared/point/__tests__/arrow.test.js.map +1 -0
  66. package/lib/tools/shared/point/__tests__/base-point.test.js +122 -0
  67. package/lib/tools/shared/point/__tests__/base-point.test.js.map +1 -0
  68. package/package.json +7 -7
  69. package/LICENSE.md +0 -5
@@ -0,0 +1,725 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
5
+ var _index = require("../index");
6
+ var _plot = require("@pie-lib/plot");
7
+ var _testUtils = require("@pie-lib/test-utils");
8
+ var _react = _interopRequireDefault(require("react"));
9
+ var _utils = require("../../../../__tests__/utils");
10
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
11
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2["default"])(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
12
+ var xy = _plot.utils.xy;
13
+ var xyLabel = function xyLabel(x, y, label) {
14
+ return {
15
+ x: x,
16
+ y: y,
17
+ label: label
18
+ };
19
+ };
20
+ describe('lineTool', function () {
21
+ describe('addPoint', function () {
22
+ var toolbar;
23
+ beforeEach(function () {
24
+ toolbar = (0, _index.lineTool)('lineType', function () {
25
+ return /*#__PURE__*/_react["default"].createElement("div", null);
26
+ })();
27
+ });
28
+ it('returns a building mark when no existing mark', function () {
29
+ var result = toolbar.addPoint(xy(1, 1));
30
+ expect(result).toEqual({
31
+ type: 'lineType',
32
+ building: true,
33
+ from: xy(1, 1)
34
+ });
35
+ });
36
+ it('returns a complete mark when adding second point', function () {
37
+ var result = toolbar.addPoint(xy(1, 1), {
38
+ from: xy(0, 0)
39
+ });
40
+ expect(result).toEqual({
41
+ building: false,
42
+ from: xy(0, 0),
43
+ to: xy(1, 1)
44
+ });
45
+ });
46
+ it('returns same mark if point equals existing from point', function () {
47
+ var existingMark = {
48
+ from: xy(1, 1),
49
+ building: true
50
+ };
51
+ var result = toolbar.addPoint(xy(1, 1), existingMark);
52
+ expect(result).toEqual(existingMark);
53
+ });
54
+ it('handles adding point with root property', function () {
55
+ var existingMark = {
56
+ root: xy(1, 1),
57
+ building: true
58
+ };
59
+ var result = toolbar.addPoint(xy(1, 1), existingMark);
60
+ expect(result).toEqual(existingMark);
61
+ });
62
+ it('creates different types correctly', function () {
63
+ var lineA = (0, _index.lineTool)('lineA', function () {
64
+ return /*#__PURE__*/_react["default"].createElement("div", null);
65
+ })();
66
+ var lineB = (0, _index.lineTool)('lineB', function () {
67
+ return /*#__PURE__*/_react["default"].createElement("div", null);
68
+ })();
69
+ var resultA = lineA.addPoint(xy(1, 1));
70
+ var resultB = lineB.addPoint(xy(1, 1));
71
+ expect(resultA.type).toBe('lineA');
72
+ expect(resultB.type).toBe('lineB');
73
+ });
74
+ it('preserves building state correctly', function () {
75
+ var building = toolbar.addPoint(xy(1, 1));
76
+ expect(building.building).toBe(true);
77
+ var complete = toolbar.addPoint(xy(2, 2), building);
78
+ expect(complete.building).toBe(false);
79
+ });
80
+ });
81
+ describe('Component property', function () {
82
+ it('stores the provided Component', function () {
83
+ var TestComp = function TestComp() {
84
+ return /*#__PURE__*/_react["default"].createElement("div", null, "Test");
85
+ };
86
+ var tool = (0, _index.lineTool)('test', TestComp)();
87
+ expect(tool.Component).toBe(TestComp);
88
+ });
89
+ it('stores the correct type', function () {
90
+ var tool = (0, _index.lineTool)('customType', function () {
91
+ return /*#__PURE__*/_react["default"].createElement("div", null);
92
+ })();
93
+ expect(tool.type).toBe('customType');
94
+ });
95
+ });
96
+ });
97
+ describe('lineToolComponent', function () {
98
+ var Comp;
99
+ var mark;
100
+ var onChange;
101
+ beforeEach(function () {
102
+ onChange = jest.fn();
103
+ Comp = (0, _index.lineToolComponent)(function () {
104
+ return /*#__PURE__*/_react["default"].createElement("text", {
105
+ "data-testid": "line-component"
106
+ });
107
+ });
108
+ mark = {
109
+ from: xy(0, 0),
110
+ to: xy(1, 1),
111
+ type: 'line'
112
+ };
113
+ });
114
+ var renderComponent = function renderComponent(extras) {
115
+ var defaults = {
116
+ mark: mark,
117
+ onChange: onChange,
118
+ graphProps: (0, _utils.graphProps)()
119
+ };
120
+ var props = _objectSpread(_objectSpread({}, defaults), extras);
121
+ return (0, _testUtils.render)(/*#__PURE__*/_react["default"].createElement(Comp, props));
122
+ };
123
+ describe('rendering', function () {
124
+ it('renders without crashing', function () {
125
+ var _renderComponent = renderComponent(),
126
+ container = _renderComponent.container;
127
+ expect(container.firstChild).toBeInTheDocument();
128
+ });
129
+ it('renders with building mark', function () {
130
+ var buildingMark = {
131
+ from: xy(0, 0),
132
+ building: true,
133
+ type: 'line'
134
+ };
135
+ var _renderComponent2 = renderComponent({
136
+ mark: buildingMark
137
+ }),
138
+ container = _renderComponent2.container;
139
+ expect(container.firstChild).toBeInTheDocument();
140
+ });
141
+ it('renders with background mark', function () {
142
+ var bgMark = {
143
+ from: xy(0, 0),
144
+ to: xy(1, 1),
145
+ isBackground: true,
146
+ type: 'line'
147
+ };
148
+ var _renderComponent3 = renderComponent({
149
+ mark: bgMark
150
+ }),
151
+ container = _renderComponent3.container;
152
+ expect(container.firstChild).toBeInTheDocument();
153
+ });
154
+ it('renders with disabled mark', function () {
155
+ var disabledMark = {
156
+ from: xy(0, 0),
157
+ to: xy(1, 1),
158
+ disabled: true,
159
+ type: 'line'
160
+ };
161
+ var _renderComponent4 = renderComponent({
162
+ mark: disabledMark
163
+ }),
164
+ container = _renderComponent4.container;
165
+ expect(container.firstChild).toBeInTheDocument();
166
+ });
167
+ it('renders with correctness states', function () {
168
+ var correctMark = {
169
+ from: xy(0, 0),
170
+ to: xy(1, 1),
171
+ correctness: 'correct',
172
+ type: 'line'
173
+ };
174
+ var _renderComponent5 = renderComponent({
175
+ mark: correctMark
176
+ }),
177
+ container = _renderComponent5.container;
178
+ expect(container.firstChild).toBeInTheDocument();
179
+ });
180
+ it('renders with middle point', function () {
181
+ var markWithMiddle = {
182
+ from: xy(0, 0),
183
+ to: xy(1, 1),
184
+ middle: xy(0.5, 0.5),
185
+ type: 'line'
186
+ };
187
+ var _renderComponent6 = renderComponent({
188
+ mark: markWithMiddle
189
+ }),
190
+ container = _renderComponent6.container;
191
+ expect(container.firstChild).toBeInTheDocument();
192
+ });
193
+ it('renders with fill color', function () {
194
+ var coloredMark = {
195
+ from: xy(0, 0),
196
+ to: xy(1, 1),
197
+ fill: '#ff0000',
198
+ type: 'line'
199
+ };
200
+ var _renderComponent7 = renderComponent({
201
+ mark: coloredMark
202
+ }),
203
+ container = _renderComponent7.container;
204
+ expect(container.firstChild).toBeInTheDocument();
205
+ });
206
+ it('renders with gssLineData', function () {
207
+ var gssLineData = {
208
+ selectedTool: 'lineA'
209
+ };
210
+ var _renderComponent8 = renderComponent({
211
+ gssLineData: gssLineData
212
+ }),
213
+ container = _renderComponent8.container;
214
+ expect(container.firstChild).toBeInTheDocument();
215
+ });
216
+ it('renders with labelNode', function () {
217
+ var labelNode = document.createElement('foreignObject');
218
+ var _renderComponent9 = renderComponent({
219
+ labelNode: labelNode
220
+ }),
221
+ container = _renderComponent9.container;
222
+ expect(container.firstChild).toBeInTheDocument();
223
+ });
224
+ it('renders with coordinatesOnHover enabled', function () {
225
+ var _renderComponent0 = renderComponent({
226
+ coordinatesOnHover: true
227
+ }),
228
+ container = _renderComponent0.container;
229
+ expect(container.firstChild).toBeInTheDocument();
230
+ });
231
+ it('renders with labelModeEnabled', function () {
232
+ var _renderComponent1 = renderComponent({
233
+ labelModeEnabled: true
234
+ }),
235
+ container = _renderComponent1.container;
236
+ expect(container.firstChild).toBeInTheDocument();
237
+ });
238
+ });
239
+ describe('state management', function () {
240
+ it('initializes with empty state', function () {
241
+ var _renderComponent10 = renderComponent(),
242
+ container = _renderComponent10.container;
243
+ expect(container.firstChild).toBeInTheDocument();
244
+ // State should be empty initially
245
+ });
246
+ it('handles mark updates through props', function () {
247
+ var _renderComponent11 = renderComponent(),
248
+ rerender = _renderComponent11.rerender,
249
+ container = _renderComponent11.container;
250
+ var updatedMark = {
251
+ from: xy(1, 1),
252
+ to: xy(2, 2),
253
+ type: 'line'
254
+ };
255
+ rerender(/*#__PURE__*/_react["default"].createElement(Comp, {
256
+ mark: updatedMark,
257
+ onChange: onChange,
258
+ graphProps: (0, _utils.graphProps)()
259
+ }));
260
+ expect(container.firstChild).toBeInTheDocument();
261
+ });
262
+ });
263
+ describe('background mark handling', function () {
264
+ it('disables from point when mark is background', function () {
265
+ var bgMark = {
266
+ from: xy(0, 0),
267
+ to: xy(1, 1),
268
+ isBackground: true,
269
+ type: 'line'
270
+ };
271
+ var _renderComponent12 = renderComponent({
272
+ mark: bgMark
273
+ }),
274
+ container = _renderComponent12.container;
275
+ expect(container.firstChild).toBeInTheDocument();
276
+ // from.disabled should be true
277
+ });
278
+ it('disables to point when mark is background', function () {
279
+ var bgMark = {
280
+ from: xy(0, 0),
281
+ to: xy(1, 1),
282
+ isBackground: true,
283
+ type: 'line'
284
+ };
285
+ var _renderComponent13 = renderComponent({
286
+ mark: bgMark
287
+ }),
288
+ container = _renderComponent13.container;
289
+ expect(container.firstChild).toBeInTheDocument();
290
+ // to.disabled should be true
291
+ });
292
+ it('disables middle point when mark is background', function () {
293
+ var bgMark = {
294
+ from: xy(0, 0),
295
+ to: xy(1, 1),
296
+ middle: xy(0.5, 0.5),
297
+ isBackground: true,
298
+ type: 'line'
299
+ };
300
+ var _renderComponent14 = renderComponent({
301
+ mark: bgMark
302
+ }),
303
+ container = _renderComponent14.container;
304
+ expect(container.firstChild).toBeInTheDocument();
305
+ // middle.disabled should be true
306
+ });
307
+ });
308
+ describe('edge cases', function () {
309
+ it('handles mark without to point', function () {
310
+ var incompleteMark = {
311
+ from: xy(0, 0),
312
+ type: 'line'
313
+ };
314
+ var _renderComponent15 = renderComponent({
315
+ mark: incompleteMark
316
+ }),
317
+ container = _renderComponent15.container;
318
+ expect(container.firstChild).toBeInTheDocument();
319
+ });
320
+ it('handles mark with only from point', function () {
321
+ var singlePointMark = {
322
+ from: xy(0, 0),
323
+ building: true,
324
+ type: 'line'
325
+ };
326
+ var _renderComponent16 = renderComponent({
327
+ mark: singlePointMark
328
+ }),
329
+ container = _renderComponent16.container;
330
+ expect(container.firstChild).toBeInTheDocument();
331
+ });
332
+ it('handles different line types', function () {
333
+ var parabola = {
334
+ from: xy(0, 0),
335
+ to: xy(1, 1),
336
+ type: 'parabola'
337
+ };
338
+ var sine = {
339
+ from: xy(0, 0),
340
+ to: xy(1, 1),
341
+ type: 'sine'
342
+ };
343
+ var absolute = {
344
+ from: xy(0, 0),
345
+ to: xy(1, 1),
346
+ type: 'absolute'
347
+ };
348
+ var exponential = {
349
+ from: xy(0, 0),
350
+ to: xy(1, 1),
351
+ type: 'exponential'
352
+ };
353
+ (0, _testUtils.render)(/*#__PURE__*/_react["default"].createElement(Comp, {
354
+ mark: parabola,
355
+ onChange: onChange,
356
+ graphProps: (0, _utils.graphProps)()
357
+ }));
358
+ (0, _testUtils.render)(/*#__PURE__*/_react["default"].createElement(Comp, {
359
+ mark: sine,
360
+ onChange: onChange,
361
+ graphProps: (0, _utils.graphProps)()
362
+ }));
363
+ (0, _testUtils.render)(/*#__PURE__*/_react["default"].createElement(Comp, {
364
+ mark: absolute,
365
+ onChange: onChange,
366
+ graphProps: (0, _utils.graphProps)()
367
+ }));
368
+ (0, _testUtils.render)(/*#__PURE__*/_react["default"].createElement(Comp, {
369
+ mark: exponential,
370
+ onChange: onChange,
371
+ graphProps: (0, _utils.graphProps)()
372
+ }));
373
+ });
374
+ });
375
+ });
376
+ describe('lineBase', function () {
377
+ var Comp;
378
+ var onChange;
379
+ var changeMarkProps;
380
+ var onClick;
381
+ beforeEach(function () {
382
+ onChange = jest.fn();
383
+ changeMarkProps = jest.fn();
384
+ onClick = jest.fn();
385
+ Comp = (0, _index.lineBase)(function () {
386
+ return /*#__PURE__*/_react["default"].createElement("text", {
387
+ "data-testid": "line-base"
388
+ });
389
+ });
390
+ });
391
+ var renderComponent = function renderComponent(extras) {
392
+ var defaults = {
393
+ onChange: onChange,
394
+ changeMarkProps: changeMarkProps,
395
+ onClick: onClick,
396
+ graphProps: (0, _utils.graphProps)(),
397
+ from: xy(0, 0),
398
+ to: xy(1, 1)
399
+ };
400
+ var props = _objectSpread(_objectSpread({}, defaults), extras);
401
+ return (0, _testUtils.render)(/*#__PURE__*/_react["default"].createElement(Comp, props));
402
+ };
403
+ var labelNode = document.createElement('foreignObject');
404
+ var renderWithLabels = function renderWithLabels() {
405
+ var extras = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
406
+ return renderComponent(_objectSpread(_objectSpread({}, extras), {}, {
407
+ labelNode: labelNode,
408
+ from: xyLabel(0, 0, 'A'),
409
+ to: xyLabel(1, 1, 'B')
410
+ }));
411
+ };
412
+ describe('rendering', function () {
413
+ it('renders without crashing', function () {
414
+ var _renderComponent17 = renderComponent(),
415
+ container = _renderComponent17.container;
416
+ expect(container.firstChild).toBeInTheDocument();
417
+ });
418
+ it('renders with labels', function () {
419
+ var _renderWithLabels = renderWithLabels(),
420
+ container = _renderWithLabels.container;
421
+ expect(container.firstChild).toBeInTheDocument();
422
+ });
423
+ it('renders with middle point label', function () {
424
+ var _renderComponent18 = renderComponent({
425
+ labelNode: labelNode,
426
+ middle: xyLabel(0.5, 0.5, 'M')
427
+ }),
428
+ container = _renderComponent18.container;
429
+ expect(container.firstChild).toBeInTheDocument();
430
+ });
431
+ it('renders with only from label', function () {
432
+ var _renderComponent19 = renderComponent({
433
+ labelNode: labelNode,
434
+ from: xyLabel(0, 0, 'Start'),
435
+ to: xy(1, 1)
436
+ }),
437
+ container = _renderComponent19.container;
438
+ expect(container.firstChild).toBeInTheDocument();
439
+ });
440
+ it('renders with only to label', function () {
441
+ var _renderComponent20 = renderComponent({
442
+ labelNode: labelNode,
443
+ from: xy(0, 0),
444
+ to: xyLabel(1, 1, 'End')
445
+ }),
446
+ container = _renderComponent20.container;
447
+ expect(container.firstChild).toBeInTheDocument();
448
+ });
449
+ it('renders with all three labels', function () {
450
+ var _renderComponent21 = renderComponent({
451
+ labelNode: labelNode,
452
+ from: xyLabel(0, 0, 'A'),
453
+ to: xyLabel(1, 1, 'B'),
454
+ middle: xyLabel(0.5, 0.5, 'M')
455
+ }),
456
+ container = _renderComponent21.container;
457
+ expect(container.firstChild).toBeInTheDocument();
458
+ });
459
+ });
460
+ describe('gssLineData handling', function () {
461
+ it('renders normally without gssLineData', function () {
462
+ var _renderComponent22 = renderComponent(),
463
+ container = _renderComponent22.container;
464
+ expect(container.firstChild).toBeInTheDocument();
465
+ });
466
+ it('renders with gssLineData when solutionSet is selected', function () {
467
+ var gssLineData = {
468
+ selectedTool: 'solutionSet'
469
+ };
470
+ var _renderComponent23 = renderComponent({
471
+ gssLineData: gssLineData
472
+ }),
473
+ container = _renderComponent23.container;
474
+ expect(container.firstChild).toBeInTheDocument();
475
+ });
476
+ it('renders with gssLineData when lineA is selected', function () {
477
+ var gssLineData = {
478
+ selectedTool: 'lineA'
479
+ };
480
+ var _renderComponent24 = renderComponent({
481
+ gssLineData: gssLineData
482
+ }),
483
+ container = _renderComponent24.container;
484
+ expect(container.firstChild).toBeInTheDocument();
485
+ });
486
+ it('renders with gssLineData when lineB is selected', function () {
487
+ var gssLineData = {
488
+ selectedTool: 'lineB'
489
+ };
490
+ var _renderComponent25 = renderComponent({
491
+ gssLineData: gssLineData
492
+ }),
493
+ container = _renderComponent25.container;
494
+ expect(container.firstChild).toBeInTheDocument();
495
+ });
496
+ });
497
+ describe('disabled state', function () {
498
+ it('renders when disabled', function () {
499
+ var _renderComponent26 = renderComponent({
500
+ disabled: true
501
+ }),
502
+ container = _renderComponent26.container;
503
+ expect(container.firstChild).toBeInTheDocument();
504
+ });
505
+ it('renders when not disabled', function () {
506
+ var _renderComponent27 = renderComponent({
507
+ disabled: false
508
+ }),
509
+ container = _renderComponent27.container;
510
+ expect(container.firstChild).toBeInTheDocument();
511
+ });
512
+ });
513
+ describe('correctness states', function () {
514
+ it('renders with correct state', function () {
515
+ var _renderComponent28 = renderComponent({
516
+ correctness: 'correct'
517
+ }),
518
+ container = _renderComponent28.container;
519
+ expect(container.firstChild).toBeInTheDocument();
520
+ });
521
+ it('renders with incorrect state', function () {
522
+ var _renderComponent29 = renderComponent({
523
+ correctness: 'incorrect'
524
+ }),
525
+ container = _renderComponent29.container;
526
+ expect(container.firstChild).toBeInTheDocument();
527
+ });
528
+ it('renders with missing state', function () {
529
+ var _renderComponent30 = renderComponent({
530
+ correctness: 'missing'
531
+ }),
532
+ container = _renderComponent30.container;
533
+ expect(container.firstChild).toBeInTheDocument();
534
+ });
535
+ it('renders without correctness', function () {
536
+ var _renderComponent31 = renderComponent({
537
+ correctness: undefined
538
+ }),
539
+ container = _renderComponent31.container;
540
+ expect(container.firstChild).toBeInTheDocument();
541
+ });
542
+ });
543
+ describe('fill color', function () {
544
+ it('renders with custom fill color', function () {
545
+ var _renderComponent32 = renderComponent({
546
+ fill: '#ff0000'
547
+ }),
548
+ container = _renderComponent32.container;
549
+ expect(container.firstChild).toBeInTheDocument();
550
+ });
551
+ it('renders without fill color', function () {
552
+ var _renderComponent33 = renderComponent({
553
+ fill: undefined
554
+ }),
555
+ container = _renderComponent33.container;
556
+ expect(container.firstChild).toBeInTheDocument();
557
+ });
558
+ });
559
+ describe('coordinates on hover', function () {
560
+ it('renders with coordinatesOnHover enabled', function () {
561
+ var _renderComponent34 = renderComponent({
562
+ coordinatesOnHover: true
563
+ }),
564
+ container = _renderComponent34.container;
565
+ expect(container.firstChild).toBeInTheDocument();
566
+ });
567
+ it('renders with coordinatesOnHover disabled', function () {
568
+ var _renderComponent35 = renderComponent({
569
+ coordinatesOnHover: false
570
+ }),
571
+ container = _renderComponent35.container;
572
+ expect(container.firstChild).toBeInTheDocument();
573
+ });
574
+ });
575
+ describe('label mode', function () {
576
+ it('renders with labelModeEnabled', function () {
577
+ var _renderComponent36 = renderComponent({
578
+ labelModeEnabled: true,
579
+ labelNode: labelNode
580
+ }),
581
+ container = _renderComponent36.container;
582
+ expect(container.firstChild).toBeInTheDocument();
583
+ });
584
+ it('renders without labelModeEnabled', function () {
585
+ var _renderComponent37 = renderComponent({
586
+ labelModeEnabled: false,
587
+ labelNode: labelNode
588
+ }),
589
+ container = _renderComponent37.container;
590
+ expect(container.firstChild).toBeInTheDocument();
591
+ });
592
+ });
593
+ describe('drag callbacks', function () {
594
+ it('renders with onDragStart callback', function () {
595
+ var onDragStart = jest.fn();
596
+ var _renderComponent38 = renderComponent({
597
+ onDragStart: onDragStart
598
+ }),
599
+ container = _renderComponent38.container;
600
+ expect(container.firstChild).toBeInTheDocument();
601
+ });
602
+ it('renders with onDragStop callback', function () {
603
+ var onDragStop = jest.fn();
604
+ var _renderComponent39 = renderComponent({
605
+ onDragStop: onDragStop
606
+ }),
607
+ container = _renderComponent39.container;
608
+ expect(container.firstChild).toBeInTheDocument();
609
+ });
610
+ it('renders with both drag callbacks', function () {
611
+ var onDragStart = jest.fn();
612
+ var onDragStop = jest.fn();
613
+ var _renderComponent40 = renderComponent({
614
+ onDragStart: onDragStart,
615
+ onDragStop: onDragStop
616
+ }),
617
+ container = _renderComponent40.container;
618
+ expect(container.firstChild).toBeInTheDocument();
619
+ });
620
+ });
621
+ describe('edge cases', function () {
622
+ it('handles equal from and to points', function () {
623
+ var _renderComponent41 = renderComponent({
624
+ from: xy(1, 1),
625
+ to: xy(1, 1)
626
+ }),
627
+ container = _renderComponent41.container;
628
+ expect(container.firstChild).toBeInTheDocument();
629
+ });
630
+ it('handles negative coordinates', function () {
631
+ var _renderComponent42 = renderComponent({
632
+ from: xy(-5, -5),
633
+ to: xy(-1, -1)
634
+ }),
635
+ container = _renderComponent42.container;
636
+ expect(container.firstChild).toBeInTheDocument();
637
+ });
638
+ it('handles large coordinate values', function () {
639
+ var _renderComponent43 = renderComponent({
640
+ from: xy(100, 100),
641
+ to: xy(200, 200)
642
+ }),
643
+ container = _renderComponent43.container;
644
+ expect(container.firstChild).toBeInTheDocument();
645
+ });
646
+ it('handles decimal coordinates', function () {
647
+ var _renderComponent44 = renderComponent({
648
+ from: xy(0.5, 0.5),
649
+ to: xy(1.5, 1.5)
650
+ }),
651
+ container = _renderComponent44.container;
652
+ expect(container.firstChild).toBeInTheDocument();
653
+ });
654
+ it('handles vertical lines', function () {
655
+ var _renderComponent45 = renderComponent({
656
+ from: xy(1, 0),
657
+ to: xy(1, 5)
658
+ }),
659
+ container = _renderComponent45.container;
660
+ expect(container.firstChild).toBeInTheDocument();
661
+ });
662
+ it('handles horizontal lines', function () {
663
+ var _renderComponent46 = renderComponent({
664
+ from: xy(0, 1),
665
+ to: xy(5, 1)
666
+ }),
667
+ container = _renderComponent46.container;
668
+ expect(container.firstChild).toBeInTheDocument();
669
+ });
670
+ it('handles empty label strings', function () {
671
+ var _renderComponent47 = renderComponent({
672
+ labelNode: labelNode,
673
+ from: xyLabel(0, 0, ''),
674
+ to: xyLabel(1, 1, '')
675
+ }),
676
+ container = _renderComponent47.container;
677
+ expect(container.firstChild).toBeInTheDocument();
678
+ });
679
+ });
680
+ describe('integration scenarios', function () {
681
+ it('renders complete line with all features', function () {
682
+ var _renderComponent48 = renderComponent({
683
+ from: xyLabel(0, 0, 'Start'),
684
+ to: xyLabel(5, 5, 'End'),
685
+ middle: xyLabel(2.5, 2.5, 'Middle'),
686
+ labelNode: labelNode,
687
+ coordinatesOnHover: true,
688
+ labelModeEnabled: true,
689
+ disabled: false,
690
+ correctness: 'correct',
691
+ fill: '#00ff00',
692
+ gssLineData: {
693
+ selectedTool: 'lineA'
694
+ },
695
+ onDragStart: jest.fn(),
696
+ onDragStop: jest.fn()
697
+ }),
698
+ container = _renderComponent48.container;
699
+ expect(container.firstChild).toBeInTheDocument();
700
+ });
701
+ it('renders disabled background line', function () {
702
+ var _renderComponent49 = renderComponent({
703
+ from: xy(0, 0),
704
+ to: xy(1, 1),
705
+ disabled: true,
706
+ correctness: 'incorrect'
707
+ }),
708
+ container = _renderComponent49.container;
709
+ expect(container.firstChild).toBeInTheDocument();
710
+ });
711
+ it('renders solution set mode', function () {
712
+ var _renderComponent50 = renderComponent({
713
+ from: xy(0, 0),
714
+ to: xy(1, 1),
715
+ gssLineData: {
716
+ selectedTool: 'solutionSet'
717
+ },
718
+ labelNode: labelNode
719
+ }),
720
+ container = _renderComponent50.container;
721
+ expect(container.firstChild).toBeInTheDocument();
722
+ });
723
+ });
724
+ });
725
+ //# sourceMappingURL=index.test.js.map