@pie-lib/charting 7.1.0-beta.8 → 7.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 +2 -2
- package/src/__tests__/actions-button.test.jsx +0 -280
- package/src/__tests__/axes.test.jsx +0 -667
- package/src/__tests__/chart-setup.test.jsx +0 -532
- package/src/__tests__/chart-type.test.jsx +0 -23
- package/src/__tests__/chart.test.jsx +0 -86
- package/src/__tests__/grid.test.jsx +0 -37
- package/src/__tests__/key-legend.test.jsx +0 -223
- package/src/__tests__/mark-label.test.jsx +0 -33
- package/src/__tests__/tool-menu.test.jsx +0 -522
- package/src/__tests__/utils.js +0 -36
- package/src/__tests__/utils.test.js +0 -100
- package/src/bars/__tests__/bar.test.jsx +0 -45
- package/src/bars/__tests__/histogram.test.jsx +0 -45
- package/src/bars/__tests__/utils.js +0 -30
- package/src/bars/common/__tests__/bars.test.jsx +0 -68
- package/src/bars/common/__tests__/utils.js +0 -30
- package/src/common/__tests__/correctness-indicators.test.jsx +0 -720
- package/src/common/__tests__/drag-handle.test.jsx +0 -58
- package/src/common/__tests__/utils.js +0 -30
- package/src/line/__tests__/line-cross.test.jsx +0 -463
- package/src/line/__tests__/line-dot.test.jsx +0 -41
- package/src/line/__tests__/utils.js +0 -36
- package/src/line/common/__tests__/drag-handle.test.jsx +0 -62
- package/src/line/common/__tests__/line.test.jsx +0 -79
- package/src/line/common/__tests__/utils.js +0 -30
- package/src/plot/__tests__/dot.test.jsx +0 -344
- package/src/plot/__tests__/line.test.jsx +0 -375
- package/src/plot/__tests__/utils.js +0 -30
- package/src/plot/common/__tests__/plot.test.jsx +0 -69
- package/src/plot/common/__tests__/utils.js +0 -30
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { render } from '@pie-lib/test-utils';
|
|
3
|
-
import Histogram, { Histogram as HistogramChart } from '../histogram';
|
|
4
|
-
import { graphProps } from './utils';
|
|
5
|
-
|
|
6
|
-
describe('HistogramChart', () => {
|
|
7
|
-
const renderComponent = (extras) => {
|
|
8
|
-
const defaults = {
|
|
9
|
-
classes: {},
|
|
10
|
-
className: 'className',
|
|
11
|
-
graphProps: graphProps(),
|
|
12
|
-
xBand: () => {
|
|
13
|
-
return {
|
|
14
|
-
bandwidth: () => {},
|
|
15
|
-
};
|
|
16
|
-
},
|
|
17
|
-
};
|
|
18
|
-
const props = { ...defaults, ...extras };
|
|
19
|
-
return render(<HistogramChart {...props} />);
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
describe('rendering', () => {
|
|
23
|
-
it('renders histogram chart', () => {
|
|
24
|
-
const { container } = renderComponent();
|
|
25
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
it('renders without graphProps', () => {
|
|
29
|
-
const { container } = renderComponent({ graphProps: undefined });
|
|
30
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
31
|
-
});
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
describe('component', () => {
|
|
35
|
-
it('returns correct chart object', () => {
|
|
36
|
-
const chart = Histogram();
|
|
37
|
-
|
|
38
|
-
expect(chart).toEqual({
|
|
39
|
-
type: 'histogram',
|
|
40
|
-
Component: HistogramChart,
|
|
41
|
-
name: 'Histogram',
|
|
42
|
-
});
|
|
43
|
-
});
|
|
44
|
-
});
|
|
45
|
-
});
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
export const scaleMock = () => {
|
|
2
|
-
const fn = jest.fn((n) => n);
|
|
3
|
-
fn.invert = jest.fn((n) => n);
|
|
4
|
-
return fn;
|
|
5
|
-
};
|
|
6
|
-
|
|
7
|
-
export const graphProps = (dmin = 0, dmax = 1, rmin = 0, rmax = 1) => ({
|
|
8
|
-
scale: {
|
|
9
|
-
x: scaleMock(),
|
|
10
|
-
y: scaleMock(),
|
|
11
|
-
},
|
|
12
|
-
snap: {
|
|
13
|
-
x: jest.fn((n) => n),
|
|
14
|
-
y: jest.fn((n) => n),
|
|
15
|
-
},
|
|
16
|
-
domain: {
|
|
17
|
-
min: dmin,
|
|
18
|
-
max: dmax,
|
|
19
|
-
step: 1,
|
|
20
|
-
},
|
|
21
|
-
range: {
|
|
22
|
-
min: rmin,
|
|
23
|
-
max: rmax,
|
|
24
|
-
step: 1,
|
|
25
|
-
},
|
|
26
|
-
size: {
|
|
27
|
-
width: 400,
|
|
28
|
-
height: 400,
|
|
29
|
-
},
|
|
30
|
-
});
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import { render } from '@testing-library/react';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import Bars, { RawBar } from '../bars';
|
|
4
|
-
import { graphProps } from './utils';
|
|
5
|
-
|
|
6
|
-
describe('Bars', () => {
|
|
7
|
-
const xBand = () => {};
|
|
8
|
-
xBand.bandwidth = () => {};
|
|
9
|
-
const onChange = jest.fn();
|
|
10
|
-
|
|
11
|
-
const renderComponent = (extras) => {
|
|
12
|
-
const defaults = {
|
|
13
|
-
classes: {},
|
|
14
|
-
className: 'className',
|
|
15
|
-
graphProps: graphProps(),
|
|
16
|
-
xBand,
|
|
17
|
-
onChange,
|
|
18
|
-
data: [{ value: 0, label: '0' }],
|
|
19
|
-
};
|
|
20
|
-
const props = { ...defaults, ...extras };
|
|
21
|
-
return render(<Bars {...props} />);
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
describe('rendering', () => {
|
|
25
|
-
it('renders without crashing', () => {
|
|
26
|
-
const { container } = renderComponent();
|
|
27
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
28
|
-
});
|
|
29
|
-
});
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
describe('RawBar', () => {
|
|
33
|
-
const xBand = () => {};
|
|
34
|
-
xBand.bandwidth = () => {};
|
|
35
|
-
const onChangeCategory = jest.fn();
|
|
36
|
-
|
|
37
|
-
const renderComponent = (extras) => {
|
|
38
|
-
const defaults = {
|
|
39
|
-
classes: {},
|
|
40
|
-
className: 'className',
|
|
41
|
-
graphProps: graphProps(),
|
|
42
|
-
xBand,
|
|
43
|
-
onChangeCategory,
|
|
44
|
-
data: [],
|
|
45
|
-
label: 'label',
|
|
46
|
-
};
|
|
47
|
-
const props = { ...defaults, ...extras };
|
|
48
|
-
return render(<RawBar {...props} />);
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
describe('rendering', () => {
|
|
52
|
-
it('renders without crashing', () => {
|
|
53
|
-
const { container } = renderComponent();
|
|
54
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
55
|
-
});
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
describe('functionality', () => {
|
|
59
|
-
it('calls onChangeCategory when drag completes with a value', () => {
|
|
60
|
-
const { container } = renderComponent();
|
|
61
|
-
// Testing drag functionality requires interaction - the component should
|
|
62
|
-
// call onChangeCategory when a drag operation completes with a new value
|
|
63
|
-
// This would typically be tested through user interactions rather than
|
|
64
|
-
// directly calling instance methods
|
|
65
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
66
|
-
});
|
|
67
|
-
});
|
|
68
|
-
});
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
export const scaleMock = () => {
|
|
2
|
-
const fn = jest.fn((n) => n);
|
|
3
|
-
fn.invert = jest.fn((n) => n);
|
|
4
|
-
return fn;
|
|
5
|
-
};
|
|
6
|
-
|
|
7
|
-
export const graphProps = (dmin = 0, dmax = 1, rmin = 0, rmax = 1) => ({
|
|
8
|
-
scale: {
|
|
9
|
-
x: scaleMock(),
|
|
10
|
-
y: scaleMock(),
|
|
11
|
-
},
|
|
12
|
-
snap: {
|
|
13
|
-
x: jest.fn((n) => n),
|
|
14
|
-
y: jest.fn((n) => n),
|
|
15
|
-
},
|
|
16
|
-
domain: {
|
|
17
|
-
min: dmin,
|
|
18
|
-
max: dmax,
|
|
19
|
-
step: 1,
|
|
20
|
-
},
|
|
21
|
-
range: {
|
|
22
|
-
min: rmin,
|
|
23
|
-
max: rmax,
|
|
24
|
-
step: 1,
|
|
25
|
-
},
|
|
26
|
-
size: {
|
|
27
|
-
width: 400,
|
|
28
|
-
height: 400,
|
|
29
|
-
},
|
|
30
|
-
});
|