@pie-lib/graphing-solution-set 4.1.0-beta.8 → 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/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 -184
- package/src/__tests__/graph.test.jsx +0 -93
- package/src/__tests__/grid-setup.test.jsx +0 -645
- package/src/__tests__/grid.test.jsx +0 -23
- package/src/__tests__/labels.test.jsx +0 -41
- package/src/__tests__/mark-label.test.jsx +0 -66
- package/src/__tests__/toggle-bar.test.jsx +0 -106
- package/src/__tests__/tool-menu.test.jsx +0 -453
- package/src/__tests__/undo-redo.test.jsx +0 -26
- 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 -43
- package/src/axis/__tests__/axes.test.jsx +0 -182
- package/src/container/__tests__/actions.test.js +0 -105
- package/src/container/__tests__/index.test.jsx +0 -227
- 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/line/__tests__/component.test.jsx +0 -37
- package/src/tools/polygon/__tests__/component.test.jsx +0 -487
- package/src/tools/polygon/__tests__/index.test.js +0 -65
- package/src/tools/polygon/__tests__/line.test.jsx +0 -23
- package/src/tools/polygon/__tests__/polygon.test.jsx +0 -44
- package/src/tools/shared/__tests__/arrow-head.test.jsx +0 -33
- package/src/tools/shared/line/__tests__/index.test.jsx +0 -553
- package/src/tools/shared/line/__tests__/line-path.test.jsx +0 -56
- package/src/tools/shared/line/__tests__/with-root-edge.test.jsx +0 -488
- package/src/tools/shared/point/__tests__/arrow-point.test.jsx +0 -91
- package/src/tools/shared/point/__tests__/arrow.test.jsx +0 -469
- package/src/tools/shared/point/__tests__/base-point.test.jsx +0 -87
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import { render } from '@pie-lib/test-utils';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
|
|
4
|
-
import Graph, { removeBuildingToolIfCurrentToolDiffers } from '../graph';
|
|
5
|
-
import { toolsArr } from '../tools';
|
|
6
|
-
|
|
7
|
-
// Pure function tests - keep as-is
|
|
8
|
-
describe('removeBuildingToolIfCurrentToolDiffers', () => {
|
|
9
|
-
let marks = [
|
|
10
|
-
{
|
|
11
|
-
type: 'point',
|
|
12
|
-
x: 2,
|
|
13
|
-
y: 2,
|
|
14
|
-
label: 'Point',
|
|
15
|
-
showLabel: true,
|
|
16
|
-
},
|
|
17
|
-
{
|
|
18
|
-
type: 'line',
|
|
19
|
-
from: { x: 0, y: 0 },
|
|
20
|
-
label: 'Line',
|
|
21
|
-
building: true,
|
|
22
|
-
},
|
|
23
|
-
];
|
|
24
|
-
|
|
25
|
-
it('keeps all marks if currentTool is the same', () => {
|
|
26
|
-
expect(removeBuildingToolIfCurrentToolDiffers({ marks, currentTool: { type: 'line' } })).toEqual(marks);
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
it('removes building marks if currentTool is different', () => {
|
|
30
|
-
expect(removeBuildingToolIfCurrentToolDiffers({ marks, currentTool: { type: 'different' } })).toEqual([marks[0]]);
|
|
31
|
-
});
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
// Note: Instance method tests have been removed. Component behavior should be tested
|
|
35
|
-
// through user interactions and integration tests.
|
|
36
|
-
describe('Graph', () => {
|
|
37
|
-
let onChangeMarks = jest.fn();
|
|
38
|
-
|
|
39
|
-
beforeEach(() => {
|
|
40
|
-
onChangeMarks.mockClear();
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
const complete = jest.fn();
|
|
44
|
-
const addPoint = jest.fn();
|
|
45
|
-
const currentTool = toolsArr[0];
|
|
46
|
-
currentTool.complete = complete;
|
|
47
|
-
currentTool.addPoint = addPoint;
|
|
48
|
-
|
|
49
|
-
const props = {
|
|
50
|
-
className: 'className',
|
|
51
|
-
onChangeMarks,
|
|
52
|
-
tools: toolsArr,
|
|
53
|
-
domain: { min: 0, max: 1, step: 1 },
|
|
54
|
-
range: { min: 0, max: 1, step: 1 },
|
|
55
|
-
size: { width: 400, height: 400 },
|
|
56
|
-
currentTool,
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
const renderComponent = (extras) => {
|
|
60
|
-
const properties = {
|
|
61
|
-
...props,
|
|
62
|
-
marks: [
|
|
63
|
-
{
|
|
64
|
-
type: 'point',
|
|
65
|
-
x: 2,
|
|
66
|
-
y: 2,
|
|
67
|
-
label: 'Point',
|
|
68
|
-
showLabel: true,
|
|
69
|
-
},
|
|
70
|
-
{
|
|
71
|
-
type: 'line',
|
|
72
|
-
from: { x: 0, y: 0 },
|
|
73
|
-
label: 'Line',
|
|
74
|
-
building: true,
|
|
75
|
-
},
|
|
76
|
-
],
|
|
77
|
-
...extras,
|
|
78
|
-
};
|
|
79
|
-
return render(<Graph {...properties} />);
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
describe('rendering', () => {
|
|
83
|
-
it('renders without crashing', () => {
|
|
84
|
-
const { container } = renderComponent();
|
|
85
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
86
|
-
});
|
|
87
|
-
|
|
88
|
-
it('renders SVG graph', () => {
|
|
89
|
-
const { container } = renderComponent();
|
|
90
|
-
expect(container.querySelector('svg')).toBeInTheDocument();
|
|
91
|
-
});
|
|
92
|
-
});
|
|
93
|
-
});
|