@pie-lib/graphing 4.1.0-beta.6 → 4.1.0-beta.8
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.
- package/package.json +3 -3
- package/lib/__tests__/bg.test.js +0 -282
- package/lib/__tests__/bg.test.js.map +0 -1
- package/lib/__tests__/coordinates-label.test.js +0 -276
- package/lib/__tests__/coordinates-label.test.js.map +0 -1
- package/lib/__tests__/graph-with-controls.test.js +0 -275
- package/lib/__tests__/graph-with-controls.test.js.map +0 -1
- package/lib/__tests__/graph.test.js +0 -927
- package/lib/__tests__/graph.test.js.map +0 -1
- package/lib/__tests__/grid-setup.test.js +0 -729
- package/lib/__tests__/grid-setup.test.js.map +0 -1
- package/lib/__tests__/grid.test.js +0 -29
- package/lib/__tests__/grid.test.js.map +0 -1
- package/lib/__tests__/key-legend.test.js +0 -321
- package/lib/__tests__/key-legend.test.js.map +0 -1
- package/lib/__tests__/label-svg-icon.test.js +0 -373
- package/lib/__tests__/label-svg-icon.test.js.map +0 -1
- package/lib/__tests__/labels.test.js +0 -61
- package/lib/__tests__/labels.test.js.map +0 -1
- package/lib/__tests__/mark-label.test.js +0 -133
- package/lib/__tests__/mark-label.test.js.map +0 -1
- package/lib/__tests__/toggle-bar.test.js +0 -197
- package/lib/__tests__/toggle-bar.test.js.map +0 -1
- package/lib/__tests__/tool-menu.test.js +0 -151
- package/lib/__tests__/tool-menu.test.js.map +0 -1
- package/lib/__tests__/undo-redo.test.js +0 -31
- package/lib/__tests__/undo-redo.test.js.map +0 -1
- package/lib/__tests__/use-debounce.test.js +0 -24
- package/lib/__tests__/use-debounce.test.js.map +0 -1
- package/lib/__tests__/utils.js +0 -70
- package/lib/__tests__/utils.js.map +0 -1
- package/lib/__tests__/utils.test.js +0 -123
- package/lib/__tests__/utils.test.js.map +0 -1
- package/lib/axis/__tests__/arrow.test.js +0 -60
- package/lib/axis/__tests__/arrow.test.js.map +0 -1
- package/lib/axis/__tests__/axes.test.js +0 -195
- package/lib/axis/__tests__/axes.test.js.map +0 -1
- package/lib/container/__tests__/actions.test.js +0 -108
- package/lib/container/__tests__/actions.test.js.map +0 -1
- package/lib/container/__tests__/index.test.js +0 -503
- package/lib/container/__tests__/index.test.js.map +0 -1
- package/lib/container/__tests__/marks.test.js +0 -259
- package/lib/container/__tests__/marks.test.js.map +0 -1
- package/lib/container/__tests__/middleware.test.js +0 -244
- package/lib/container/__tests__/middleware.test.js.map +0 -1
- package/lib/container/__tests__/reducer.test.js +0 -450
- package/lib/container/__tests__/reducer.test.js.map +0 -1
- package/lib/tools/absolute/__tests__/component.test.js +0 -65
- package/lib/tools/absolute/__tests__/component.test.js.map +0 -1
- package/lib/tools/circle/__tests__/bg-circle.test.js +0 -33
- package/lib/tools/circle/__tests__/bg-circle.test.js.map +0 -1
- package/lib/tools/circle/__tests__/component.test.js +0 -615
- package/lib/tools/circle/__tests__/component.test.js.map +0 -1
- package/lib/tools/circle/__tests__/index.test.js +0 -576
- package/lib/tools/circle/__tests__/index.test.js.map +0 -1
- package/lib/tools/exponential/__tests__/component.test.js +0 -64
- package/lib/tools/exponential/__tests__/component.test.js.map +0 -1
- package/lib/tools/exponential/__tests__/index.test.js +0 -828
- package/lib/tools/exponential/__tests__/index.test.js.map +0 -1
- package/lib/tools/line/__tests__/component.test.js +0 -45
- package/lib/tools/line/__tests__/component.test.js.map +0 -1
- package/lib/tools/parabola/__tests__/component.test.js +0 -64
- package/lib/tools/parabola/__tests__/component.test.js.map +0 -1
- package/lib/tools/parabola/__tests__/index.test.js +0 -564
- package/lib/tools/parabola/__tests__/index.test.js.map +0 -1
- package/lib/tools/point/__tests__/component.test.js +0 -434
- package/lib/tools/point/__tests__/component.test.js.map +0 -1
- package/lib/tools/point/__tests__/index.test.js +0 -262
- package/lib/tools/point/__tests__/index.test.js.map +0 -1
- package/lib/tools/polygon/__tests__/component.test.js +0 -485
- package/lib/tools/polygon/__tests__/component.test.js.map +0 -1
- package/lib/tools/polygon/__tests__/index.test.js +0 -303
- package/lib/tools/polygon/__tests__/index.test.js.map +0 -1
- package/lib/tools/polygon/__tests__/line.test.js +0 -50
- package/lib/tools/polygon/__tests__/line.test.js.map +0 -1
- package/lib/tools/polygon/__tests__/polygon.test.js +0 -85
- package/lib/tools/polygon/__tests__/polygon.test.js.map +0 -1
- package/lib/tools/ray/__tests__/component.test.js +0 -35
- package/lib/tools/ray/__tests__/component.test.js.map +0 -1
- package/lib/tools/segment/__tests__/component.test.js +0 -35
- package/lib/tools/segment/__tests__/component.test.js.map +0 -1
- package/lib/tools/shared/__tests__/arrow-head.test.js +0 -45
- package/lib/tools/shared/__tests__/arrow-head.test.js.map +0 -1
- package/lib/tools/shared/line/__tests__/index.test.js +0 -124
- package/lib/tools/shared/line/__tests__/index.test.js.map +0 -1
- package/lib/tools/shared/line/__tests__/line-path.test.js +0 -62
- package/lib/tools/shared/line/__tests__/line-path.test.js.map +0 -1
- package/lib/tools/shared/line/__tests__/with-root-edge.test.js +0 -90
- package/lib/tools/shared/line/__tests__/with-root-edge.test.js.map +0 -1
- package/lib/tools/shared/point/__tests__/arrow-point.test.js +0 -127
- package/lib/tools/shared/point/__tests__/arrow-point.test.js.map +0 -1
- package/lib/tools/shared/point/__tests__/base-point.test.js +0 -122
- package/lib/tools/shared/point/__tests__/base-point.test.js.map +0 -1
- package/lib/tools/sine/__tests__/component.test.js +0 -72
- package/lib/tools/sine/__tests__/component.test.js.map +0 -1
- package/lib/tools/vector/__tests__/component.test.js +0 -32
- package/lib/tools/vector/__tests__/component.test.js.map +0 -1
|
@@ -1,615 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
5
|
-
var _testUtils = require("@pie-lib/test-utils");
|
|
6
|
-
var _react = _interopRequireDefault(require("react"));
|
|
7
|
-
var _utils = require("../../../__tests__/utils");
|
|
8
|
-
var _component = require("../component");
|
|
9
|
-
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; }
|
|
10
|
-
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; }
|
|
11
|
-
describe('Component', function () {
|
|
12
|
-
var onChange = jest.fn();
|
|
13
|
-
var changeMarkProps = jest.fn();
|
|
14
|
-
var renderComponent = function renderComponent(extras) {
|
|
15
|
-
var defaults = {
|
|
16
|
-
classes: {},
|
|
17
|
-
className: 'className',
|
|
18
|
-
onChange: onChange,
|
|
19
|
-
changeMarkProps: changeMarkProps,
|
|
20
|
-
graphProps: (0, _utils.graphProps)(),
|
|
21
|
-
from: (0, _utils.xy)(0, 0),
|
|
22
|
-
to: (0, _utils.xy)(1, 1)
|
|
23
|
-
};
|
|
24
|
-
var props = _objectSpread(_objectSpread({}, defaults), extras);
|
|
25
|
-
return (0, _testUtils.render)(/*#__PURE__*/_react["default"].createElement(_component.RawBaseCircle, props));
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
// used to test items that have labels attached to points
|
|
29
|
-
var labelNode = document.createElement('foreignObject');
|
|
30
|
-
var fromWithLabel = {
|
|
31
|
-
x: 0,
|
|
32
|
-
y: 0,
|
|
33
|
-
label: 'A'
|
|
34
|
-
};
|
|
35
|
-
var toWithLabel = {
|
|
36
|
-
x: 1,
|
|
37
|
-
y: 1,
|
|
38
|
-
label: 'B'
|
|
39
|
-
};
|
|
40
|
-
var renderWithLabels = function renderWithLabels() {
|
|
41
|
-
var extras = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
42
|
-
return renderComponent(_objectSpread(_objectSpread({}, extras), {}, {
|
|
43
|
-
labelNode: labelNode,
|
|
44
|
-
from: fromWithLabel,
|
|
45
|
-
to: toWithLabel
|
|
46
|
-
}));
|
|
47
|
-
};
|
|
48
|
-
describe('rendering', function () {
|
|
49
|
-
it('renders without crashing', function () {
|
|
50
|
-
var _renderComponent = renderComponent(),
|
|
51
|
-
container = _renderComponent.container;
|
|
52
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
53
|
-
});
|
|
54
|
-
it('renders with labels', function () {
|
|
55
|
-
var _renderWithLabels = renderWithLabels(),
|
|
56
|
-
container = _renderWithLabels.container;
|
|
57
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
58
|
-
});
|
|
59
|
-
it('renders a g element', function () {
|
|
60
|
-
var _renderComponent2 = renderComponent(),
|
|
61
|
-
container = _renderComponent2.container;
|
|
62
|
-
var g = container.querySelector('g');
|
|
63
|
-
expect(g).toBeInTheDocument();
|
|
64
|
-
});
|
|
65
|
-
it('renders BgCircle component', function () {
|
|
66
|
-
var _renderComponent3 = renderComponent(),
|
|
67
|
-
container = _renderComponent3.container;
|
|
68
|
-
// BgCircle is rendered as a styled component
|
|
69
|
-
expect(container.querySelector('g')).toBeInTheDocument();
|
|
70
|
-
});
|
|
71
|
-
it('renders two BasePoint components', function () {
|
|
72
|
-
var _renderComponent4 = renderComponent(),
|
|
73
|
-
container = _renderComponent4.container;
|
|
74
|
-
// Two points: from and to
|
|
75
|
-
var points = container.querySelectorAll('g');
|
|
76
|
-
expect(points.length).toBeGreaterThanOrEqual(2);
|
|
77
|
-
});
|
|
78
|
-
it('renders with building prop', function () {
|
|
79
|
-
var _renderComponent5 = renderComponent({
|
|
80
|
-
building: true
|
|
81
|
-
}),
|
|
82
|
-
container = _renderComponent5.container;
|
|
83
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
84
|
-
});
|
|
85
|
-
it('renders with disabled prop', function () {
|
|
86
|
-
var _renderComponent6 = renderComponent({
|
|
87
|
-
disabled: true
|
|
88
|
-
}),
|
|
89
|
-
container = _renderComponent6.container;
|
|
90
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
91
|
-
});
|
|
92
|
-
it('renders with correctness prop', function () {
|
|
93
|
-
var _renderComponent7 = renderComponent({
|
|
94
|
-
correctness: 'correct'
|
|
95
|
-
}),
|
|
96
|
-
container = _renderComponent7.container;
|
|
97
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
98
|
-
});
|
|
99
|
-
it('renders with coordinatesOnHover enabled', function () {
|
|
100
|
-
var _renderComponent8 = renderComponent({
|
|
101
|
-
coordinatesOnHover: true
|
|
102
|
-
}),
|
|
103
|
-
container = _renderComponent8.container;
|
|
104
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
105
|
-
});
|
|
106
|
-
it('renders with labelModeEnabled', function () {
|
|
107
|
-
var _renderComponent9 = renderComponent({
|
|
108
|
-
labelModeEnabled: true
|
|
109
|
-
}),
|
|
110
|
-
container = _renderComponent9.container;
|
|
111
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
112
|
-
});
|
|
113
|
-
it('renders with middle point', function () {
|
|
114
|
-
var middle = {
|
|
115
|
-
x: 0.5,
|
|
116
|
-
y: 0.5,
|
|
117
|
-
label: 'M'
|
|
118
|
-
};
|
|
119
|
-
var _renderComponent0 = renderComponent({
|
|
120
|
-
middle: middle,
|
|
121
|
-
labelNode: labelNode,
|
|
122
|
-
labelModeEnabled: true
|
|
123
|
-
}),
|
|
124
|
-
container = _renderComponent0.container;
|
|
125
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
126
|
-
});
|
|
127
|
-
it('handles undefined to point (uses from)', function () {
|
|
128
|
-
var _renderComponent1 = renderComponent({
|
|
129
|
-
to: undefined
|
|
130
|
-
}),
|
|
131
|
-
container = _renderComponent1.container;
|
|
132
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
133
|
-
});
|
|
134
|
-
it('handles null to point (uses from)', function () {
|
|
135
|
-
var _renderComponent10 = renderComponent({
|
|
136
|
-
to: null
|
|
137
|
-
}),
|
|
138
|
-
container = _renderComponent10.container;
|
|
139
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
140
|
-
});
|
|
141
|
-
});
|
|
142
|
-
describe('props', function () {
|
|
143
|
-
it('passes onChange callback', function () {
|
|
144
|
-
var customOnChange = jest.fn();
|
|
145
|
-
var _renderComponent11 = renderComponent({
|
|
146
|
-
onChange: customOnChange
|
|
147
|
-
}),
|
|
148
|
-
container = _renderComponent11.container;
|
|
149
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
150
|
-
});
|
|
151
|
-
it('passes changeMarkProps callback', function () {
|
|
152
|
-
var customChangeMarkProps = jest.fn();
|
|
153
|
-
var _renderComponent12 = renderComponent({
|
|
154
|
-
changeMarkProps: customChangeMarkProps
|
|
155
|
-
}),
|
|
156
|
-
container = _renderComponent12.container;
|
|
157
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
158
|
-
});
|
|
159
|
-
it('passes onClick callback', function () {
|
|
160
|
-
var onClick = jest.fn();
|
|
161
|
-
var _renderComponent13 = renderComponent({
|
|
162
|
-
onClick: onClick
|
|
163
|
-
}),
|
|
164
|
-
container = _renderComponent13.container;
|
|
165
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
166
|
-
});
|
|
167
|
-
it('passes onDragStart callback', function () {
|
|
168
|
-
var onDragStart = jest.fn();
|
|
169
|
-
var _renderComponent14 = renderComponent({
|
|
170
|
-
onDragStart: onDragStart
|
|
171
|
-
}),
|
|
172
|
-
container = _renderComponent14.container;
|
|
173
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
174
|
-
});
|
|
175
|
-
it('passes onDragStop callback', function () {
|
|
176
|
-
var onDragStop = jest.fn();
|
|
177
|
-
var _renderComponent15 = renderComponent({
|
|
178
|
-
onDragStop: onDragStop
|
|
179
|
-
}),
|
|
180
|
-
container = _renderComponent15.container;
|
|
181
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
182
|
-
});
|
|
183
|
-
it('uses default onClick when not provided', function () {
|
|
184
|
-
var _renderComponent16 = renderComponent({
|
|
185
|
-
onClick: undefined
|
|
186
|
-
}),
|
|
187
|
-
container = _renderComponent16.container;
|
|
188
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
189
|
-
});
|
|
190
|
-
it('passes graphProps', function () {
|
|
191
|
-
var customGraphProps = (0, _utils.graphProps)();
|
|
192
|
-
customGraphProps.size = {
|
|
193
|
-
width: 800,
|
|
194
|
-
height: 600
|
|
195
|
-
};
|
|
196
|
-
var _renderComponent17 = renderComponent({
|
|
197
|
-
graphProps: customGraphProps
|
|
198
|
-
}),
|
|
199
|
-
container = _renderComponent17.container;
|
|
200
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
201
|
-
});
|
|
202
|
-
it('passes className', function () {
|
|
203
|
-
var _renderComponent18 = renderComponent({
|
|
204
|
-
className: 'custom-circle'
|
|
205
|
-
}),
|
|
206
|
-
container = _renderComponent18.container;
|
|
207
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
208
|
-
});
|
|
209
|
-
});
|
|
210
|
-
describe('labels', function () {
|
|
211
|
-
it('renders from label when provided', function () {
|
|
212
|
-
var _renderWithLabels2 = renderWithLabels(),
|
|
213
|
-
container = _renderWithLabels2.container;
|
|
214
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
215
|
-
});
|
|
216
|
-
it('renders to label when provided', function () {
|
|
217
|
-
var _renderWithLabels3 = renderWithLabels(),
|
|
218
|
-
container = _renderWithLabels3.container;
|
|
219
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
220
|
-
});
|
|
221
|
-
it('renders middle label when provided', function () {
|
|
222
|
-
var middle = {
|
|
223
|
-
x: 0.5,
|
|
224
|
-
y: 0.5,
|
|
225
|
-
label: 'M'
|
|
226
|
-
};
|
|
227
|
-
var _renderComponent19 = renderComponent({
|
|
228
|
-
labelNode: labelNode,
|
|
229
|
-
middle: middle,
|
|
230
|
-
from: fromWithLabel,
|
|
231
|
-
to: toWithLabel
|
|
232
|
-
}),
|
|
233
|
-
container = _renderComponent19.container;
|
|
234
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
235
|
-
});
|
|
236
|
-
it('does not render labels when labelNode is not provided', function () {
|
|
237
|
-
var _renderComponent20 = renderComponent({
|
|
238
|
-
from: fromWithLabel,
|
|
239
|
-
to: toWithLabel,
|
|
240
|
-
labelNode: null
|
|
241
|
-
}),
|
|
242
|
-
container = _renderComponent20.container;
|
|
243
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
244
|
-
});
|
|
245
|
-
it('handles empty label', function () {
|
|
246
|
-
var from = {
|
|
247
|
-
x: 0,
|
|
248
|
-
y: 0,
|
|
249
|
-
label: ''
|
|
250
|
-
};
|
|
251
|
-
var to = {
|
|
252
|
-
x: 1,
|
|
253
|
-
y: 1,
|
|
254
|
-
label: ''
|
|
255
|
-
};
|
|
256
|
-
var _renderComponent21 = renderComponent({
|
|
257
|
-
labelNode: labelNode,
|
|
258
|
-
from: from,
|
|
259
|
-
to: to
|
|
260
|
-
}),
|
|
261
|
-
container = _renderComponent21.container;
|
|
262
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
263
|
-
});
|
|
264
|
-
it('renders with label mode enabled', function () {
|
|
265
|
-
var _renderComponent22 = renderComponent({
|
|
266
|
-
labelNode: labelNode,
|
|
267
|
-
labelModeEnabled: true,
|
|
268
|
-
from: fromWithLabel,
|
|
269
|
-
to: toWithLabel
|
|
270
|
-
}),
|
|
271
|
-
container = _renderComponent22.container;
|
|
272
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
273
|
-
});
|
|
274
|
-
it('renders with label mode disabled', function () {
|
|
275
|
-
var _renderComponent23 = renderComponent({
|
|
276
|
-
labelNode: labelNode,
|
|
277
|
-
labelModeEnabled: false,
|
|
278
|
-
from: fromWithLabel,
|
|
279
|
-
to: toWithLabel
|
|
280
|
-
}),
|
|
281
|
-
container = _renderComponent23.container;
|
|
282
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
283
|
-
});
|
|
284
|
-
it('renders with limitLabeling enabled', function () {
|
|
285
|
-
var _renderComponent24 = renderComponent({
|
|
286
|
-
labelNode: labelNode,
|
|
287
|
-
limitLabeling: true,
|
|
288
|
-
from: fromWithLabel,
|
|
289
|
-
to: toWithLabel
|
|
290
|
-
}),
|
|
291
|
-
container = _renderComponent24.container;
|
|
292
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
293
|
-
});
|
|
294
|
-
it('handles from label undefined', function () {
|
|
295
|
-
var from = {
|
|
296
|
-
x: 0,
|
|
297
|
-
y: 0
|
|
298
|
-
};
|
|
299
|
-
var to = {
|
|
300
|
-
x: 1,
|
|
301
|
-
y: 1,
|
|
302
|
-
label: 'B'
|
|
303
|
-
};
|
|
304
|
-
var _renderComponent25 = renderComponent({
|
|
305
|
-
labelNode: labelNode,
|
|
306
|
-
from: from,
|
|
307
|
-
to: to
|
|
308
|
-
}),
|
|
309
|
-
container = _renderComponent25.container;
|
|
310
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
311
|
-
});
|
|
312
|
-
it('handles to label undefined', function () {
|
|
313
|
-
var from = {
|
|
314
|
-
x: 0,
|
|
315
|
-
y: 0,
|
|
316
|
-
label: 'A'
|
|
317
|
-
};
|
|
318
|
-
var to = {
|
|
319
|
-
x: 1,
|
|
320
|
-
y: 1
|
|
321
|
-
};
|
|
322
|
-
var _renderComponent26 = renderComponent({
|
|
323
|
-
labelNode: labelNode,
|
|
324
|
-
from: from,
|
|
325
|
-
to: to
|
|
326
|
-
}),
|
|
327
|
-
container = _renderComponent26.container;
|
|
328
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
329
|
-
});
|
|
330
|
-
});
|
|
331
|
-
describe('coordinates', function () {
|
|
332
|
-
it('renders with positive coordinates', function () {
|
|
333
|
-
var _renderComponent27 = renderComponent({
|
|
334
|
-
from: (0, _utils.xy)(5, 10),
|
|
335
|
-
to: (0, _utils.xy)(15, 20)
|
|
336
|
-
}),
|
|
337
|
-
container = _renderComponent27.container;
|
|
338
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
339
|
-
});
|
|
340
|
-
it('renders with negative coordinates', function () {
|
|
341
|
-
var _renderComponent28 = renderComponent({
|
|
342
|
-
from: (0, _utils.xy)(-5, -10),
|
|
343
|
-
to: (0, _utils.xy)(-15, -20)
|
|
344
|
-
}),
|
|
345
|
-
container = _renderComponent28.container;
|
|
346
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
347
|
-
});
|
|
348
|
-
it('renders with zero coordinates', function () {
|
|
349
|
-
var _renderComponent29 = renderComponent({
|
|
350
|
-
from: (0, _utils.xy)(0, 0),
|
|
351
|
-
to: (0, _utils.xy)(0, 0)
|
|
352
|
-
}),
|
|
353
|
-
container = _renderComponent29.container;
|
|
354
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
355
|
-
});
|
|
356
|
-
it('renders with decimal coordinates', function () {
|
|
357
|
-
var _renderComponent30 = renderComponent({
|
|
358
|
-
from: {
|
|
359
|
-
x: 1.5,
|
|
360
|
-
y: 2.7
|
|
361
|
-
},
|
|
362
|
-
to: {
|
|
363
|
-
x: 3.2,
|
|
364
|
-
y: 4.9
|
|
365
|
-
}
|
|
366
|
-
}),
|
|
367
|
-
container = _renderComponent30.container;
|
|
368
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
369
|
-
});
|
|
370
|
-
it('renders with large coordinates', function () {
|
|
371
|
-
var _renderComponent31 = renderComponent({
|
|
372
|
-
from: (0, _utils.xy)(1000, 1000),
|
|
373
|
-
to: (0, _utils.xy)(2000, 2000)
|
|
374
|
-
}),
|
|
375
|
-
container = _renderComponent31.container;
|
|
376
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
377
|
-
});
|
|
378
|
-
it('renders with mixed coordinate signs', function () {
|
|
379
|
-
var _renderComponent32 = renderComponent({
|
|
380
|
-
from: (0, _utils.xy)(-5, 10),
|
|
381
|
-
to: (0, _utils.xy)(15, -20)
|
|
382
|
-
}),
|
|
383
|
-
container = _renderComponent32.container;
|
|
384
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
385
|
-
});
|
|
386
|
-
it('renders with very close points', function () {
|
|
387
|
-
var _renderComponent33 = renderComponent({
|
|
388
|
-
from: {
|
|
389
|
-
x: 5,
|
|
390
|
-
y: 5
|
|
391
|
-
},
|
|
392
|
-
to: {
|
|
393
|
-
x: 5.01,
|
|
394
|
-
y: 5.01
|
|
395
|
-
}
|
|
396
|
-
}),
|
|
397
|
-
container = _renderComponent33.container;
|
|
398
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
399
|
-
});
|
|
400
|
-
it('renders with very far points', function () {
|
|
401
|
-
var _renderComponent34 = renderComponent({
|
|
402
|
-
from: (0, _utils.xy)(0, 0),
|
|
403
|
-
to: (0, _utils.xy)(10000, 10000)
|
|
404
|
-
}),
|
|
405
|
-
container = _renderComponent34.container;
|
|
406
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
407
|
-
});
|
|
408
|
-
});
|
|
409
|
-
describe('states', function () {
|
|
410
|
-
it('renders in building state', function () {
|
|
411
|
-
var _renderComponent35 = renderComponent({
|
|
412
|
-
building: true
|
|
413
|
-
}),
|
|
414
|
-
container = _renderComponent35.container;
|
|
415
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
416
|
-
});
|
|
417
|
-
it('renders in completed state', function () {
|
|
418
|
-
var _renderComponent36 = renderComponent({
|
|
419
|
-
building: false
|
|
420
|
-
}),
|
|
421
|
-
container = _renderComponent36.container;
|
|
422
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
423
|
-
});
|
|
424
|
-
it('renders in disabled state', function () {
|
|
425
|
-
var _renderComponent37 = renderComponent({
|
|
426
|
-
disabled: true
|
|
427
|
-
}),
|
|
428
|
-
container = _renderComponent37.container;
|
|
429
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
430
|
-
});
|
|
431
|
-
it('renders in enabled state', function () {
|
|
432
|
-
var _renderComponent38 = renderComponent({
|
|
433
|
-
disabled: false
|
|
434
|
-
}),
|
|
435
|
-
container = _renderComponent38.container;
|
|
436
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
437
|
-
});
|
|
438
|
-
it('renders with building and disabled', function () {
|
|
439
|
-
var _renderComponent39 = renderComponent({
|
|
440
|
-
building: true,
|
|
441
|
-
disabled: true
|
|
442
|
-
}),
|
|
443
|
-
container = _renderComponent39.container;
|
|
444
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
445
|
-
});
|
|
446
|
-
it('renders with correctness correct', function () {
|
|
447
|
-
var _renderComponent40 = renderComponent({
|
|
448
|
-
correctness: 'correct'
|
|
449
|
-
}),
|
|
450
|
-
container = _renderComponent40.container;
|
|
451
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
452
|
-
});
|
|
453
|
-
it('renders with correctness incorrect', function () {
|
|
454
|
-
var _renderComponent41 = renderComponent({
|
|
455
|
-
correctness: 'incorrect'
|
|
456
|
-
}),
|
|
457
|
-
container = _renderComponent41.container;
|
|
458
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
459
|
-
});
|
|
460
|
-
it('renders with correctness partial', function () {
|
|
461
|
-
var _renderComponent42 = renderComponent({
|
|
462
|
-
correctness: 'partial'
|
|
463
|
-
}),
|
|
464
|
-
container = _renderComponent42.container;
|
|
465
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
466
|
-
});
|
|
467
|
-
it('renders without correctness', function () {
|
|
468
|
-
var _renderComponent43 = renderComponent({
|
|
469
|
-
correctness: undefined
|
|
470
|
-
}),
|
|
471
|
-
container = _renderComponent43.container;
|
|
472
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
473
|
-
});
|
|
474
|
-
});
|
|
475
|
-
describe('edge cases', function () {
|
|
476
|
-
it('handles null labelNode', function () {
|
|
477
|
-
var _renderComponent44 = renderComponent({
|
|
478
|
-
labelNode: null,
|
|
479
|
-
from: fromWithLabel,
|
|
480
|
-
to: toWithLabel
|
|
481
|
-
}),
|
|
482
|
-
container = _renderComponent44.container;
|
|
483
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
484
|
-
});
|
|
485
|
-
it('handles undefined labelNode', function () {
|
|
486
|
-
var _renderComponent45 = renderComponent({
|
|
487
|
-
labelNode: undefined,
|
|
488
|
-
from: fromWithLabel,
|
|
489
|
-
to: toWithLabel
|
|
490
|
-
}),
|
|
491
|
-
container = _renderComponent45.container;
|
|
492
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
493
|
-
});
|
|
494
|
-
it('handles missing from coordinates', function () {
|
|
495
|
-
var _renderComponent46 = renderComponent({
|
|
496
|
-
from: {},
|
|
497
|
-
to: (0, _utils.xy)(1, 1)
|
|
498
|
-
}),
|
|
499
|
-
container = _renderComponent46.container;
|
|
500
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
501
|
-
});
|
|
502
|
-
it('handles all props undefined except required', function () {
|
|
503
|
-
var _renderComponent47 = renderComponent({
|
|
504
|
-
building: undefined,
|
|
505
|
-
disabled: undefined,
|
|
506
|
-
correctness: undefined,
|
|
507
|
-
coordinatesOnHover: undefined,
|
|
508
|
-
labelModeEnabled: undefined,
|
|
509
|
-
limitLabeling: undefined
|
|
510
|
-
}),
|
|
511
|
-
container = _renderComponent47.container;
|
|
512
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
513
|
-
});
|
|
514
|
-
it('renders with custom classes', function () {
|
|
515
|
-
var _renderComponent48 = renderComponent({
|
|
516
|
-
classes: {
|
|
517
|
-
root: 'custom-root'
|
|
518
|
-
}
|
|
519
|
-
}),
|
|
520
|
-
container = _renderComponent48.container;
|
|
521
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
522
|
-
});
|
|
523
|
-
it('renders with empty classes', function () {
|
|
524
|
-
var _renderComponent49 = renderComponent({
|
|
525
|
-
classes: {}
|
|
526
|
-
}),
|
|
527
|
-
container = _renderComponent49.container;
|
|
528
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
529
|
-
});
|
|
530
|
-
it('handles middle point without label', function () {
|
|
531
|
-
var middle = {
|
|
532
|
-
x: 0.5,
|
|
533
|
-
y: 0.5
|
|
534
|
-
};
|
|
535
|
-
var _renderComponent50 = renderComponent({
|
|
536
|
-
labelNode: labelNode,
|
|
537
|
-
middle: middle
|
|
538
|
-
}),
|
|
539
|
-
container = _renderComponent50.container;
|
|
540
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
541
|
-
});
|
|
542
|
-
it('renders with all label types simultaneously', function () {
|
|
543
|
-
var middle = {
|
|
544
|
-
x: 0.5,
|
|
545
|
-
y: 0.5,
|
|
546
|
-
label: 'M'
|
|
547
|
-
};
|
|
548
|
-
var _renderComponent51 = renderComponent({
|
|
549
|
-
labelNode: labelNode,
|
|
550
|
-
from: fromWithLabel,
|
|
551
|
-
to: toWithLabel,
|
|
552
|
-
middle: middle,
|
|
553
|
-
labelModeEnabled: true
|
|
554
|
-
}),
|
|
555
|
-
container = _renderComponent51.container;
|
|
556
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
557
|
-
});
|
|
558
|
-
});
|
|
559
|
-
describe('integration', function () {
|
|
560
|
-
it('renders complete circle with all features', function () {
|
|
561
|
-
var middle = {
|
|
562
|
-
x: 0.5,
|
|
563
|
-
y: 0.5,
|
|
564
|
-
label: 'Middle'
|
|
565
|
-
};
|
|
566
|
-
var _renderComponent52 = renderComponent({
|
|
567
|
-
from: fromWithLabel,
|
|
568
|
-
to: toWithLabel,
|
|
569
|
-
middle: middle,
|
|
570
|
-
labelNode: labelNode,
|
|
571
|
-
labelModeEnabled: true,
|
|
572
|
-
coordinatesOnHover: true,
|
|
573
|
-
correctness: 'correct',
|
|
574
|
-
building: false,
|
|
575
|
-
disabled: false,
|
|
576
|
-
onClick: jest.fn(),
|
|
577
|
-
onChange: jest.fn(),
|
|
578
|
-
changeMarkProps: jest.fn(),
|
|
579
|
-
onDragStart: jest.fn(),
|
|
580
|
-
onDragStop: jest.fn()
|
|
581
|
-
}),
|
|
582
|
-
container = _renderComponent52.container;
|
|
583
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
584
|
-
});
|
|
585
|
-
it('renders building circle without labels', function () {
|
|
586
|
-
var _renderComponent53 = renderComponent({
|
|
587
|
-
from: (0, _utils.xy)(0, 0),
|
|
588
|
-
to: (0, _utils.xy)(1, 1),
|
|
589
|
-
building: true,
|
|
590
|
-
disabled: false
|
|
591
|
-
}),
|
|
592
|
-
container = _renderComponent53.container;
|
|
593
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
594
|
-
});
|
|
595
|
-
it('renders disabled circle with labels', function () {
|
|
596
|
-
var _renderComponent54 = renderComponent({
|
|
597
|
-
from: fromWithLabel,
|
|
598
|
-
to: toWithLabel,
|
|
599
|
-
labelNode: labelNode,
|
|
600
|
-
disabled: true,
|
|
601
|
-
building: false
|
|
602
|
-
}),
|
|
603
|
-
container = _renderComponent54.container;
|
|
604
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
605
|
-
});
|
|
606
|
-
});
|
|
607
|
-
|
|
608
|
-
// Note: Instance method tests (dragFrom, dragTo, dragCircle, labelChange, clickPoint)
|
|
609
|
-
// have been removed as they test internal implementation details.
|
|
610
|
-
// These behaviors should be tested through:
|
|
611
|
-
// 1. User interaction tests (drag-and-drop, clicks) - requires complex setup with @dnd-kit
|
|
612
|
-
// 2. Integration/E2E tests
|
|
613
|
-
// The component's public API (onChange, changeMarkProps callbacks) is what matters for RTL testing.
|
|
614
|
-
});
|
|
615
|
-
//# sourceMappingURL=component.test.js.map
|