@pie-lib/graphing 4.1.0-beta.7 → 4.1.0-beta.9
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
- package/src/__tests__/bg.test.jsx +0 -250
- package/src/__tests__/coordinates-label.test.jsx +0 -243
- package/src/__tests__/graph-with-controls.test.jsx +0 -198
- package/src/__tests__/graph.test.jsx +0 -721
- package/src/__tests__/grid-setup.test.jsx +0 -645
- package/src/__tests__/grid.test.jsx +0 -22
- package/src/__tests__/key-legend.test.jsx +0 -260
- package/src/__tests__/label-svg-icon.test.jsx +0 -278
- package/src/__tests__/labels.test.jsx +0 -55
- package/src/__tests__/mark-label.test.jsx +0 -63
- package/src/__tests__/toggle-bar.test.jsx +0 -146
- package/src/__tests__/tool-menu.test.jsx +0 -115
- package/src/__tests__/undo-redo.test.jsx +0 -24
- package/src/__tests__/use-debounce.test.js +0 -21
- package/src/__tests__/utils.js +0 -41
- package/src/__tests__/utils.test.js +0 -105
- package/src/axis/__tests__/arrow.test.jsx +0 -38
- package/src/axis/__tests__/axes.test.jsx +0 -216
- package/src/container/__tests__/actions.test.js +0 -105
- package/src/container/__tests__/index.test.jsx +0 -319
- package/src/container/__tests__/marks.test.js +0 -172
- package/src/container/__tests__/middleware.test.js +0 -235
- package/src/container/__tests__/reducer.test.js +0 -324
- package/src/tools/absolute/__tests__/component.test.jsx +0 -53
- package/src/tools/circle/__tests__/bg-circle.test.jsx +0 -26
- package/src/tools/circle/__tests__/component.test.jsx +0 -494
- package/src/tools/circle/__tests__/index.test.js +0 -480
- package/src/tools/exponential/__tests__/component.test.jsx +0 -53
- package/src/tools/exponential/__tests__/index.test.js +0 -729
- package/src/tools/line/__tests__/component.test.jsx +0 -37
- package/src/tools/parabola/__tests__/component.test.jsx +0 -48
- package/src/tools/parabola/__tests__/index.test.js +0 -470
- package/src/tools/point/__tests__/component.test.jsx +0 -349
- package/src/tools/point/__tests__/index.test.js +0 -241
- package/src/tools/polygon/__tests__/component.test.jsx +0 -471
- package/src/tools/polygon/__tests__/index.test.js +0 -294
- package/src/tools/polygon/__tests__/line.test.jsx +0 -35
- package/src/tools/polygon/__tests__/polygon.test.jsx +0 -61
- package/src/tools/ray/__tests__/component.test.jsx +0 -29
- package/src/tools/segment/__tests__/component.test.jsx +0 -28
- package/src/tools/shared/__tests__/arrow-head.test.jsx +0 -31
- package/src/tools/shared/line/__tests__/index.test.jsx +0 -109
- package/src/tools/shared/line/__tests__/line-path.test.jsx +0 -53
- package/src/tools/shared/line/__tests__/with-root-edge.test.jsx +0 -73
- package/src/tools/shared/point/__tests__/arrow-point.test.jsx +0 -91
- package/src/tools/shared/point/__tests__/base-point.test.jsx +0 -87
- package/src/tools/sine/__tests__/component.test.jsx +0 -51
- package/src/tools/vector/__tests__/component.test.jsx +0 -25
|
@@ -1,828 +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 _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
6
|
-
var _index = require("../index");
|
|
7
|
-
var _utils = require("../../../utils");
|
|
8
|
-
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; }
|
|
9
|
-
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; }
|
|
10
|
-
jest.mock('../../../utils', function () {
|
|
11
|
-
return {
|
|
12
|
-
equalPoints: jest.fn(),
|
|
13
|
-
sameAxes: jest.fn()
|
|
14
|
-
};
|
|
15
|
-
});
|
|
16
|
-
jest.mock('debug', function () {
|
|
17
|
-
return jest.fn(function () {
|
|
18
|
-
return jest.fn();
|
|
19
|
-
});
|
|
20
|
-
});
|
|
21
|
-
describe('exponential tool', function () {
|
|
22
|
-
var exponentialTool;
|
|
23
|
-
beforeEach(function () {
|
|
24
|
-
jest.clearAllMocks();
|
|
25
|
-
exponentialTool = (0, _index.tool)();
|
|
26
|
-
});
|
|
27
|
-
describe('tool configuration', function () {
|
|
28
|
-
it('creates a tool object', function () {
|
|
29
|
-
expect(exponentialTool).toBeDefined();
|
|
30
|
-
expect((0, _typeof2["default"])(exponentialTool)).toBe('object');
|
|
31
|
-
});
|
|
32
|
-
it('has type exponential', function () {
|
|
33
|
-
expect(exponentialTool.type).toBe('exponential');
|
|
34
|
-
});
|
|
35
|
-
it('has a Component', function () {
|
|
36
|
-
expect(exponentialTool.Component).toBeDefined();
|
|
37
|
-
});
|
|
38
|
-
it('has complete function', function () {
|
|
39
|
-
expect((0, _typeof2["default"])(exponentialTool.complete)).toBe('function');
|
|
40
|
-
});
|
|
41
|
-
it('has addPoint function', function () {
|
|
42
|
-
expect((0, _typeof2["default"])(exponentialTool.addPoint)).toBe('function');
|
|
43
|
-
});
|
|
44
|
-
it('does not have hover function', function () {
|
|
45
|
-
expect(exponentialTool.hover).toBeUndefined();
|
|
46
|
-
});
|
|
47
|
-
});
|
|
48
|
-
describe('complete', function () {
|
|
49
|
-
it('marks exponential as complete', function () {
|
|
50
|
-
var data = {
|
|
51
|
-
x: 5,
|
|
52
|
-
y: 10
|
|
53
|
-
};
|
|
54
|
-
var mark = {
|
|
55
|
-
type: 'exponential',
|
|
56
|
-
root: {
|
|
57
|
-
x: 0,
|
|
58
|
-
y: 1
|
|
59
|
-
},
|
|
60
|
-
edge: {
|
|
61
|
-
x: 5,
|
|
62
|
-
y: 10
|
|
63
|
-
},
|
|
64
|
-
building: true,
|
|
65
|
-
closed: false
|
|
66
|
-
};
|
|
67
|
-
var result = exponentialTool.complete(data, mark);
|
|
68
|
-
expect(result).toEqual(_objectSpread(_objectSpread({}, mark), {}, {
|
|
69
|
-
building: false,
|
|
70
|
-
closed: true
|
|
71
|
-
}));
|
|
72
|
-
});
|
|
73
|
-
it('sets building to false', function () {
|
|
74
|
-
var mark = {
|
|
75
|
-
type: 'exponential',
|
|
76
|
-
root: {
|
|
77
|
-
x: 0,
|
|
78
|
-
y: 1
|
|
79
|
-
},
|
|
80
|
-
building: true
|
|
81
|
-
};
|
|
82
|
-
var result = exponentialTool.complete({}, mark);
|
|
83
|
-
expect(result.building).toBe(false);
|
|
84
|
-
});
|
|
85
|
-
it('sets closed to true', function () {
|
|
86
|
-
var mark = {
|
|
87
|
-
type: 'exponential',
|
|
88
|
-
root: {
|
|
89
|
-
x: 0,
|
|
90
|
-
y: 1
|
|
91
|
-
},
|
|
92
|
-
closed: false
|
|
93
|
-
};
|
|
94
|
-
var result = exponentialTool.complete({}, mark);
|
|
95
|
-
expect(result.closed).toBe(true);
|
|
96
|
-
});
|
|
97
|
-
it('preserves mark properties', function () {
|
|
98
|
-
var mark = {
|
|
99
|
-
type: 'exponential',
|
|
100
|
-
root: {
|
|
101
|
-
x: 0,
|
|
102
|
-
y: 1
|
|
103
|
-
},
|
|
104
|
-
edge: {
|
|
105
|
-
x: 5,
|
|
106
|
-
y: 10
|
|
107
|
-
},
|
|
108
|
-
label: 'Exp A',
|
|
109
|
-
correctness: {
|
|
110
|
-
value: 'correct'
|
|
111
|
-
}
|
|
112
|
-
};
|
|
113
|
-
var result = exponentialTool.complete({}, mark);
|
|
114
|
-
expect(result.label).toBe('Exp A');
|
|
115
|
-
expect(result.correctness).toEqual({
|
|
116
|
-
value: 'correct'
|
|
117
|
-
});
|
|
118
|
-
expect(result.root).toEqual(mark.root);
|
|
119
|
-
expect(result.edge).toEqual(mark.edge);
|
|
120
|
-
});
|
|
121
|
-
it('does not mutate original mark', function () {
|
|
122
|
-
var mark = {
|
|
123
|
-
type: 'exponential',
|
|
124
|
-
root: {
|
|
125
|
-
x: 0,
|
|
126
|
-
y: 1
|
|
127
|
-
},
|
|
128
|
-
building: true,
|
|
129
|
-
closed: false
|
|
130
|
-
};
|
|
131
|
-
var originalMark = _objectSpread({}, mark);
|
|
132
|
-
exponentialTool.complete({}, mark);
|
|
133
|
-
expect(mark).toEqual(originalMark);
|
|
134
|
-
});
|
|
135
|
-
});
|
|
136
|
-
describe('addPoint', function () {
|
|
137
|
-
describe('first point (creating root)', function () {
|
|
138
|
-
it('creates new exponential mark when no mark exists', function () {
|
|
139
|
-
var point = {
|
|
140
|
-
x: 0,
|
|
141
|
-
y: 5
|
|
142
|
-
};
|
|
143
|
-
var mark = null;
|
|
144
|
-
_utils.equalPoints.mockReturnValue(false);
|
|
145
|
-
_utils.sameAxes.mockReturnValue(false);
|
|
146
|
-
var result = exponentialTool.addPoint(point, mark);
|
|
147
|
-
expect(result).toEqual({
|
|
148
|
-
type: 'exponential',
|
|
149
|
-
root: point,
|
|
150
|
-
edge: undefined,
|
|
151
|
-
closed: false,
|
|
152
|
-
building: true
|
|
153
|
-
});
|
|
154
|
-
});
|
|
155
|
-
it('creates mark with building true', function () {
|
|
156
|
-
var point = {
|
|
157
|
-
x: 2,
|
|
158
|
-
y: 3
|
|
159
|
-
};
|
|
160
|
-
_utils.equalPoints.mockReturnValue(false);
|
|
161
|
-
_utils.sameAxes.mockReturnValue(false);
|
|
162
|
-
var result = exponentialTool.addPoint(point, null);
|
|
163
|
-
expect(result.building).toBe(true);
|
|
164
|
-
});
|
|
165
|
-
it('creates mark with closed false', function () {
|
|
166
|
-
var point = {
|
|
167
|
-
x: 2,
|
|
168
|
-
y: 3
|
|
169
|
-
};
|
|
170
|
-
_utils.equalPoints.mockReturnValue(false);
|
|
171
|
-
_utils.sameAxes.mockReturnValue(false);
|
|
172
|
-
var result = exponentialTool.addPoint(point, null);
|
|
173
|
-
expect(result.closed).toBe(false);
|
|
174
|
-
});
|
|
175
|
-
it('creates mark with undefined edge', function () {
|
|
176
|
-
var point = {
|
|
177
|
-
x: 2,
|
|
178
|
-
y: 3
|
|
179
|
-
};
|
|
180
|
-
_utils.equalPoints.mockReturnValue(false);
|
|
181
|
-
_utils.sameAxes.mockReturnValue(false);
|
|
182
|
-
var result = exponentialTool.addPoint(point, null);
|
|
183
|
-
expect(result.edge).toBeUndefined();
|
|
184
|
-
});
|
|
185
|
-
it('works with positive coordinates', function () {
|
|
186
|
-
var point = {
|
|
187
|
-
x: 5,
|
|
188
|
-
y: 10
|
|
189
|
-
};
|
|
190
|
-
_utils.equalPoints.mockReturnValue(false);
|
|
191
|
-
_utils.sameAxes.mockReturnValue(false);
|
|
192
|
-
var result = exponentialTool.addPoint(point, null);
|
|
193
|
-
expect(result.root).toEqual(point);
|
|
194
|
-
});
|
|
195
|
-
it('works with negative y coordinate', function () {
|
|
196
|
-
var point = {
|
|
197
|
-
x: 5,
|
|
198
|
-
y: -10
|
|
199
|
-
};
|
|
200
|
-
_utils.equalPoints.mockReturnValue(false);
|
|
201
|
-
_utils.sameAxes.mockReturnValue(false);
|
|
202
|
-
var result = exponentialTool.addPoint(point, null);
|
|
203
|
-
expect(result.root).toEqual(point);
|
|
204
|
-
});
|
|
205
|
-
it('works with decimal coordinates', function () {
|
|
206
|
-
var point = {
|
|
207
|
-
x: 3.5,
|
|
208
|
-
y: 7.25
|
|
209
|
-
};
|
|
210
|
-
_utils.equalPoints.mockReturnValue(false);
|
|
211
|
-
_utils.sameAxes.mockReturnValue(false);
|
|
212
|
-
var result = exponentialTool.addPoint(point, null);
|
|
213
|
-
expect(result.root).toEqual(point);
|
|
214
|
-
});
|
|
215
|
-
});
|
|
216
|
-
describe('second point (completing exponential)', function () {
|
|
217
|
-
it('completes exponential when adding edge point', function () {
|
|
218
|
-
var root = {
|
|
219
|
-
x: 0,
|
|
220
|
-
y: 1
|
|
221
|
-
};
|
|
222
|
-
var edge = {
|
|
223
|
-
x: 5,
|
|
224
|
-
y: 10
|
|
225
|
-
};
|
|
226
|
-
var mark = {
|
|
227
|
-
type: 'exponential',
|
|
228
|
-
root: root,
|
|
229
|
-
edge: undefined,
|
|
230
|
-
closed: false,
|
|
231
|
-
building: true
|
|
232
|
-
};
|
|
233
|
-
_utils.equalPoints.mockReturnValue(false);
|
|
234
|
-
_utils.sameAxes.mockReturnValue(false);
|
|
235
|
-
var result = exponentialTool.addPoint(edge, mark);
|
|
236
|
-
expect(result).toEqual(_objectSpread(_objectSpread({}, mark), {}, {
|
|
237
|
-
edge: edge,
|
|
238
|
-
closed: true,
|
|
239
|
-
building: false
|
|
240
|
-
}));
|
|
241
|
-
});
|
|
242
|
-
it('sets building to false', function () {
|
|
243
|
-
var mark = {
|
|
244
|
-
type: 'exponential',
|
|
245
|
-
root: {
|
|
246
|
-
x: 0,
|
|
247
|
-
y: 1
|
|
248
|
-
},
|
|
249
|
-
building: true
|
|
250
|
-
};
|
|
251
|
-
var point = {
|
|
252
|
-
x: 5,
|
|
253
|
-
y: 10
|
|
254
|
-
};
|
|
255
|
-
_utils.equalPoints.mockReturnValue(false);
|
|
256
|
-
_utils.sameAxes.mockReturnValue(false);
|
|
257
|
-
var result = exponentialTool.addPoint(point, mark);
|
|
258
|
-
expect(result.building).toBe(false);
|
|
259
|
-
});
|
|
260
|
-
it('sets closed to true', function () {
|
|
261
|
-
var mark = {
|
|
262
|
-
type: 'exponential',
|
|
263
|
-
root: {
|
|
264
|
-
x: 0,
|
|
265
|
-
y: 1
|
|
266
|
-
},
|
|
267
|
-
closed: false
|
|
268
|
-
};
|
|
269
|
-
var point = {
|
|
270
|
-
x: 5,
|
|
271
|
-
y: 10
|
|
272
|
-
};
|
|
273
|
-
_utils.equalPoints.mockReturnValue(false);
|
|
274
|
-
_utils.sameAxes.mockReturnValue(false);
|
|
275
|
-
var result = exponentialTool.addPoint(point, mark);
|
|
276
|
-
expect(result.closed).toBe(true);
|
|
277
|
-
});
|
|
278
|
-
it('preserves root when adding edge', function () {
|
|
279
|
-
var root = {
|
|
280
|
-
x: 1,
|
|
281
|
-
y: 2
|
|
282
|
-
};
|
|
283
|
-
var mark = {
|
|
284
|
-
type: 'exponential',
|
|
285
|
-
root: root,
|
|
286
|
-
building: true
|
|
287
|
-
};
|
|
288
|
-
var edge = {
|
|
289
|
-
x: 5,
|
|
290
|
-
y: 8
|
|
291
|
-
};
|
|
292
|
-
_utils.equalPoints.mockReturnValue(false);
|
|
293
|
-
_utils.sameAxes.mockReturnValue(false);
|
|
294
|
-
var result = exponentialTool.addPoint(edge, mark);
|
|
295
|
-
expect(result.root).toEqual(root);
|
|
296
|
-
expect(result.edge).toEqual(edge);
|
|
297
|
-
});
|
|
298
|
-
it('preserves mark properties', function () {
|
|
299
|
-
var mark = {
|
|
300
|
-
type: 'exponential',
|
|
301
|
-
root: {
|
|
302
|
-
x: 0,
|
|
303
|
-
y: 1
|
|
304
|
-
},
|
|
305
|
-
label: 'Exp 1',
|
|
306
|
-
correctness: {
|
|
307
|
-
value: 'correct'
|
|
308
|
-
}
|
|
309
|
-
};
|
|
310
|
-
var point = {
|
|
311
|
-
x: 5,
|
|
312
|
-
y: 10
|
|
313
|
-
};
|
|
314
|
-
_utils.equalPoints.mockReturnValue(false);
|
|
315
|
-
_utils.sameAxes.mockReturnValue(false);
|
|
316
|
-
var result = exponentialTool.addPoint(point, mark);
|
|
317
|
-
expect(result.label).toBe('Exp 1');
|
|
318
|
-
expect(result.correctness).toEqual({
|
|
319
|
-
value: 'correct'
|
|
320
|
-
});
|
|
321
|
-
});
|
|
322
|
-
});
|
|
323
|
-
describe('same point handling', function () {
|
|
324
|
-
it('returns same mark when clicking equal point', function () {
|
|
325
|
-
var point = {
|
|
326
|
-
x: 5,
|
|
327
|
-
y: 10
|
|
328
|
-
};
|
|
329
|
-
var mark = {
|
|
330
|
-
type: 'exponential',
|
|
331
|
-
root: point,
|
|
332
|
-
building: true
|
|
333
|
-
};
|
|
334
|
-
_utils.equalPoints.mockReturnValue(true);
|
|
335
|
-
_utils.sameAxes.mockReturnValue(false);
|
|
336
|
-
var result = exponentialTool.addPoint(point, mark);
|
|
337
|
-
expect(result).toBe(mark);
|
|
338
|
-
});
|
|
339
|
-
it('returns same mark when clicking point on same axis', function () {
|
|
340
|
-
var mark = {
|
|
341
|
-
type: 'exponential',
|
|
342
|
-
root: {
|
|
343
|
-
x: 5,
|
|
344
|
-
y: 10
|
|
345
|
-
},
|
|
346
|
-
building: true
|
|
347
|
-
};
|
|
348
|
-
var point = {
|
|
349
|
-
x: 8,
|
|
350
|
-
y: 10
|
|
351
|
-
}; // same y
|
|
352
|
-
_utils.equalPoints.mockReturnValue(false);
|
|
353
|
-
_utils.sameAxes.mockReturnValue(true);
|
|
354
|
-
var result = exponentialTool.addPoint(point, mark);
|
|
355
|
-
expect(result).toBe(mark);
|
|
356
|
-
});
|
|
357
|
-
it('calls equalPoints with correct arguments', function () {
|
|
358
|
-
var point = {
|
|
359
|
-
x: 5,
|
|
360
|
-
y: 10
|
|
361
|
-
};
|
|
362
|
-
var mark = {
|
|
363
|
-
type: 'exponential',
|
|
364
|
-
root: {
|
|
365
|
-
x: 5,
|
|
366
|
-
y: 10
|
|
367
|
-
},
|
|
368
|
-
building: true
|
|
369
|
-
};
|
|
370
|
-
_utils.equalPoints.mockReturnValue(true);
|
|
371
|
-
exponentialTool.addPoint(point, mark);
|
|
372
|
-
expect(_utils.equalPoints).toHaveBeenCalledWith(mark.root, point);
|
|
373
|
-
});
|
|
374
|
-
it('calls sameAxes with correct arguments', function () {
|
|
375
|
-
var point = {
|
|
376
|
-
x: 8,
|
|
377
|
-
y: 10
|
|
378
|
-
};
|
|
379
|
-
var mark = {
|
|
380
|
-
type: 'exponential',
|
|
381
|
-
root: {
|
|
382
|
-
x: 5,
|
|
383
|
-
y: 10
|
|
384
|
-
},
|
|
385
|
-
building: true
|
|
386
|
-
};
|
|
387
|
-
_utils.equalPoints.mockReturnValue(false);
|
|
388
|
-
_utils.sameAxes.mockReturnValue(true);
|
|
389
|
-
exponentialTool.addPoint(point, mark);
|
|
390
|
-
expect(_utils.sameAxes).toHaveBeenCalledWith(mark.root, point);
|
|
391
|
-
});
|
|
392
|
-
});
|
|
393
|
-
describe('opposite sign y-coordinates', function () {
|
|
394
|
-
it('returns same mark when root and point have opposite sign y', function () {
|
|
395
|
-
var mark = {
|
|
396
|
-
type: 'exponential',
|
|
397
|
-
root: {
|
|
398
|
-
x: 0,
|
|
399
|
-
y: 5
|
|
400
|
-
},
|
|
401
|
-
// positive y
|
|
402
|
-
building: true
|
|
403
|
-
};
|
|
404
|
-
var point = {
|
|
405
|
-
x: 5,
|
|
406
|
-
y: -10
|
|
407
|
-
}; // negative y
|
|
408
|
-
_utils.equalPoints.mockReturnValue(false);
|
|
409
|
-
_utils.sameAxes.mockReturnValue(false);
|
|
410
|
-
var result = exponentialTool.addPoint(point, mark);
|
|
411
|
-
expect(result).toBe(mark);
|
|
412
|
-
});
|
|
413
|
-
it('returns same mark when root is negative and point is positive', function () {
|
|
414
|
-
var mark = {
|
|
415
|
-
type: 'exponential',
|
|
416
|
-
root: {
|
|
417
|
-
x: 0,
|
|
418
|
-
y: -5
|
|
419
|
-
},
|
|
420
|
-
// negative y
|
|
421
|
-
building: true
|
|
422
|
-
};
|
|
423
|
-
var point = {
|
|
424
|
-
x: 5,
|
|
425
|
-
y: 10
|
|
426
|
-
}; // positive y
|
|
427
|
-
_utils.equalPoints.mockReturnValue(false);
|
|
428
|
-
_utils.sameAxes.mockReturnValue(false);
|
|
429
|
-
var result = exponentialTool.addPoint(point, mark);
|
|
430
|
-
expect(result).toBe(mark);
|
|
431
|
-
});
|
|
432
|
-
it('allows points with same sign y (both positive)', function () {
|
|
433
|
-
var mark = {
|
|
434
|
-
type: 'exponential',
|
|
435
|
-
root: {
|
|
436
|
-
x: 0,
|
|
437
|
-
y: 5
|
|
438
|
-
},
|
|
439
|
-
building: true
|
|
440
|
-
};
|
|
441
|
-
var point = {
|
|
442
|
-
x: 5,
|
|
443
|
-
y: 10
|
|
444
|
-
};
|
|
445
|
-
_utils.equalPoints.mockReturnValue(false);
|
|
446
|
-
_utils.sameAxes.mockReturnValue(false);
|
|
447
|
-
var result = exponentialTool.addPoint(point, mark);
|
|
448
|
-
expect(result.edge).toEqual(point);
|
|
449
|
-
expect(result.building).toBe(false);
|
|
450
|
-
});
|
|
451
|
-
it('allows points with same sign y (both negative)', function () {
|
|
452
|
-
var mark = {
|
|
453
|
-
type: 'exponential',
|
|
454
|
-
root: {
|
|
455
|
-
x: 0,
|
|
456
|
-
y: -5
|
|
457
|
-
},
|
|
458
|
-
building: true
|
|
459
|
-
};
|
|
460
|
-
var point = {
|
|
461
|
-
x: 5,
|
|
462
|
-
y: -10
|
|
463
|
-
};
|
|
464
|
-
_utils.equalPoints.mockReturnValue(false);
|
|
465
|
-
_utils.sameAxes.mockReturnValue(false);
|
|
466
|
-
var result = exponentialTool.addPoint(point, mark);
|
|
467
|
-
expect(result.edge).toEqual(point);
|
|
468
|
-
expect(result.building).toBe(false);
|
|
469
|
-
});
|
|
470
|
-
});
|
|
471
|
-
describe('zero y-coordinate handling', function () {
|
|
472
|
-
it('returns same mark when point has y = 0', function () {
|
|
473
|
-
var mark = {
|
|
474
|
-
type: 'exponential',
|
|
475
|
-
root: {
|
|
476
|
-
x: 0,
|
|
477
|
-
y: 5
|
|
478
|
-
},
|
|
479
|
-
building: true
|
|
480
|
-
};
|
|
481
|
-
var point = {
|
|
482
|
-
x: 5,
|
|
483
|
-
y: 0
|
|
484
|
-
};
|
|
485
|
-
_utils.equalPoints.mockReturnValue(false);
|
|
486
|
-
_utils.sameAxes.mockReturnValue(false);
|
|
487
|
-
var result = exponentialTool.addPoint(point, mark);
|
|
488
|
-
expect(result).toBe(mark);
|
|
489
|
-
});
|
|
490
|
-
it('prevents adding point with zero y', function () {
|
|
491
|
-
var point = {
|
|
492
|
-
x: 5,
|
|
493
|
-
y: 0
|
|
494
|
-
};
|
|
495
|
-
var mark = {
|
|
496
|
-
type: 'exponential',
|
|
497
|
-
root: {
|
|
498
|
-
x: 1,
|
|
499
|
-
y: 2
|
|
500
|
-
},
|
|
501
|
-
building: true
|
|
502
|
-
};
|
|
503
|
-
_utils.equalPoints.mockReturnValue(false);
|
|
504
|
-
_utils.sameAxes.mockReturnValue(false);
|
|
505
|
-
var result = exponentialTool.addPoint(point, mark);
|
|
506
|
-
expect(result).toBe(mark);
|
|
507
|
-
expect(result.edge).toBeUndefined();
|
|
508
|
-
});
|
|
509
|
-
it('prevents creating root with zero y', function () {
|
|
510
|
-
var point = {
|
|
511
|
-
x: 5,
|
|
512
|
-
y: 0
|
|
513
|
-
};
|
|
514
|
-
_utils.equalPoints.mockReturnValue(false);
|
|
515
|
-
_utils.sameAxes.mockReturnValue(false);
|
|
516
|
-
var result = exponentialTool.addPoint(point, null);
|
|
517
|
-
expect(result).toBeNull();
|
|
518
|
-
});
|
|
519
|
-
it('allows positive y values close to zero', function () {
|
|
520
|
-
var point = {
|
|
521
|
-
x: 5,
|
|
522
|
-
y: 0.001
|
|
523
|
-
};
|
|
524
|
-
_utils.equalPoints.mockReturnValue(false);
|
|
525
|
-
_utils.sameAxes.mockReturnValue(false);
|
|
526
|
-
var result = exponentialTool.addPoint(point, null);
|
|
527
|
-
expect(result.root).toEqual(point);
|
|
528
|
-
});
|
|
529
|
-
it('allows negative y values close to zero', function () {
|
|
530
|
-
var point = {
|
|
531
|
-
x: 5,
|
|
532
|
-
y: -0.001
|
|
533
|
-
};
|
|
534
|
-
_utils.equalPoints.mockReturnValue(false);
|
|
535
|
-
_utils.sameAxes.mockReturnValue(false);
|
|
536
|
-
var result = exponentialTool.addPoint(point, null);
|
|
537
|
-
expect(result.root).toEqual(point);
|
|
538
|
-
});
|
|
539
|
-
});
|
|
540
|
-
describe('error handling', function () {
|
|
541
|
-
it('throws error when mark has no root', function () {
|
|
542
|
-
var mark = {
|
|
543
|
-
type: 'exponential',
|
|
544
|
-
building: true
|
|
545
|
-
// root is missing
|
|
546
|
-
};
|
|
547
|
-
var point = {
|
|
548
|
-
x: 5,
|
|
549
|
-
y: 10
|
|
550
|
-
};
|
|
551
|
-
_utils.equalPoints.mockReturnValue(false);
|
|
552
|
-
_utils.sameAxes.mockReturnValue(false);
|
|
553
|
-
expect(function () {
|
|
554
|
-
exponentialTool.addPoint(point, mark);
|
|
555
|
-
}).toThrow(); // Will throw TypeError when accessing undefined.y
|
|
556
|
-
});
|
|
557
|
-
it('throws error when mark root is null', function () {
|
|
558
|
-
var mark = {
|
|
559
|
-
type: 'exponential',
|
|
560
|
-
root: null,
|
|
561
|
-
building: true
|
|
562
|
-
};
|
|
563
|
-
var point = {
|
|
564
|
-
x: 5,
|
|
565
|
-
y: 10
|
|
566
|
-
};
|
|
567
|
-
_utils.equalPoints.mockReturnValue(false);
|
|
568
|
-
_utils.sameAxes.mockReturnValue(false);
|
|
569
|
-
expect(function () {
|
|
570
|
-
exponentialTool.addPoint(point, mark);
|
|
571
|
-
}).toThrow(); // Will throw TypeError when accessing null.y
|
|
572
|
-
});
|
|
573
|
-
it('throws error when mark root is undefined', function () {
|
|
574
|
-
var mark = {
|
|
575
|
-
type: 'exponential',
|
|
576
|
-
root: undefined,
|
|
577
|
-
building: true
|
|
578
|
-
};
|
|
579
|
-
var point = {
|
|
580
|
-
x: 5,
|
|
581
|
-
y: 10
|
|
582
|
-
};
|
|
583
|
-
_utils.equalPoints.mockReturnValue(false);
|
|
584
|
-
_utils.sameAxes.mockReturnValue(false);
|
|
585
|
-
expect(function () {
|
|
586
|
-
exponentialTool.addPoint(point, mark);
|
|
587
|
-
}).toThrow(); // Will throw TypeError when accessing undefined.y
|
|
588
|
-
});
|
|
589
|
-
});
|
|
590
|
-
describe('edge cases', function () {
|
|
591
|
-
it('handles undefined mark on first click', function () {
|
|
592
|
-
var point = {
|
|
593
|
-
x: 5,
|
|
594
|
-
y: 10
|
|
595
|
-
};
|
|
596
|
-
_utils.equalPoints.mockReturnValue(false);
|
|
597
|
-
_utils.sameAxes.mockReturnValue(false);
|
|
598
|
-
var result = exponentialTool.addPoint(point, undefined);
|
|
599
|
-
expect(result.type).toBe('exponential');
|
|
600
|
-
expect(result.root).toEqual(point);
|
|
601
|
-
expect(result.building).toBe(true);
|
|
602
|
-
});
|
|
603
|
-
it('handles very large positive y', function () {
|
|
604
|
-
var point = {
|
|
605
|
-
x: 5,
|
|
606
|
-
y: 10000
|
|
607
|
-
};
|
|
608
|
-
_utils.equalPoints.mockReturnValue(false);
|
|
609
|
-
_utils.sameAxes.mockReturnValue(false);
|
|
610
|
-
var result = exponentialTool.addPoint(point, null);
|
|
611
|
-
expect(result.root).toEqual(point);
|
|
612
|
-
});
|
|
613
|
-
it('handles very large negative y', function () {
|
|
614
|
-
var point = {
|
|
615
|
-
x: 5,
|
|
616
|
-
y: -10000
|
|
617
|
-
};
|
|
618
|
-
_utils.equalPoints.mockReturnValue(false);
|
|
619
|
-
_utils.sameAxes.mockReturnValue(false);
|
|
620
|
-
var result = exponentialTool.addPoint(point, null);
|
|
621
|
-
expect(result.root).toEqual(point);
|
|
622
|
-
});
|
|
623
|
-
it('handles negative x coordinates', function () {
|
|
624
|
-
var point = {
|
|
625
|
-
x: -5,
|
|
626
|
-
y: 10
|
|
627
|
-
};
|
|
628
|
-
_utils.equalPoints.mockReturnValue(false);
|
|
629
|
-
_utils.sameAxes.mockReturnValue(false);
|
|
630
|
-
var result = exponentialTool.addPoint(point, null);
|
|
631
|
-
expect(result.root).toEqual(point);
|
|
632
|
-
});
|
|
633
|
-
it('handles mark with existing edge', function () {
|
|
634
|
-
var mark = {
|
|
635
|
-
type: 'exponential',
|
|
636
|
-
root: {
|
|
637
|
-
x: 0,
|
|
638
|
-
y: 1
|
|
639
|
-
},
|
|
640
|
-
edge: {
|
|
641
|
-
x: 3,
|
|
642
|
-
y: 3
|
|
643
|
-
},
|
|
644
|
-
building: false,
|
|
645
|
-
closed: true
|
|
646
|
-
};
|
|
647
|
-
var newEdge = {
|
|
648
|
-
x: 5,
|
|
649
|
-
y: 5
|
|
650
|
-
};
|
|
651
|
-
_utils.equalPoints.mockReturnValue(false);
|
|
652
|
-
_utils.sameAxes.mockReturnValue(false);
|
|
653
|
-
var result = exponentialTool.addPoint(newEdge, mark);
|
|
654
|
-
expect(result.edge).toEqual(newEdge);
|
|
655
|
-
expect(result.closed).toBe(true);
|
|
656
|
-
expect(result.building).toBe(false);
|
|
657
|
-
});
|
|
658
|
-
});
|
|
659
|
-
describe('immutability', function () {
|
|
660
|
-
it('does not mutate original mark when adding edge', function () {
|
|
661
|
-
var mark = {
|
|
662
|
-
type: 'exponential',
|
|
663
|
-
root: {
|
|
664
|
-
x: 0,
|
|
665
|
-
y: 1
|
|
666
|
-
},
|
|
667
|
-
building: true
|
|
668
|
-
};
|
|
669
|
-
var originalMark = _objectSpread({}, mark);
|
|
670
|
-
var point = {
|
|
671
|
-
x: 5,
|
|
672
|
-
y: 10
|
|
673
|
-
};
|
|
674
|
-
_utils.equalPoints.mockReturnValue(false);
|
|
675
|
-
_utils.sameAxes.mockReturnValue(false);
|
|
676
|
-
var result = exponentialTool.addPoint(point, mark);
|
|
677
|
-
expect(mark).toEqual(originalMark);
|
|
678
|
-
expect(result).not.toBe(mark);
|
|
679
|
-
});
|
|
680
|
-
it('does not mutate original mark when returning same', function () {
|
|
681
|
-
var mark = {
|
|
682
|
-
type: 'exponential',
|
|
683
|
-
root: {
|
|
684
|
-
x: 5,
|
|
685
|
-
y: 10
|
|
686
|
-
},
|
|
687
|
-
building: true
|
|
688
|
-
};
|
|
689
|
-
var point = {
|
|
690
|
-
x: 5,
|
|
691
|
-
y: 10
|
|
692
|
-
};
|
|
693
|
-
_utils.equalPoints.mockReturnValue(true);
|
|
694
|
-
var result = exponentialTool.addPoint(point, mark);
|
|
695
|
-
expect(result).toBe(mark);
|
|
696
|
-
});
|
|
697
|
-
});
|
|
698
|
-
});
|
|
699
|
-
describe('integration scenarios', function () {
|
|
700
|
-
it('handles full exponential creation flow', function () {
|
|
701
|
-
_utils.equalPoints.mockReturnValue(false);
|
|
702
|
-
_utils.sameAxes.mockReturnValue(false);
|
|
703
|
-
|
|
704
|
-
// First click - create root
|
|
705
|
-
var firstPoint = {
|
|
706
|
-
x: 0,
|
|
707
|
-
y: 1
|
|
708
|
-
};
|
|
709
|
-
var mark1 = exponentialTool.addPoint(firstPoint, null);
|
|
710
|
-
expect(mark1.root).toEqual(firstPoint);
|
|
711
|
-
expect(mark1.building).toBe(true);
|
|
712
|
-
expect(mark1.closed).toBe(false);
|
|
713
|
-
|
|
714
|
-
// Second click - complete exponential
|
|
715
|
-
var secondPoint = {
|
|
716
|
-
x: 5,
|
|
717
|
-
y: 10
|
|
718
|
-
};
|
|
719
|
-
var mark2 = exponentialTool.addPoint(secondPoint, mark1);
|
|
720
|
-
expect(mark2.root).toEqual(firstPoint);
|
|
721
|
-
expect(mark2.edge).toEqual(secondPoint);
|
|
722
|
-
expect(mark2.building).toBe(false);
|
|
723
|
-
expect(mark2.closed).toBe(true);
|
|
724
|
-
|
|
725
|
-
// Complete
|
|
726
|
-
var mark3 = exponentialTool.complete({}, mark2);
|
|
727
|
-
expect(mark3.building).toBe(false);
|
|
728
|
-
expect(mark3.closed).toBe(true);
|
|
729
|
-
});
|
|
730
|
-
it('handles rejected second point (zero y)', function () {
|
|
731
|
-
_utils.equalPoints.mockReturnValue(false);
|
|
732
|
-
_utils.sameAxes.mockReturnValue(false);
|
|
733
|
-
var firstPoint = {
|
|
734
|
-
x: 0,
|
|
735
|
-
y: 1
|
|
736
|
-
};
|
|
737
|
-
var mark1 = exponentialTool.addPoint(firstPoint, null);
|
|
738
|
-
var secondPoint = {
|
|
739
|
-
x: 5,
|
|
740
|
-
y: 0
|
|
741
|
-
};
|
|
742
|
-
var mark2 = exponentialTool.addPoint(secondPoint, mark1);
|
|
743
|
-
|
|
744
|
-
// Should return unchanged mark
|
|
745
|
-
expect(mark2).toBe(mark1);
|
|
746
|
-
expect(mark2.edge).toBeUndefined();
|
|
747
|
-
});
|
|
748
|
-
it('handles rejected second point (opposite sign)', function () {
|
|
749
|
-
_utils.equalPoints.mockReturnValue(false);
|
|
750
|
-
_utils.sameAxes.mockReturnValue(false);
|
|
751
|
-
var firstPoint = {
|
|
752
|
-
x: 0,
|
|
753
|
-
y: 5
|
|
754
|
-
};
|
|
755
|
-
var mark1 = exponentialTool.addPoint(firstPoint, null);
|
|
756
|
-
var secondPoint = {
|
|
757
|
-
x: 5,
|
|
758
|
-
y: -10
|
|
759
|
-
};
|
|
760
|
-
var mark2 = exponentialTool.addPoint(secondPoint, mark1);
|
|
761
|
-
|
|
762
|
-
// Should return unchanged mark
|
|
763
|
-
expect(mark2).toBe(mark1);
|
|
764
|
-
expect(mark2.edge).toBeUndefined();
|
|
765
|
-
});
|
|
766
|
-
it('handles rejected second point (same axes)', function () {
|
|
767
|
-
_utils.equalPoints.mockReturnValue(false);
|
|
768
|
-
_utils.sameAxes.mockReturnValue(true);
|
|
769
|
-
var firstPoint = {
|
|
770
|
-
x: 0,
|
|
771
|
-
y: 5
|
|
772
|
-
};
|
|
773
|
-
var mark1 = exponentialTool.addPoint(firstPoint, null);
|
|
774
|
-
var secondPoint = {
|
|
775
|
-
x: 10,
|
|
776
|
-
y: 5
|
|
777
|
-
}; // same y
|
|
778
|
-
var mark2 = exponentialTool.addPoint(secondPoint, mark1);
|
|
779
|
-
|
|
780
|
-
// Should return unchanged mark
|
|
781
|
-
expect(mark2).toBe(mark1);
|
|
782
|
-
});
|
|
783
|
-
it('handles exponential with negative y values', function () {
|
|
784
|
-
_utils.equalPoints.mockReturnValue(false);
|
|
785
|
-
_utils.sameAxes.mockReturnValue(false);
|
|
786
|
-
var firstPoint = {
|
|
787
|
-
x: 0,
|
|
788
|
-
y: -1
|
|
789
|
-
};
|
|
790
|
-
var mark1 = exponentialTool.addPoint(firstPoint, null);
|
|
791
|
-
var secondPoint = {
|
|
792
|
-
x: 5,
|
|
793
|
-
y: -10
|
|
794
|
-
};
|
|
795
|
-
var mark2 = exponentialTool.addPoint(secondPoint, mark1);
|
|
796
|
-
expect(mark2.root).toEqual(firstPoint);
|
|
797
|
-
expect(mark2.edge).toEqual(secondPoint);
|
|
798
|
-
expect(mark2.building).toBe(false);
|
|
799
|
-
expect(mark2.closed).toBe(true);
|
|
800
|
-
});
|
|
801
|
-
it('handles exponential with properties', function () {
|
|
802
|
-
_utils.equalPoints.mockReturnValue(false);
|
|
803
|
-
_utils.sameAxes.mockReturnValue(false);
|
|
804
|
-
var firstPoint = {
|
|
805
|
-
x: 0,
|
|
806
|
-
y: 1,
|
|
807
|
-
label: 'Start'
|
|
808
|
-
};
|
|
809
|
-
var mark1 = exponentialTool.addPoint(firstPoint, null);
|
|
810
|
-
|
|
811
|
-
// Add properties
|
|
812
|
-
mark1.label = 'Exp A';
|
|
813
|
-
mark1.correctness = {
|
|
814
|
-
value: 'correct'
|
|
815
|
-
};
|
|
816
|
-
var secondPoint = {
|
|
817
|
-
x: 5,
|
|
818
|
-
y: 10
|
|
819
|
-
};
|
|
820
|
-
var mark2 = exponentialTool.addPoint(secondPoint, mark1);
|
|
821
|
-
expect(mark2.label).toBe('Exp A');
|
|
822
|
-
expect(mark2.correctness).toEqual({
|
|
823
|
-
value: 'correct'
|
|
824
|
-
});
|
|
825
|
-
});
|
|
826
|
-
});
|
|
827
|
-
});
|
|
828
|
-
//# sourceMappingURL=index.test.js.map
|