@pie-lib/charting 7.0.21 → 7.0.22-beta.2
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/CHANGELOG.md +0 -78
- package/package.json +14 -14
- package/LICENSE.md +0 -5
- 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
package/CHANGELOG.md
CHANGED
|
@@ -3,84 +3,6 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
-
## [7.0.21](https://github.com/pie-framework/pie-lib/compare/@pie-lib/charting@7.0.20...@pie-lib/charting@7.0.21) (2026-09-22)
|
|
7
|
-
|
|
8
|
-
**Note:** Version bump only for package @pie-lib/charting
|
|
9
|
-
|
|
10
|
-
## [7.0.20](https://github.com/pie-framework/pie-lib/compare/@pie-lib/charting@7.0.19...@pie-lib/charting@7.0.20) (2026-09-16)
|
|
11
|
-
|
|
12
|
-
**Note:** Version bump only for package @pie-lib/charting
|
|
13
|
-
|
|
14
|
-
## [7.0.19](https://github.com/pie-framework/pie-lib/compare/@pie-lib/charting@7.0.18...@pie-lib/charting@7.0.19) (2026-09-03)
|
|
15
|
-
|
|
16
|
-
**Note:** Version bump only for package @pie-lib/charting
|
|
17
|
-
|
|
18
|
-
## [7.0.18](https://github.com/pie-framework/pie-lib/compare/@pie-lib/charting@7.0.17...@pie-lib/charting@7.0.18) (2026-09-02)
|
|
19
|
-
|
|
20
|
-
### Bug Fixes
|
|
21
|
-
|
|
22
|
-
- **deps:** align versions with pie-elements-ng and upgrade [@visx](https://github.com/visx) to v4 PIE-926 ([16c5ff0](https://github.com/pie-framework/pie-lib/commit/16c5ff093a36fea98a46d5e2b37f95d9ec03025c))
|
|
23
|
-
|
|
24
|
-
## [7.0.17](https://github.com/pie-framework/pie-lib/compare/@pie-lib/charting@7.0.16...@pie-lib/charting@7.0.17) (2026-08-26)
|
|
25
|
-
|
|
26
|
-
**Note:** Version bump only for package @pie-lib/charting
|
|
27
|
-
|
|
28
|
-
## [7.0.16](https://github.com/pie-framework/pie-lib/compare/@pie-lib/charting@7.0.15...@pie-lib/charting@7.0.16) (2026-08-21)
|
|
29
|
-
|
|
30
|
-
**Note:** Version bump only for package @pie-lib/charting
|
|
31
|
-
|
|
32
|
-
## [7.0.15](https://github.com/pie-framework/pie-lib/compare/@pie-lib/charting@7.0.14...@pie-lib/charting@7.0.15) (2026-08-18)
|
|
33
|
-
|
|
34
|
-
**Note:** Version bump only for package @pie-lib/charting
|
|
35
|
-
|
|
36
|
-
## [7.0.14](https://github.com/pie-framework/pie-lib/compare/@pie-lib/charting@7.0.13...@pie-lib/charting@7.0.14) (2026-08-13)
|
|
37
|
-
|
|
38
|
-
**Note:** Version bump only for package @pie-lib/charting
|
|
39
|
-
|
|
40
|
-
## [7.0.13](https://github.com/pie-framework/pie-lib/compare/@pie-lib/charting@7.0.12...@pie-lib/charting@7.0.13) (2026-07-31)
|
|
41
|
-
|
|
42
|
-
**Note:** Version bump only for package @pie-lib/charting
|
|
43
|
-
|
|
44
|
-
## [7.0.12](https://github.com/pie-framework/pie-lib/compare/@pie-lib/charting@7.0.11...@pie-lib/charting@7.0.12) (2026-07-08)
|
|
45
|
-
|
|
46
|
-
**Note:** Version bump only for package @pie-lib/charting
|
|
47
|
-
|
|
48
|
-
## [7.0.11](https://github.com/pie-framework/pie-lib/compare/@pie-lib/charting@7.0.10...@pie-lib/charting@7.0.11) (2026-07-01)
|
|
49
|
-
|
|
50
|
-
**Note:** Version bump only for package @pie-lib/charting
|
|
51
|
-
|
|
52
|
-
## [7.0.10](https://github.com/pie-framework/pie-lib/compare/@pie-lib/charting@7.0.9...@pie-lib/charting@7.0.10) (2026-06-25)
|
|
53
|
-
|
|
54
|
-
**Note:** Version bump only for package @pie-lib/charting
|
|
55
|
-
|
|
56
|
-
## [7.0.9](https://github.com/pie-framework/pie-lib/compare/@pie-lib/charting@7.0.8...@pie-lib/charting@7.0.9) (2026-06-19)
|
|
57
|
-
|
|
58
|
-
**Note:** Version bump only for package @pie-lib/charting
|
|
59
|
-
|
|
60
|
-
## [7.0.8](https://github.com/pie-framework/pie-lib/compare/@pie-lib/charting@7.0.7...@pie-lib/charting@7.0.8) (2026-06-17)
|
|
61
|
-
|
|
62
|
-
### Bug Fixes
|
|
63
|
-
|
|
64
|
-
- **charting, plot:** rename 'disabled' class to 'disabledMarkLabel' and 'disabledTitle' PIE-661 PIE-664 ([29fc92c](https://github.com/pie-framework/pie-lib/commit/29fc92cf738990cd83f0e0d48fa4dd9047ad065d))
|
|
65
|
-
|
|
66
|
-
## [7.0.7](https://github.com/pie-framework/pie-lib/compare/@pie-lib/charting@7.0.6...@pie-lib/charting@7.0.7) (2026-06-12)
|
|
67
|
-
|
|
68
|
-
### Bug Fixes
|
|
69
|
-
|
|
70
|
-
- correct @emotion/style typo to @emotion/styled in package deps PIE-678 ([d529ac7](https://github.com/pie-framework/pie-lib/commit/d529ac7bc3dfa94d8037688452d4c70c66f2590b))
|
|
71
|
-
|
|
72
|
-
## [7.0.6](https://github.com/pie-framework/pie-lib/compare/@pie-lib/charting@7.0.5...@pie-lib/charting@7.0.6) (2026-06-03)
|
|
73
|
-
|
|
74
|
-
**Note:** Version bump only for package @pie-lib/charting
|
|
75
|
-
|
|
76
|
-
## [7.0.5](https://github.com/pie-framework/pie-lib/compare/@pie-lib/charting@7.0.4...@pie-lib/charting@7.0.5) (2026-06-01)
|
|
77
|
-
|
|
78
|
-
**Note:** Version bump only for package @pie-lib/charting
|
|
79
|
-
|
|
80
|
-
## [7.0.4](https://github.com/pie-framework/pie-lib/compare/@pie-lib/charting@7.0.3...@pie-lib/charting@7.0.4) (2026-05-21)
|
|
81
|
-
|
|
82
|
-
**Note:** Version bump only for package @pie-lib/charting
|
|
83
|
-
|
|
84
6
|
## [7.0.3](https://github.com/pie-framework/pie-lib/compare/@pie-lib/charting@7.0.2...@pie-lib/charting@7.0.3) (2026-05-15)
|
|
85
7
|
|
|
86
8
|
### Bug Fixes
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "7.0.
|
|
6
|
+
"version": "7.0.22-beta.2",
|
|
7
7
|
"description": "charting",
|
|
8
8
|
"keywords": [
|
|
9
9
|
"react",
|
|
@@ -22,17 +22,17 @@
|
|
|
22
22
|
"@mapbox/point-geometry": "^1.1.0",
|
|
23
23
|
"@mui/icons-material": "^7.3.4",
|
|
24
24
|
"@mui/material": "^7.3.4",
|
|
25
|
-
"@pie-lib/math-rendering": "^5.
|
|
26
|
-
"@pie-lib/plot": "^4.0.
|
|
27
|
-
"@pie-lib/render-ui": "^
|
|
25
|
+
"@pie-lib/math-rendering": "^5.0.2",
|
|
26
|
+
"@pie-lib/plot": "^4.0.22-beta.2",
|
|
27
|
+
"@pie-lib/render-ui": "^6.1.0",
|
|
28
28
|
"@pie-lib/translator": "^4.0.2",
|
|
29
|
-
"@visx/axis": "^
|
|
30
|
-
"@visx/event": "^
|
|
31
|
-
"@visx/grid": "^
|
|
32
|
-
"@visx/group": "^
|
|
33
|
-
"@visx/point": "^
|
|
34
|
-
"@visx/scale": "^
|
|
35
|
-
"@visx/shape": "^
|
|
29
|
+
"@visx/axis": "^3.0.0",
|
|
30
|
+
"@visx/event": "^3.0.0",
|
|
31
|
+
"@visx/grid": "^3.0.0",
|
|
32
|
+
"@visx/group": "^3.0.0",
|
|
33
|
+
"@visx/point": "^3.0.0",
|
|
34
|
+
"@visx/scale": "^3.0.0",
|
|
35
|
+
"@visx/shape": "^3.0.0",
|
|
36
36
|
"classnames": "^2.2.6",
|
|
37
37
|
"d3-scale": "^4.0.2",
|
|
38
38
|
"d3-selection": "^3.0.0",
|
|
@@ -40,14 +40,14 @@
|
|
|
40
40
|
"invariant": "^2.2.4",
|
|
41
41
|
"lodash-es": "^4.17.23",
|
|
42
42
|
"react": "^18.2.0",
|
|
43
|
-
"react-draggable": "^
|
|
43
|
+
"react-draggable": "^3.3.0",
|
|
44
44
|
"react-input-autosize": "^2.2.1"
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|
|
47
47
|
"react": "^18.2.0"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
|
-
"@pie-lib/test-utils": "^2.0.
|
|
50
|
+
"@pie-lib/test-utils": "^2.0.2"
|
|
51
51
|
},
|
|
52
|
-
"gitHead": "
|
|
52
|
+
"gitHead": "433bcb776c2975739e7417f133d31cd996164116"
|
|
53
53
|
}
|
package/LICENSE.md
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
Copyright 2019 CoreSpring Inc
|
|
2
|
-
|
|
3
|
-
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
|
|
4
|
-
|
|
5
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
@@ -1,280 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { fireEvent, render } from '@testing-library/react';
|
|
3
|
-
import { createTheme, ThemeProvider } from '@mui/material/styles';
|
|
4
|
-
import { ActionsButton } from '../actions-button';
|
|
5
|
-
|
|
6
|
-
jest.mock('@pie-lib/translator', () => ({
|
|
7
|
-
__esModule: true,
|
|
8
|
-
default: {
|
|
9
|
-
translator: {
|
|
10
|
-
t: jest.fn((key) => {
|
|
11
|
-
const translations = {
|
|
12
|
-
'charting.add': 'Add Category',
|
|
13
|
-
'charting.delete': 'Delete',
|
|
14
|
-
'charting.newLabel': 'New Category',
|
|
15
|
-
};
|
|
16
|
-
return translations[key] || key;
|
|
17
|
-
}),
|
|
18
|
-
},
|
|
19
|
-
},
|
|
20
|
-
}));
|
|
21
|
-
|
|
22
|
-
let theme;
|
|
23
|
-
|
|
24
|
-
beforeAll(() => {
|
|
25
|
-
theme = createTheme();
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
describe('ActionsButton', () => {
|
|
29
|
-
const addCategory = jest.fn();
|
|
30
|
-
const deleteCategory = jest.fn();
|
|
31
|
-
|
|
32
|
-
beforeEach(() => {
|
|
33
|
-
jest.clearAllMocks();
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
const renderComponent = (extras = {}) => {
|
|
37
|
-
const defaults = {
|
|
38
|
-
addCategory,
|
|
39
|
-
deleteCategory,
|
|
40
|
-
categories: [],
|
|
41
|
-
language: 'en',
|
|
42
|
-
};
|
|
43
|
-
const props = { ...defaults, ...extras };
|
|
44
|
-
return render(
|
|
45
|
-
<ThemeProvider theme={theme}>
|
|
46
|
-
<ActionsButton {...props} />
|
|
47
|
-
</ThemeProvider>,
|
|
48
|
-
);
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
describe('rendering', () => {
|
|
52
|
-
it('renders without crashing', () => {
|
|
53
|
-
const { container } = renderComponent();
|
|
54
|
-
expect(container).toBeInTheDocument();
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
it('renders Actions button', () => {
|
|
58
|
-
const { getByText } = renderComponent();
|
|
59
|
-
expect(getByText('Actions')).toBeInTheDocument();
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
it('renders with custom language', () => {
|
|
63
|
-
const { container } = renderComponent({ language: 'es' });
|
|
64
|
-
expect(container).toBeInTheDocument();
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
it('renders with empty categories', () => {
|
|
68
|
-
const { container } = renderComponent({ categories: [] });
|
|
69
|
-
expect(container).toBeInTheDocument();
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
it('renders with multiple categories', () => {
|
|
73
|
-
const categories = [
|
|
74
|
-
{ label: 'A', deletable: true },
|
|
75
|
-
{ label: 'B', deletable: true },
|
|
76
|
-
{ label: 'C', deletable: false },
|
|
77
|
-
];
|
|
78
|
-
const { container } = renderComponent({ categories });
|
|
79
|
-
expect(container).toBeInTheDocument();
|
|
80
|
-
});
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
describe('popover interactions', () => {
|
|
84
|
-
it('opens popover when Actions button is clicked', () => {
|
|
85
|
-
const { getByText } = renderComponent();
|
|
86
|
-
const actionsButton = getByText('Actions');
|
|
87
|
-
|
|
88
|
-
fireEvent.click(actionsButton);
|
|
89
|
-
|
|
90
|
-
expect(getByText(/Add Category/i)).toBeInTheDocument();
|
|
91
|
-
});
|
|
92
|
-
|
|
93
|
-
it('closes popover when clicking outside', () => {
|
|
94
|
-
const { getByText } = renderComponent();
|
|
95
|
-
const actionsButton = getByText('Actions');
|
|
96
|
-
|
|
97
|
-
fireEvent.click(actionsButton);
|
|
98
|
-
expect(getByText(/Add Category/i)).toBeInTheDocument();
|
|
99
|
-
|
|
100
|
-
const backdrop = document.querySelector('.MuiPopover-root');
|
|
101
|
-
if (backdrop) {
|
|
102
|
-
fireEvent.click(backdrop);
|
|
103
|
-
}
|
|
104
|
-
});
|
|
105
|
-
|
|
106
|
-
it('has correct accessibility attributes', () => {
|
|
107
|
-
const { getByText } = renderComponent();
|
|
108
|
-
const actionsButton = getByText('Actions');
|
|
109
|
-
|
|
110
|
-
expect(actionsButton).toHaveAttribute('role', 'button');
|
|
111
|
-
expect(actionsButton).toHaveAttribute('tabIndex', '0');
|
|
112
|
-
});
|
|
113
|
-
});
|
|
114
|
-
|
|
115
|
-
describe('add category functionality', () => {
|
|
116
|
-
it('calls addCategory when add button is clicked', () => {
|
|
117
|
-
const { getByText } = renderComponent();
|
|
118
|
-
|
|
119
|
-
fireEvent.click(getByText('Actions'));
|
|
120
|
-
fireEvent.click(getByText(/Add Category/i));
|
|
121
|
-
|
|
122
|
-
expect(addCategory).toHaveBeenCalledTimes(1);
|
|
123
|
-
});
|
|
124
|
-
|
|
125
|
-
it('closes popover after adding category', () => {
|
|
126
|
-
const { getByText } = renderComponent();
|
|
127
|
-
|
|
128
|
-
fireEvent.click(getByText('Actions'));
|
|
129
|
-
fireEvent.click(getByText(/Add Category/i));
|
|
130
|
-
|
|
131
|
-
expect(addCategory).toHaveBeenCalled();
|
|
132
|
-
});
|
|
133
|
-
});
|
|
134
|
-
|
|
135
|
-
describe('delete category functionality', () => {
|
|
136
|
-
it('shows delete buttons for deletable categories', () => {
|
|
137
|
-
const categories = [
|
|
138
|
-
{ label: 'Category A', deletable: true },
|
|
139
|
-
{ label: 'Category B', deletable: true },
|
|
140
|
-
];
|
|
141
|
-
const { getByText } = renderComponent({ categories });
|
|
142
|
-
|
|
143
|
-
fireEvent.click(getByText('Actions'));
|
|
144
|
-
|
|
145
|
-
expect(getByText(/Delete <Category A>/i)).toBeInTheDocument();
|
|
146
|
-
expect(getByText(/Delete <Category B>/i)).toBeInTheDocument();
|
|
147
|
-
});
|
|
148
|
-
|
|
149
|
-
it('does not show delete button for non-deletable categories', () => {
|
|
150
|
-
const categories = [{ label: 'Category A', deletable: false }];
|
|
151
|
-
const { getByText, queryByText } = renderComponent({ categories });
|
|
152
|
-
|
|
153
|
-
fireEvent.click(getByText('Actions'));
|
|
154
|
-
|
|
155
|
-
expect(queryByText(/Delete <Category A>/i)).not.toBeInTheDocument();
|
|
156
|
-
});
|
|
157
|
-
|
|
158
|
-
it('does not show delete button for categories with correctness', () => {
|
|
159
|
-
const categories = [{ label: 'Category A', deletable: true, correctness: { value: 'correct' } }];
|
|
160
|
-
const { getByText, queryByText } = renderComponent({ categories });
|
|
161
|
-
|
|
162
|
-
fireEvent.click(getByText('Actions'));
|
|
163
|
-
|
|
164
|
-
expect(queryByText(/Delete <Category A>/i)).not.toBeInTheDocument();
|
|
165
|
-
});
|
|
166
|
-
|
|
167
|
-
it('calls deleteCategory with correct index', () => {
|
|
168
|
-
const categories = [
|
|
169
|
-
{ label: 'Category A', deletable: true },
|
|
170
|
-
{ label: 'Category B', deletable: true },
|
|
171
|
-
];
|
|
172
|
-
const { getByText } = renderComponent({ categories });
|
|
173
|
-
|
|
174
|
-
fireEvent.click(getByText('Actions'));
|
|
175
|
-
fireEvent.click(getByText(/Delete <Category B>/i));
|
|
176
|
-
|
|
177
|
-
expect(deleteCategory).toHaveBeenCalledWith(1);
|
|
178
|
-
});
|
|
179
|
-
|
|
180
|
-
it('closes popover after deleting category', () => {
|
|
181
|
-
const categories = [{ label: 'Category A', deletable: true }];
|
|
182
|
-
const { getByText } = renderComponent({ categories });
|
|
183
|
-
|
|
184
|
-
fireEvent.click(getByText('Actions'));
|
|
185
|
-
fireEvent.click(getByText(/Delete <Category A>/i));
|
|
186
|
-
|
|
187
|
-
expect(deleteCategory).toHaveBeenCalled();
|
|
188
|
-
});
|
|
189
|
-
|
|
190
|
-
it('shows "New Category" for categories without label', () => {
|
|
191
|
-
const categories = [{ label: '', deletable: true }];
|
|
192
|
-
const { getByText } = renderComponent({ categories });
|
|
193
|
-
|
|
194
|
-
fireEvent.click(getByText('Actions'));
|
|
195
|
-
|
|
196
|
-
expect(getByText(/Delete <New Category>/i)).toBeInTheDocument();
|
|
197
|
-
});
|
|
198
|
-
|
|
199
|
-
it('handles deletion of multiple categories', () => {
|
|
200
|
-
const categories = [
|
|
201
|
-
{ label: 'A', deletable: true },
|
|
202
|
-
{ label: 'B', deletable: true },
|
|
203
|
-
{ label: 'C', deletable: true },
|
|
204
|
-
];
|
|
205
|
-
const { getByText } = renderComponent({ categories });
|
|
206
|
-
|
|
207
|
-
fireEvent.click(getByText('Actions'));
|
|
208
|
-
|
|
209
|
-
expect(getByText(/Delete <A>/i)).toBeInTheDocument();
|
|
210
|
-
expect(getByText(/Delete <B>/i)).toBeInTheDocument();
|
|
211
|
-
expect(getByText(/Delete <C>/i)).toBeInTheDocument();
|
|
212
|
-
});
|
|
213
|
-
});
|
|
214
|
-
|
|
215
|
-
describe('componentWillUnmount', () => {
|
|
216
|
-
it('cleans up state on unmount', () => {
|
|
217
|
-
const { unmount, getByText } = renderComponent();
|
|
218
|
-
|
|
219
|
-
fireEvent.click(getByText('Actions'));
|
|
220
|
-
unmount();
|
|
221
|
-
|
|
222
|
-
// Should not throw error
|
|
223
|
-
expect(true).toBe(true);
|
|
224
|
-
});
|
|
225
|
-
});
|
|
226
|
-
|
|
227
|
-
describe('edge cases', () => {
|
|
228
|
-
it('handles empty categories array', () => {
|
|
229
|
-
const { container } = renderComponent({ categories: [] });
|
|
230
|
-
expect(container).toBeInTheDocument();
|
|
231
|
-
});
|
|
232
|
-
|
|
233
|
-
it('handles undefined language', () => {
|
|
234
|
-
const { container } = renderComponent({ language: undefined });
|
|
235
|
-
expect(container).toBeInTheDocument();
|
|
236
|
-
});
|
|
237
|
-
|
|
238
|
-
it('handles mixed deletable and correctness states', () => {
|
|
239
|
-
const categories = [
|
|
240
|
-
{ label: 'A', deletable: true },
|
|
241
|
-
{ label: 'B', deletable: false },
|
|
242
|
-
{ label: 'C', deletable: true, correctness: { value: 'correct' } },
|
|
243
|
-
{ label: 'D', deletable: true },
|
|
244
|
-
];
|
|
245
|
-
const { getByText } = renderComponent({ categories });
|
|
246
|
-
|
|
247
|
-
fireEvent.click(getByText('Actions'));
|
|
248
|
-
|
|
249
|
-
expect(getByText(/Delete <A>/i)).toBeInTheDocument();
|
|
250
|
-
expect(getByText(/Delete <D>/i)).toBeInTheDocument();
|
|
251
|
-
});
|
|
252
|
-
|
|
253
|
-
it('handles categories with special characters in labels', () => {
|
|
254
|
-
const categories = [{ label: '<>&"\'', deletable: true }];
|
|
255
|
-
const { getByText } = renderComponent({ categories });
|
|
256
|
-
|
|
257
|
-
fireEvent.click(getByText('Actions'));
|
|
258
|
-
|
|
259
|
-
expect(getByText(/Delete </i)).toBeInTheDocument();
|
|
260
|
-
});
|
|
261
|
-
|
|
262
|
-
it('handles very long category labels', () => {
|
|
263
|
-
const categories = [{ label: 'A'.repeat(100), deletable: true }];
|
|
264
|
-
const { container } = renderComponent({ categories });
|
|
265
|
-
expect(container).toBeInTheDocument();
|
|
266
|
-
});
|
|
267
|
-
});
|
|
268
|
-
|
|
269
|
-
describe('popover positioning', () => {
|
|
270
|
-
it('has correct anchor origin', () => {
|
|
271
|
-
const { getByText, queryByText } = renderComponent();
|
|
272
|
-
|
|
273
|
-
expect(queryByText(/\+ Add Category/i)).not.toBeInTheDocument();
|
|
274
|
-
|
|
275
|
-
fireEvent.click(getByText('Actions'));
|
|
276
|
-
|
|
277
|
-
expect(getByText(/\+ Add Category/i)).toBeInTheDocument();
|
|
278
|
-
});
|
|
279
|
-
});
|
|
280
|
-
});
|