@pie-lib/graphing 2.14.21 → 2.14.22-next.1618

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 (194) hide show
  1. package/CHANGELOG.json +1 -1017
  2. package/CHANGELOG.md +159 -24
  3. package/NEXT.CHANGELOG.json +1 -0
  4. package/lib/axis/axes.js +5 -5
  5. package/lib/axis/axes.js.map +1 -1
  6. package/lib/container/index.js +1 -4
  7. package/lib/container/index.js.map +1 -1
  8. package/lib/coordinates-label.js +5 -3
  9. package/lib/coordinates-label.js.map +1 -1
  10. package/lib/graph-with-controls.js +8 -15
  11. package/lib/graph-with-controls.js.map +1 -1
  12. package/lib/graph.js +29 -12
  13. package/lib/graph.js.map +1 -1
  14. package/lib/grid.js +6 -14
  15. package/lib/grid.js.map +1 -1
  16. package/lib/index.js +8 -0
  17. package/lib/index.js.map +1 -1
  18. package/lib/key-legend.js +246 -0
  19. package/lib/key-legend.js.map +1 -0
  20. package/lib/label-svg-icon.js +56 -0
  21. package/lib/label-svg-icon.js.map +1 -0
  22. package/lib/labels.js +2 -1
  23. package/lib/labels.js.map +1 -1
  24. package/lib/mark-label.js +167 -56
  25. package/lib/mark-label.js.map +1 -1
  26. package/lib/toggle-bar.js +3 -4
  27. package/lib/toggle-bar.js.map +1 -1
  28. package/lib/tool-menu.js +2 -22
  29. package/lib/tool-menu.js.map +1 -1
  30. package/lib/tools/absolute/component.js +35 -0
  31. package/lib/tools/absolute/component.js.map +1 -0
  32. package/lib/tools/absolute/index.js +63 -0
  33. package/lib/tools/absolute/index.js.map +1 -0
  34. package/lib/tools/circle/bg-circle.js +4 -3
  35. package/lib/tools/circle/bg-circle.js.map +1 -1
  36. package/lib/tools/circle/component.js +34 -15
  37. package/lib/tools/circle/component.js.map +1 -1
  38. package/lib/tools/exponential/component.js +34 -0
  39. package/lib/tools/exponential/component.js.map +1 -0
  40. package/lib/tools/exponential/index.js +71 -0
  41. package/lib/tools/exponential/index.js.map +1 -0
  42. package/lib/tools/index.js +26 -6
  43. package/lib/tools/index.js.map +1 -1
  44. package/lib/tools/line/component.js +2 -1
  45. package/lib/tools/line/component.js.map +1 -1
  46. package/lib/tools/parabola/component.js +6 -5
  47. package/lib/tools/parabola/component.js.map +1 -1
  48. package/lib/tools/point/component.js +14 -9
  49. package/lib/tools/point/component.js.map +1 -1
  50. package/lib/tools/polygon/component.js +25 -12
  51. package/lib/tools/polygon/component.js.map +1 -1
  52. package/lib/tools/polygon/line.js +12 -6
  53. package/lib/tools/polygon/line.js.map +1 -1
  54. package/lib/tools/polygon/polygon.js +6 -3
  55. package/lib/tools/polygon/polygon.js.map +1 -1
  56. package/lib/tools/ray/component.js +2 -1
  57. package/lib/tools/ray/component.js.map +1 -1
  58. package/lib/tools/segment/component.js +2 -1
  59. package/lib/tools/segment/component.js.map +1 -1
  60. package/lib/tools/shared/icons/CorrectSVG.js +36 -0
  61. package/lib/tools/shared/icons/CorrectSVG.js.map +1 -0
  62. package/lib/tools/shared/icons/IncorrectSVG.js +36 -0
  63. package/lib/tools/shared/icons/IncorrectSVG.js.map +1 -0
  64. package/lib/tools/shared/icons/MissingSVG.js +35 -0
  65. package/lib/tools/shared/icons/MissingSVG.js.map +1 -0
  66. package/lib/tools/shared/line/index.js +51 -19
  67. package/lib/tools/shared/line/index.js.map +1 -1
  68. package/lib/tools/shared/line/line-path.js +13 -7
  69. package/lib/tools/shared/line/line-path.js.map +1 -1
  70. package/lib/tools/shared/line/with-root-edge.js +19 -8
  71. package/lib/tools/shared/line/with-root-edge.js.map +1 -1
  72. package/lib/tools/shared/point/arrow-point.js +1 -1
  73. package/lib/tools/shared/point/arrow-point.js.map +1 -1
  74. package/lib/tools/shared/point/arrow.js +1 -1
  75. package/lib/tools/shared/point/arrow.js.map +1 -1
  76. package/lib/tools/shared/point/base-point.js +43 -7
  77. package/lib/tools/shared/point/base-point.js.map +1 -1
  78. package/lib/tools/shared/point/index.js +4 -1
  79. package/lib/tools/shared/point/index.js.map +1 -1
  80. package/lib/tools/shared/styles.js +16 -7
  81. package/lib/tools/shared/styles.js.map +1 -1
  82. package/lib/tools/sine/component.js +13 -4
  83. package/lib/tools/sine/component.js.map +1 -1
  84. package/lib/tools/vector/component.js +2 -1
  85. package/lib/tools/vector/component.js.map +1 -1
  86. package/lib/undo-redo.js +0 -1
  87. package/lib/undo-redo.js.map +1 -1
  88. package/lib/utils.js +1 -1
  89. package/lib/utils.js.map +1 -1
  90. package/package.json +12 -7
  91. package/src/__tests__/__snapshots__/graph-with-controls.test.jsx.snap +237 -0
  92. package/src/__tests__/__snapshots__/graph.test.jsx.snap +211 -0
  93. package/src/__tests__/__snapshots__/grid.test.jsx.snap +54 -0
  94. package/src/__tests__/__snapshots__/labels.test.jsx.snap +30 -0
  95. package/src/__tests__/__snapshots__/mark-label.test.jsx.snap +45 -0
  96. package/src/__tests__/__snapshots__/toggle-bar.test.jsx.snap +7 -0
  97. package/src/__tests__/__snapshots__/tool-menu.test.jsx.snap +13 -0
  98. package/src/__tests__/__snapshots__/undo-redo.test.jsx.snap +14 -0
  99. package/src/__tests__/graph-with-controls.test.jsx +147 -0
  100. package/src/__tests__/graph.test.jsx +230 -0
  101. package/src/__tests__/grid.test.jsx +20 -0
  102. package/src/__tests__/labels.test.jsx +38 -0
  103. package/src/__tests__/mark-label.test.jsx +68 -0
  104. package/src/__tests__/toggle-bar.test.jsx +36 -0
  105. package/src/__tests__/tool-menu.test.jsx +29 -0
  106. package/src/__tests__/undo-redo.test.jsx +25 -0
  107. package/src/__tests__/use-debounce.test.js +21 -0
  108. package/src/__tests__/utils.js +38 -0
  109. package/src/__tests__/utils.test.js +151 -0
  110. package/src/axis/__tests__/__snapshots__/arrow.test.jsx.snap +33 -0
  111. package/src/axis/__tests__/__snapshots__/axes.test.jsx.snap +122 -0
  112. package/src/axis/__tests__/arrow.test.jsx +39 -0
  113. package/src/axis/__tests__/axes.test.jsx +220 -0
  114. package/src/axis/axes.jsx +5 -5
  115. package/src/container/index.jsx +2 -4
  116. package/src/coordinates-label.jsx +4 -3
  117. package/src/graph-with-controls.jsx +8 -10
  118. package/src/graph.jsx +22 -10
  119. package/src/grid.jsx +8 -10
  120. package/src/index.js +2 -2
  121. package/src/key-legend.jsx +145 -0
  122. package/src/label-svg-icon.jsx +39 -0
  123. package/src/labels.jsx +2 -1
  124. package/src/mark-label.jsx +149 -52
  125. package/src/toggle-bar.jsx +1 -2
  126. package/src/tool-menu.jsx +3 -26
  127. package/src/tools/absolute/__tests__/component.test.jsx +54 -0
  128. package/src/tools/absolute/component.jsx +23 -0
  129. package/src/tools/absolute/index.js +31 -0
  130. package/src/tools/circle/__tests__/__snapshots__/bg-circle.test.jsx.snap +46 -0
  131. package/src/tools/circle/__tests__/__snapshots__/component.test.jsx.snap +293 -0
  132. package/src/tools/circle/__tests__/bg-circle.test.jsx +28 -0
  133. package/src/tools/circle/__tests__/component.test.jsx +228 -0
  134. package/src/tools/circle/bg-circle.jsx +5 -4
  135. package/src/tools/circle/component.jsx +22 -8
  136. package/src/tools/exponential/__tests__/component.test.jsx +54 -0
  137. package/src/tools/exponential/component.jsx +23 -0
  138. package/src/tools/exponential/index.js +39 -0
  139. package/src/tools/index.js +38 -5
  140. package/src/tools/line/__tests__/__snapshots__/component.test.jsx.snap +20 -0
  141. package/src/tools/line/__tests__/component.test.jsx +36 -0
  142. package/src/tools/line/component.jsx +2 -1
  143. package/src/tools/parabola/__tests__/component.test.jsx +49 -0
  144. package/src/tools/parabola/component.jsx +7 -6
  145. package/src/tools/point/__tests__/__snapshots__/component.test.jsx.snap +40 -0
  146. package/src/tools/point/__tests__/component.test.jsx +66 -0
  147. package/src/tools/point/component.jsx +12 -6
  148. package/src/tools/polygon/__tests__/__snapshots__/component.test.jsx.snap +415 -0
  149. package/src/tools/polygon/__tests__/__snapshots__/line.test.jsx.snap +45 -0
  150. package/src/tools/polygon/__tests__/__snapshots__/polygon.test.jsx.snap +52 -0
  151. package/src/tools/polygon/__tests__/component.test.jsx +226 -0
  152. package/src/tools/polygon/__tests__/index.test.js +65 -0
  153. package/src/tools/polygon/__tests__/line.test.jsx +25 -0
  154. package/src/tools/polygon/__tests__/polygon.test.jsx +44 -0
  155. package/src/tools/polygon/component.jsx +39 -11
  156. package/src/tools/polygon/line.jsx +15 -7
  157. package/src/tools/polygon/polygon.jsx +7 -3
  158. package/src/tools/ray/__tests__/__snapshots__/component.test.jsx.snap +23 -0
  159. package/src/tools/ray/__tests__/component.test.jsx +29 -0
  160. package/src/tools/ray/component.jsx +2 -1
  161. package/src/tools/segment/__tests__/__snapshots__/component.test.jsx.snap +14 -0
  162. package/src/tools/segment/__tests__/component.test.jsx +28 -0
  163. package/src/tools/segment/component.jsx +2 -1
  164. package/src/tools/shared/__tests__/__snapshots__/arrow-head.test.jsx.snap +27 -0
  165. package/src/tools/shared/__tests__/arrow-head.test.jsx +34 -0
  166. package/src/tools/shared/icons/CorrectSVG.jsx +22 -0
  167. package/src/tools/shared/icons/IncorrectSVG.jsx +20 -0
  168. package/src/tools/shared/icons/MissingSVG.jsx +21 -0
  169. package/src/tools/shared/line/__tests__/__snapshots__/index.test.jsx.snap +360 -0
  170. package/src/tools/shared/line/__tests__/__snapshots__/line-path.test.jsx.snap +58 -0
  171. package/src/tools/shared/line/__tests__/__snapshots__/with-root-edge.test.jsx.snap +63 -0
  172. package/src/tools/shared/line/__tests__/index.test.jsx +255 -0
  173. package/src/tools/shared/line/__tests__/line-path.test.jsx +53 -0
  174. package/src/tools/shared/line/__tests__/with-root-edge.test.jsx +73 -0
  175. package/src/tools/shared/line/index.jsx +39 -13
  176. package/src/tools/shared/line/line-path.jsx +18 -7
  177. package/src/tools/shared/line/with-root-edge.jsx +10 -3
  178. package/src/tools/shared/point/__tests__/__snapshots__/arrow-point.test.jsx.snap +56 -0
  179. package/src/tools/shared/point/__tests__/__snapshots__/base-point.test.jsx.snap +44 -0
  180. package/src/tools/shared/point/__tests__/arrow-point.test.jsx +87 -0
  181. package/src/tools/shared/point/__tests__/base-point.test.jsx +84 -0
  182. package/src/tools/shared/point/arrow-point.jsx +4 -1
  183. package/src/tools/shared/point/arrow.jsx +4 -1
  184. package/src/tools/shared/point/base-point.jsx +28 -3
  185. package/src/tools/shared/point/index.jsx +7 -2
  186. package/src/tools/shared/styles.js +8 -3
  187. package/src/tools/sine/__tests__/component.test.jsx +51 -0
  188. package/src/tools/sine/component.jsx +7 -7
  189. package/src/tools/vector/__tests__/__snapshots__/component.test.jsx.snap +12 -0
  190. package/src/tools/vector/__tests__/component.test.jsx +26 -0
  191. package/src/tools/vector/component.jsx +2 -1
  192. package/src/undo-redo.jsx +0 -1
  193. package/src/utils.js +1 -1
  194. package/legacy.png +0 -0
@@ -4,7 +4,7 @@ import { withStyles } from '@material-ui/core/styles';
4
4
  import cn from 'classnames';
5
5
  import Button from '@material-ui/core/Button';
6
6
  import { color } from '@pie-lib/render-ui';
7
- import { allTools } from './tools/index';
7
+ import { allTools } from './tools';
8
8
  import { withDragContext, DragSource, DropTarget } from '@pie-lib/drag';
9
9
  import Translator from '@pie-lib/translator';
10
10
 
@@ -135,7 +135,6 @@ const styles = (theme) => ({
135
135
  marginRight: theme.spacing.unit / 2,
136
136
  marginBottom: theme.spacing.unit / 2,
137
137
  color: color.text(),
138
- backgroundColor: color.background(),
139
138
  },
140
139
  under: {
141
140
  position: 'absolute',
package/src/tool-menu.jsx CHANGED
@@ -12,7 +12,6 @@ export class ToolMenu extends React.Component {
12
12
  draggableTools: PropTypes.bool,
13
13
  labelModeEnabled: PropTypes.bool,
14
14
  onChange: PropTypes.func,
15
- onToggleLabelMode: PropTypes.func,
16
15
  onChangeTools: PropTypes.func,
17
16
  toolbarTools: PropTypes.arrayOf(PropTypes.string),
18
17
  language: PropTypes.string,
@@ -22,33 +21,15 @@ export class ToolMenu extends React.Component {
22
21
  toolbarTools: [],
23
22
  };
24
23
 
25
- updateToolsOrder = (tools, showLabel) => {
24
+ updateToolsOrder = (tools) => {
26
25
  const { onChangeTools } = this.props;
27
-
28
- if (showLabel) {
29
- tools.push('label');
30
- }
31
-
32
26
  onChangeTools(tools);
33
27
  };
34
28
 
35
29
  render() {
36
- const {
37
- className,
38
- currentToolType,
39
- disabled,
40
- draggableTools,
41
- labelModeEnabled,
42
- onToggleLabelMode,
43
- onChange,
44
- language
45
- } = this.props;
30
+ const { className, currentToolType, disabled, draggableTools, onChange, language } = this.props;
46
31
  let { toolbarTools } = this.props;
47
32
 
48
- const showLabel = toolbarTools && toolbarTools.some((t) => t === 'label');
49
-
50
- toolbarTools = (toolbarTools || []).filter((tT) => tT !== 'label');
51
-
52
33
  return (
53
34
  <div className={classNames(className)}>
54
35
  <ToggleBar
@@ -57,13 +38,9 @@ export class ToolMenu extends React.Component {
57
38
  options={toolbarTools}
58
39
  selectedToolType={currentToolType}
59
40
  onChange={onChange}
60
- onChangeToolsOrder={(tools) => this.updateToolsOrder(tools, showLabel)}
41
+ onChangeToolsOrder={(tools) => this.updateToolsOrder(tools)}
61
42
  language={language}
62
43
  />
63
-
64
- {showLabel && (
65
- <MiniButton disabled={disabled} value={'Label'} onClick={onToggleLabelMode} selected={labelModeEnabled} language={language} />
66
- )}
67
44
  </div>
68
45
  );
69
46
  }
@@ -0,0 +1,54 @@
1
+ import React from 'react';
2
+ import { withRootEdge } from '../../shared/line/with-root-edge';
3
+ import { buildDataPoints, absoluteFromTwoPoints } from '@pie-lib/graphing-utils';
4
+ import { utils } from '@pie-lib/plot';
5
+
6
+ import { graphProps as getGraphProps } from '../../../__tests__/utils';
7
+
8
+ const { xy } = utils;
9
+
10
+ jest.mock('@pie-lib/graphing-utils', () => ({
11
+ buildDataPoints: jest.fn().mockReturnValue([]),
12
+ absoluteFromTwoPoints: jest.fn(() => jest.fn()),
13
+ getAmplitudeAndFreq: jest.fn().mockReturnValue({ freq: 4, amplitude: 1 }),
14
+ }));
15
+
16
+ jest.mock('../../shared/line/with-root-edge', () => ({
17
+ withRootEdge: jest.fn(),
18
+ rootEdgeComponent: jest.fn(),
19
+ }));
20
+
21
+ describe('Absolute', () => {
22
+ let fnBody;
23
+ let graphProps;
24
+ let root;
25
+ let edge;
26
+ let result;
27
+
28
+ beforeEach(() => {
29
+ require('../component');
30
+ fnBody = withRootEdge.mock.calls[0][0];
31
+ graphProps = getGraphProps();
32
+ root = xy(0, 0);
33
+ edge = xy(1, 1);
34
+
35
+ result = fnBody({ graphProps, root, edge });
36
+ });
37
+
38
+ it('fnBody is not null', () => {
39
+ expect(fnBody).toBeDefined();
40
+ });
41
+
42
+ it('calls buildDataPoints', () => {
43
+ const { domain, range } = graphProps;
44
+ expect(buildDataPoints).toHaveBeenCalledWith(domain, range, root, edge, expect.anything(), true);
45
+ });
46
+
47
+ it('calls absoluteFromTwoPoints', () => {
48
+ expect(absoluteFromTwoPoints).toHaveBeenCalledWith(root, edge);
49
+ });
50
+
51
+ it('returns dataPoints', () => {
52
+ expect(result).toEqual({ enableCurve: false, root, edge, dataPoints: [] });
53
+ });
54
+ });
@@ -0,0 +1,23 @@
1
+ import debug from 'debug';
2
+ import { buildDataPoints, absoluteFromTwoPoints } from '@pie-lib/graphing-utils';
3
+ import { withRootEdge, rootEdgeComponent } from '../shared/line/with-root-edge';
4
+
5
+ const log = debug('pie-lib:graphing:absolute');
6
+
7
+ const Absolute = withRootEdge((props) => {
8
+ const { root, edge, graphProps } = props;
9
+ const { domain, range } = graphProps;
10
+
11
+ const dataPoints =
12
+ edge && edge.x === root.x
13
+ ? []
14
+ : buildDataPoints(domain, range, root, edge, absoluteFromTwoPoints(root, edge), true);
15
+
16
+ log('dataPoints:', dataPoints);
17
+
18
+ return { root: props.root, edge: props.edge, dataPoints, enableCurve: false };
19
+ });
20
+
21
+ const Component = rootEdgeComponent(Absolute);
22
+
23
+ export default Component;
@@ -0,0 +1,31 @@
1
+ import Absolute from './component';
2
+ import debug from 'debug';
3
+ import { equalPoints, sameAxes } from '../../utils';
4
+
5
+ const log = debug('pie-lib:graphing:absolute');
6
+
7
+ export const tool = () => ({
8
+ type: 'absolute',
9
+ Component: Absolute,
10
+ complete: (data, mark) => ({ ...mark, building: false, closed: true }),
11
+ addPoint: (point, mark) => {
12
+ log('add point to absolute model: ', point, 'mark: ', mark);
13
+ if (mark && (equalPoints(mark.root, point) || sameAxes(mark.root, point))) {
14
+ return mark;
15
+ }
16
+
17
+ if (!mark) {
18
+ return {
19
+ type: 'absolute',
20
+ root: point,
21
+ edge: undefined,
22
+ closed: false,
23
+ building: true,
24
+ };
25
+ } else if (mark && !mark.root) {
26
+ throw new Error('no root - should never happen');
27
+ } else {
28
+ return { ...mark, edge: point, closed: true, building: false };
29
+ }
30
+ },
31
+ });
@@ -0,0 +1,46 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`BgCircle snapshot renders 1`] = `
4
+ <RawCircle
5
+ className="className"
6
+ classes={
7
+ Object {
8
+ "bgCircle": "RawCircle-bgCircle-1",
9
+ "correct": "RawCircle-correct-4",
10
+ "disabled": "RawCircle-disabled-2",
11
+ "disabledSecondary": "RawCircle-disabledSecondary-3",
12
+ "incorrect": "RawCircle-incorrect-5",
13
+ "missing": "RawCircle-missing-6",
14
+ }
15
+ }
16
+ graphProps={
17
+ Object {
18
+ "domain": Object {
19
+ "max": 1,
20
+ "min": 0,
21
+ "step": 1,
22
+ },
23
+ "range": Object {
24
+ "max": 1,
25
+ "min": 0,
26
+ "step": 1,
27
+ },
28
+ "scale": Object {
29
+ "x": [MockFunction],
30
+ "y": [MockFunction],
31
+ },
32
+ "size": Object {
33
+ "height": 400,
34
+ "width": 400,
35
+ },
36
+ "snap": Object {
37
+ "x": [MockFunction],
38
+ "y": [MockFunction],
39
+ },
40
+ }
41
+ }
42
+ onChange={[MockFunction]}
43
+ x={0}
44
+ y={0}
45
+ />
46
+ `;
@@ -0,0 +1,293 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`Component snapshot renders 1`] = `
4
+ <g>
5
+ <GridDraggable
6
+ className=""
7
+ graphProps={
8
+ Object {
9
+ "domain": Object {
10
+ "max": 1,
11
+ "min": 0,
12
+ "step": 1,
13
+ },
14
+ "range": Object {
15
+ "max": 1,
16
+ "min": 0,
17
+ "step": 1,
18
+ },
19
+ "scale": Object {
20
+ "x": [MockFunction],
21
+ "y": [MockFunction],
22
+ },
23
+ "size": Object {
24
+ "height": 400,
25
+ "width": 400,
26
+ },
27
+ "snap": Object {
28
+ "x": [MockFunction],
29
+ "y": [MockFunction],
30
+ },
31
+ }
32
+ }
33
+ onClick={[Function]}
34
+ onDrag={[Function]}
35
+ radius={1.4142135623730951}
36
+ x={0}
37
+ y={0}
38
+ />
39
+ <WithStyles(GridDraggable)
40
+ graphProps={
41
+ Object {
42
+ "domain": Object {
43
+ "max": 1,
44
+ "min": 0,
45
+ "step": 1,
46
+ },
47
+ "range": Object {
48
+ "max": 1,
49
+ "min": 0,
50
+ "step": 1,
51
+ },
52
+ "scale": Object {
53
+ "x": [MockFunction],
54
+ "y": [MockFunction],
55
+ },
56
+ "size": Object {
57
+ "height": 400,
58
+ "width": 400,
59
+ },
60
+ "snap": Object {
61
+ "x": [MockFunction],
62
+ "y": [MockFunction],
63
+ },
64
+ }
65
+ }
66
+ onClick={[Function]}
67
+ onDrag={[Function]}
68
+ x={1}
69
+ y={1}
70
+ />
71
+ <WithStyles(GridDraggable)
72
+ graphProps={
73
+ Object {
74
+ "domain": Object {
75
+ "max": 1,
76
+ "min": 0,
77
+ "step": 1,
78
+ },
79
+ "range": Object {
80
+ "max": 1,
81
+ "min": 0,
82
+ "step": 1,
83
+ },
84
+ "scale": Object {
85
+ "x": [MockFunction],
86
+ "y": [MockFunction],
87
+ },
88
+ "size": Object {
89
+ "height": 400,
90
+ "width": 400,
91
+ },
92
+ "snap": Object {
93
+ "x": [MockFunction],
94
+ "y": [MockFunction],
95
+ },
96
+ }
97
+ }
98
+ onClick={[Function]}
99
+ onDrag={[Function]}
100
+ x={0}
101
+ y={0}
102
+ />
103
+ </g>
104
+ `;
105
+
106
+ exports[`Component snapshot renders with labels 1`] = `
107
+ <g>
108
+ <GridDraggable
109
+ className=""
110
+ graphProps={
111
+ Object {
112
+ "domain": Object {
113
+ "max": 1,
114
+ "min": 0,
115
+ "step": 1,
116
+ },
117
+ "range": Object {
118
+ "max": 1,
119
+ "min": 0,
120
+ "step": 1,
121
+ },
122
+ "scale": Object {
123
+ "x": [MockFunction],
124
+ "y": [MockFunction],
125
+ },
126
+ "size": Object {
127
+ "height": 400,
128
+ "width": 400,
129
+ },
130
+ "snap": Object {
131
+ "x": [MockFunction],
132
+ "y": [MockFunction],
133
+ },
134
+ }
135
+ }
136
+ onClick={[Function]}
137
+ onDrag={[Function]}
138
+ radius={1.4142135623730951}
139
+ x={0}
140
+ y={0}
141
+ />
142
+ <WithStyles(GridDraggable)
143
+ graphProps={
144
+ Object {
145
+ "domain": Object {
146
+ "max": 1,
147
+ "min": 0,
148
+ "step": 1,
149
+ },
150
+ "range": Object {
151
+ "max": 1,
152
+ "min": 0,
153
+ "step": 1,
154
+ },
155
+ "scale": Object {
156
+ "x": [MockFunction],
157
+ "y": [MockFunction],
158
+ },
159
+ "size": Object {
160
+ "height": 400,
161
+ "width": 400,
162
+ },
163
+ "snap": Object {
164
+ "x": [MockFunction],
165
+ "y": [MockFunction],
166
+ },
167
+ }
168
+ }
169
+ labelNode={<foreignobject />}
170
+ onClick={[Function]}
171
+ onDrag={[Function]}
172
+ x={1}
173
+ y={1}
174
+ />
175
+ <Portal
176
+ containerInfo={<foreignobject />}
177
+ >
178
+ <WithStyles(MarkLabel)
179
+ disabled={true}
180
+ graphProps={
181
+ Object {
182
+ "domain": Object {
183
+ "max": 1,
184
+ "min": 0,
185
+ "step": 1,
186
+ },
187
+ "range": Object {
188
+ "max": 1,
189
+ "min": 0,
190
+ "step": 1,
191
+ },
192
+ "scale": Object {
193
+ "x": [MockFunction],
194
+ "y": [MockFunction],
195
+ },
196
+ "size": Object {
197
+ "height": 400,
198
+ "width": 400,
199
+ },
200
+ "snap": Object {
201
+ "x": [MockFunction],
202
+ "y": [MockFunction],
203
+ },
204
+ }
205
+ }
206
+ inputRef={[Function]}
207
+ mark={
208
+ Object {
209
+ "label": "B",
210
+ "x": 1,
211
+ "y": 1,
212
+ }
213
+ }
214
+ onChange={[Function]}
215
+ />
216
+ </Portal>
217
+ <WithStyles(GridDraggable)
218
+ graphProps={
219
+ Object {
220
+ "domain": Object {
221
+ "max": 1,
222
+ "min": 0,
223
+ "step": 1,
224
+ },
225
+ "range": Object {
226
+ "max": 1,
227
+ "min": 0,
228
+ "step": 1,
229
+ },
230
+ "scale": Object {
231
+ "x": [MockFunction],
232
+ "y": [MockFunction],
233
+ },
234
+ "size": Object {
235
+ "height": 400,
236
+ "width": 400,
237
+ },
238
+ "snap": Object {
239
+ "x": [MockFunction],
240
+ "y": [MockFunction],
241
+ },
242
+ }
243
+ }
244
+ labelNode={<foreignobject />}
245
+ onClick={[Function]}
246
+ onDrag={[Function]}
247
+ x={0}
248
+ y={0}
249
+ />
250
+ <Portal
251
+ containerInfo={<foreignobject />}
252
+ >
253
+ <WithStyles(MarkLabel)
254
+ disabled={true}
255
+ graphProps={
256
+ Object {
257
+ "domain": Object {
258
+ "max": 1,
259
+ "min": 0,
260
+ "step": 1,
261
+ },
262
+ "range": Object {
263
+ "max": 1,
264
+ "min": 0,
265
+ "step": 1,
266
+ },
267
+ "scale": Object {
268
+ "x": [MockFunction],
269
+ "y": [MockFunction],
270
+ },
271
+ "size": Object {
272
+ "height": 400,
273
+ "width": 400,
274
+ },
275
+ "snap": Object {
276
+ "x": [MockFunction],
277
+ "y": [MockFunction],
278
+ },
279
+ }
280
+ }
281
+ inputRef={[Function]}
282
+ mark={
283
+ Object {
284
+ "label": "A",
285
+ "x": 0,
286
+ "y": 0,
287
+ }
288
+ }
289
+ onChange={[Function]}
290
+ />
291
+ </Portal>
292
+ </g>
293
+ `;
@@ -0,0 +1,28 @@
1
+ import { shallow } from 'enzyme';
2
+ import React from 'react';
3
+ import { BgCircle } from '../bg-circle';
4
+ import { graphProps } from '../../../__tests__/utils';
5
+
6
+ describe('BgCircle', () => {
7
+ let w;
8
+ let onChange = jest.fn();
9
+ const wrapper = (extras) => {
10
+ const defaults = {
11
+ classes: {},
12
+ className: 'className',
13
+ onChange,
14
+ x: 0,
15
+ y: 0,
16
+ graphProps: graphProps(),
17
+ };
18
+ const props = { ...defaults, ...extras };
19
+ return shallow(<BgCircle {...props} />);
20
+ };
21
+ describe('snapshot', () => {
22
+ it('renders', () => {
23
+ w = wrapper();
24
+ expect(w).toMatchSnapshot();
25
+ });
26
+ });
27
+ describe('logic', () => {});
28
+ });