@pie-element/hotspot 10.0.0-next.43 → 10.1.2-next.1
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 +1032 -2486
- package/configure/CHANGELOG.md +881 -2216
- package/configure/lib/defaults.js +3 -0
- package/configure/lib/defaults.js.map +1 -1
- package/configure/lib/hotspot-circle.js +6 -4
- package/configure/lib/hotspot-circle.js.map +1 -1
- package/configure/lib/hotspot-drawable.js +5 -5
- package/configure/lib/hotspot-drawable.js.map +1 -1
- package/configure/lib/hotspot-polygon.js +1 -2
- package/configure/lib/hotspot-polygon.js.map +1 -1
- package/configure/lib/hotspot-rectangle.js +6 -5
- package/configure/lib/hotspot-rectangle.js.map +1 -1
- package/configure/lib/utils.js +2 -3
- package/configure/lib/utils.js.map +1 -1
- package/configure/package.json +6 -6
- package/configure/src/__tests__/DeleteWidget.test.jsx +366 -0
- package/configure/src/__tests__/button.test.jsx +198 -0
- package/configure/src/__tests__/hotspot-circle.test.jsx +259 -0
- package/configure/src/__tests__/hotspot-palette.test.jsx +71 -0
- package/configure/src/__tests__/image-konva.test.jsx +226 -0
- package/configure/src/defaults.js +1 -0
- package/configure/src/hotspot-circle.jsx +4 -2
- package/configure/src/hotspot-drawable.jsx +1 -1
- package/configure/src/hotspot-polygon.jsx +0 -1
- package/configure/src/hotspot-rectangle.jsx +4 -3
- package/configure/src/utils.js +1 -1
- package/controller/CHANGELOG.md +600 -1532
- package/controller/lib/index.js +2 -2
- package/controller/lib/index.js.map +1 -1
- package/controller/lib/utils.js +3 -5
- package/controller/lib/utils.js.map +1 -1
- package/controller/package.json +3 -3
- package/controller/src/index.js +1 -1
- package/controller/src/utils.js +1 -2
- package/lib/hotspot/circle.js +1 -2
- package/lib/hotspot/circle.js.map +1 -1
- package/lib/hotspot/polygon.js +0 -1
- package/lib/hotspot/polygon.js.map +1 -1
- package/lib/hotspot/rectangle.js +0 -1
- package/lib/hotspot/rectangle.js.map +1 -1
- package/package.json +7 -7
- package/src/hotspot/__tests__/circle.test.jsx +464 -0
- package/src/hotspot/__tests__/container.test.jsx +546 -0
- package/src/hotspot/__tests__/image-konva-tooltip.test.jsx +510 -0
- package/src/hotspot/__tests__/polygon.test.jsx +502 -0
- package/src/hotspot/__tests__/rectangle.test.jsx +418 -0
- package/src/hotspot/circle.jsx +0 -1
- package/src/hotspot/polygon.jsx +0 -1
- package/src/hotspot/rectangle.jsx +0 -1
|
@@ -0,0 +1,464 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { render, fireEvent } from '@testing-library/react';
|
|
3
|
+
import Konva from 'konva';
|
|
4
|
+
import CircleComponent from '../circle';
|
|
5
|
+
|
|
6
|
+
Konva.isBrowser = false;
|
|
7
|
+
|
|
8
|
+
jest.mock('react-konva', () => {
|
|
9
|
+
const React = require('react');
|
|
10
|
+
return {
|
|
11
|
+
Circle: ({ onClick, onTap, onMouseEnter, onMouseLeave, ...props }) => {
|
|
12
|
+
const handleClick = (e) => {
|
|
13
|
+
if (onClick) onClick(e);
|
|
14
|
+
if (onTap) onTap(e);
|
|
15
|
+
};
|
|
16
|
+
return React.createElement('div', {
|
|
17
|
+
'data-testid': 'circle',
|
|
18
|
+
onClick: handleClick,
|
|
19
|
+
onMouseEnter,
|
|
20
|
+
onMouseLeave,
|
|
21
|
+
...props,
|
|
22
|
+
});
|
|
23
|
+
},
|
|
24
|
+
Rect: (props) => React.createElement('div', { 'data-testid': 'rect', ...props }),
|
|
25
|
+
Group: ({ children, ...props }) => React.createElement('div', { 'data-testid': 'group', ...props }, children),
|
|
26
|
+
};
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
jest.mock('../image-konva-tooltip', () => {
|
|
30
|
+
return function ImageComponent({ src, x, y, tooltip }) {
|
|
31
|
+
return <div data-testid="icon-image" data-src={src} data-x={x} data-y={y} data-tooltip={tooltip} />;
|
|
32
|
+
};
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
describe('CircleComponent', () => {
|
|
36
|
+
let defaultProps;
|
|
37
|
+
|
|
38
|
+
beforeEach(() => {
|
|
39
|
+
defaultProps = {
|
|
40
|
+
id: 'circle1',
|
|
41
|
+
x: 50,
|
|
42
|
+
y: 50,
|
|
43
|
+
radius: 30,
|
|
44
|
+
hotspotColor: '#FF0000',
|
|
45
|
+
selectedHotspotColor: '#00FF00',
|
|
46
|
+
outlineColor: '#0000FF',
|
|
47
|
+
hoverOutlineColor: '#FFFF00',
|
|
48
|
+
selected: false,
|
|
49
|
+
isCorrect: false,
|
|
50
|
+
isEvaluateMode: false,
|
|
51
|
+
disabled: false,
|
|
52
|
+
onClick: jest.fn(),
|
|
53
|
+
strokeWidth: 5,
|
|
54
|
+
scale: 1,
|
|
55
|
+
markAsCorrect: false,
|
|
56
|
+
showCorrectEnabled: false,
|
|
57
|
+
};
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
afterEach(() => {
|
|
61
|
+
document.body.style.cursor = 'default';
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
describe('rendering', () => {
|
|
65
|
+
it('should render without crashing', () => {
|
|
66
|
+
const { container } = render(<CircleComponent {...defaultProps} />);
|
|
67
|
+
expect(container).toBeTruthy();
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
it('should render with correct position and radius', () => {
|
|
71
|
+
const { getByTestId } = render(<CircleComponent {...defaultProps} />);
|
|
72
|
+
const circle = getByTestId('circle');
|
|
73
|
+
|
|
74
|
+
expect(circle).toHaveAttribute('x', '50');
|
|
75
|
+
expect(circle).toHaveAttribute('y', '50');
|
|
76
|
+
expect(circle).toHaveAttribute('radius', '30');
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
it('should render with hotspot color when not selected', () => {
|
|
80
|
+
const { getByTestId } = render(<CircleComponent {...defaultProps} />);
|
|
81
|
+
const circle = getByTestId('circle');
|
|
82
|
+
|
|
83
|
+
expect(circle).toHaveAttribute('fill', '#FF0000');
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
it('should render with selected color when selected', () => {
|
|
87
|
+
const { getByTestId } = render(<CircleComponent {...defaultProps} selected={true} />);
|
|
88
|
+
const circle = getByTestId('circle');
|
|
89
|
+
|
|
90
|
+
expect(circle).toHaveAttribute('fill', '#00FF00');
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
it('should apply scale transform', () => {
|
|
94
|
+
const { getByTestId } = render(<CircleComponent {...defaultProps} scale={2.0} />);
|
|
95
|
+
const group = getByTestId('group');
|
|
96
|
+
|
|
97
|
+
expect(group).toHaveAttribute('scaleX', '2');
|
|
98
|
+
expect(group).toHaveAttribute('scaleY', '2');
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
it('should render with default scale of 1', () => {
|
|
102
|
+
const { getByTestId } = render(<CircleComponent {...defaultProps} />);
|
|
103
|
+
const group = getByTestId('group');
|
|
104
|
+
|
|
105
|
+
expect(group).toHaveAttribute('scaleX', '1');
|
|
106
|
+
expect(group).toHaveAttribute('scaleY', '1');
|
|
107
|
+
});
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
describe('interactions', () => {
|
|
111
|
+
it('should call onClick when clicked', () => {
|
|
112
|
+
const onClick = jest.fn();
|
|
113
|
+
const { getByTestId } = render(<CircleComponent {...defaultProps} onClick={onClick} />);
|
|
114
|
+
const circle = getByTestId('circle');
|
|
115
|
+
|
|
116
|
+
fireEvent.click(circle);
|
|
117
|
+
|
|
118
|
+
expect(onClick).toHaveBeenCalledWith({
|
|
119
|
+
id: 'circle1',
|
|
120
|
+
selected: true,
|
|
121
|
+
selector: 'Mouse',
|
|
122
|
+
});
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
it('should toggle selection state on click', () => {
|
|
126
|
+
const onClick = jest.fn();
|
|
127
|
+
const { getByTestId, rerender } = render(<CircleComponent {...defaultProps} onClick={onClick} selected={false} />);
|
|
128
|
+
const circle = getByTestId('circle');
|
|
129
|
+
|
|
130
|
+
fireEvent.click(circle);
|
|
131
|
+
|
|
132
|
+
expect(onClick).toHaveBeenCalledWith({
|
|
133
|
+
id: 'circle1',
|
|
134
|
+
selected: true,
|
|
135
|
+
selector: 'Mouse',
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
rerender(<CircleComponent {...defaultProps} onClick={onClick} selected={true} />);
|
|
139
|
+
|
|
140
|
+
const circleAfter = getByTestId('circle');
|
|
141
|
+
fireEvent.click(circleAfter);
|
|
142
|
+
|
|
143
|
+
expect(onClick).toHaveBeenCalledWith({
|
|
144
|
+
id: 'circle1',
|
|
145
|
+
selected: false,
|
|
146
|
+
selector: 'Mouse',
|
|
147
|
+
});
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
it('should not call onClick when disabled', () => {
|
|
151
|
+
const onClick = jest.fn();
|
|
152
|
+
const { getByTestId } = render(<CircleComponent {...defaultProps} onClick={onClick} disabled={true} />);
|
|
153
|
+
const circle = getByTestId('circle');
|
|
154
|
+
|
|
155
|
+
fireEvent.click(circle);
|
|
156
|
+
|
|
157
|
+
expect(onClick).not.toHaveBeenCalled();
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
it('should change cursor to pointer on mouse enter when not disabled', () => {
|
|
161
|
+
const { getByTestId } = render(<CircleComponent {...defaultProps} />);
|
|
162
|
+
const circle = getByTestId('circle');
|
|
163
|
+
|
|
164
|
+
fireEvent.mouseEnter(circle);
|
|
165
|
+
|
|
166
|
+
expect(document.body.style.cursor).toBe('pointer');
|
|
167
|
+
});
|
|
168
|
+
|
|
169
|
+
it('should not change cursor when disabled', () => {
|
|
170
|
+
const { getByTestId } = render(<CircleComponent {...defaultProps} disabled={true} />);
|
|
171
|
+
const circle = getByTestId('circle');
|
|
172
|
+
|
|
173
|
+
fireEvent.mouseEnter(circle);
|
|
174
|
+
|
|
175
|
+
expect(document.body.style.cursor).toBe('default');
|
|
176
|
+
});
|
|
177
|
+
|
|
178
|
+
it('should reset cursor to default on mouse leave', () => {
|
|
179
|
+
const { getByTestId } = render(<CircleComponent {...defaultProps} />);
|
|
180
|
+
const circle = getByTestId('circle');
|
|
181
|
+
|
|
182
|
+
fireEvent.mouseEnter(circle);
|
|
183
|
+
fireEvent.mouseLeave(circle);
|
|
184
|
+
|
|
185
|
+
expect(document.body.style.cursor).toBe('default');
|
|
186
|
+
});
|
|
187
|
+
});
|
|
188
|
+
|
|
189
|
+
describe('hover styling', () => {
|
|
190
|
+
it('should show hover rect when hoverOutlineColor is provided', () => {
|
|
191
|
+
const { container, getByTestId } = render(<CircleComponent {...defaultProps} hoverOutlineColor="#FFFF00" />);
|
|
192
|
+
const circle = getByTestId('circle');
|
|
193
|
+
|
|
194
|
+
fireEvent.mouseEnter(circle);
|
|
195
|
+
|
|
196
|
+
const rects = container.querySelectorAll('[data-testid="rect"]');
|
|
197
|
+
expect(rects.length).toBeGreaterThan(0);
|
|
198
|
+
});
|
|
199
|
+
|
|
200
|
+
it('should render hover rect with correct dimensions based on radius', () => {
|
|
201
|
+
const { container, getByTestId } = render(
|
|
202
|
+
<CircleComponent
|
|
203
|
+
{...defaultProps}
|
|
204
|
+
x={50}
|
|
205
|
+
y={50}
|
|
206
|
+
radius={30}
|
|
207
|
+
hoverOutlineColor="#FFFF00"
|
|
208
|
+
/>
|
|
209
|
+
);
|
|
210
|
+
const circle = getByTestId('circle');
|
|
211
|
+
|
|
212
|
+
fireEvent.mouseEnter(circle);
|
|
213
|
+
|
|
214
|
+
const rect = container.querySelector('[data-testid="rect"]');
|
|
215
|
+
if (rect) {
|
|
216
|
+
// Rect should be positioned at (x - radius, y - radius) with width/height = radius * 2
|
|
217
|
+
expect(rect).toHaveAttribute('x', '20'); // 50 - 30
|
|
218
|
+
expect(rect).toHaveAttribute('y', '20'); // 50 - 30
|
|
219
|
+
expect(rect).toHaveAttribute('width', '60'); // 30 * 2
|
|
220
|
+
expect(rect).toHaveAttribute('height', '60'); // 30 * 2
|
|
221
|
+
}
|
|
222
|
+
});
|
|
223
|
+
|
|
224
|
+
it('should show transparent stroke when selected and hovering', () => {
|
|
225
|
+
const { container, getByTestId } = render(
|
|
226
|
+
<CircleComponent {...defaultProps} selected={true} hoverOutlineColor="#FFFF00" />
|
|
227
|
+
);
|
|
228
|
+
const circle = getByTestId('circle');
|
|
229
|
+
|
|
230
|
+
fireEvent.mouseEnter(circle);
|
|
231
|
+
|
|
232
|
+
const rect = container.querySelector('[data-testid="rect"]');
|
|
233
|
+
if (rect) {
|
|
234
|
+
expect(rect).toHaveAttribute('stroke', 'transparent');
|
|
235
|
+
}
|
|
236
|
+
});
|
|
237
|
+
});
|
|
238
|
+
|
|
239
|
+
describe('evaluate mode', () => {
|
|
240
|
+
it('should show correct icon when correctly selected in evaluate mode', () => {
|
|
241
|
+
const { getByTestId } = render(
|
|
242
|
+
<CircleComponent
|
|
243
|
+
{...defaultProps}
|
|
244
|
+
isEvaluateMode={true}
|
|
245
|
+
selected={true}
|
|
246
|
+
isCorrect={true}
|
|
247
|
+
showCorrectEnabled={false}
|
|
248
|
+
/>
|
|
249
|
+
);
|
|
250
|
+
|
|
251
|
+
const icon = getByTestId('icon-image');
|
|
252
|
+
expect(icon).toBeInTheDocument();
|
|
253
|
+
});
|
|
254
|
+
|
|
255
|
+
it('should show wrong icon when incorrectly selected in evaluate mode', () => {
|
|
256
|
+
const { getByTestId } = render(
|
|
257
|
+
<CircleComponent
|
|
258
|
+
{...defaultProps}
|
|
259
|
+
isEvaluateMode={true}
|
|
260
|
+
selected={true}
|
|
261
|
+
isCorrect={false}
|
|
262
|
+
showCorrectEnabled={false}
|
|
263
|
+
/>
|
|
264
|
+
);
|
|
265
|
+
|
|
266
|
+
const icon = getByTestId('icon-image');
|
|
267
|
+
expect(icon).toBeInTheDocument();
|
|
268
|
+
});
|
|
269
|
+
|
|
270
|
+
it('should show wrong icon when incorrectly not selected', () => {
|
|
271
|
+
const { getByTestId } = render(
|
|
272
|
+
<CircleComponent
|
|
273
|
+
{...defaultProps}
|
|
274
|
+
isEvaluateMode={true}
|
|
275
|
+
selected={false}
|
|
276
|
+
isCorrect={false}
|
|
277
|
+
showCorrectEnabled={false}
|
|
278
|
+
/>
|
|
279
|
+
);
|
|
280
|
+
|
|
281
|
+
const icon = getByTestId('icon-image');
|
|
282
|
+
expect(icon).toBeInTheDocument();
|
|
283
|
+
});
|
|
284
|
+
|
|
285
|
+
it('should not show icon when correctly not selected in evaluate mode', () => {
|
|
286
|
+
const { queryByTestId } = render(
|
|
287
|
+
<CircleComponent
|
|
288
|
+
{...defaultProps}
|
|
289
|
+
isEvaluateMode={true}
|
|
290
|
+
selected={false}
|
|
291
|
+
isCorrect={true}
|
|
292
|
+
showCorrectEnabled={false}
|
|
293
|
+
/>
|
|
294
|
+
);
|
|
295
|
+
|
|
296
|
+
const icon = queryByTestId('icon-image');
|
|
297
|
+
expect(icon).not.toBeInTheDocument();
|
|
298
|
+
});
|
|
299
|
+
|
|
300
|
+
it('should show correct icon for showCorrect mode when correctly selected', () => {
|
|
301
|
+
const { getByTestId } = render(
|
|
302
|
+
<CircleComponent
|
|
303
|
+
{...defaultProps}
|
|
304
|
+
isEvaluateMode={true}
|
|
305
|
+
selected={true}
|
|
306
|
+
isCorrect={true}
|
|
307
|
+
showCorrectEnabled={true}
|
|
308
|
+
/>
|
|
309
|
+
);
|
|
310
|
+
|
|
311
|
+
const icon = getByTestId('icon-image');
|
|
312
|
+
expect(icon).toBeInTheDocument();
|
|
313
|
+
});
|
|
314
|
+
|
|
315
|
+
it('should show correct icon for showCorrect mode when incorrectly not selected', () => {
|
|
316
|
+
const { getByTestId } = render(
|
|
317
|
+
<CircleComponent
|
|
318
|
+
{...defaultProps}
|
|
319
|
+
isEvaluateMode={true}
|
|
320
|
+
selected={false}
|
|
321
|
+
isCorrect={false}
|
|
322
|
+
showCorrectEnabled={true}
|
|
323
|
+
/>
|
|
324
|
+
);
|
|
325
|
+
|
|
326
|
+
const icon = getByTestId('icon-image');
|
|
327
|
+
expect(icon).toBeInTheDocument();
|
|
328
|
+
});
|
|
329
|
+
|
|
330
|
+
it('should not show icon in showCorrect mode when correctly not selected', () => {
|
|
331
|
+
const { queryByTestId } = render(
|
|
332
|
+
<CircleComponent
|
|
333
|
+
{...defaultProps}
|
|
334
|
+
isEvaluateMode={true}
|
|
335
|
+
selected={false}
|
|
336
|
+
isCorrect={true}
|
|
337
|
+
showCorrectEnabled={true}
|
|
338
|
+
/>
|
|
339
|
+
);
|
|
340
|
+
|
|
341
|
+
const icon = queryByTestId('icon-image');
|
|
342
|
+
expect(icon).not.toBeInTheDocument();
|
|
343
|
+
});
|
|
344
|
+
|
|
345
|
+
it('should not show icon in showCorrect mode when incorrectly selected', () => {
|
|
346
|
+
const { queryByTestId } = render(
|
|
347
|
+
<CircleComponent
|
|
348
|
+
{...defaultProps}
|
|
349
|
+
isEvaluateMode={true}
|
|
350
|
+
selected={true}
|
|
351
|
+
isCorrect={false}
|
|
352
|
+
showCorrectEnabled={true}
|
|
353
|
+
/>
|
|
354
|
+
);
|
|
355
|
+
|
|
356
|
+
const icon = queryByTestId('icon-image');
|
|
357
|
+
expect(icon).not.toBeInTheDocument();
|
|
358
|
+
});
|
|
359
|
+
|
|
360
|
+
it('should show green outline when markAsCorrect is true', () => {
|
|
361
|
+
const { getByTestId } = render(
|
|
362
|
+
<CircleComponent
|
|
363
|
+
{...defaultProps}
|
|
364
|
+
isEvaluateMode={true}
|
|
365
|
+
markAsCorrect={true}
|
|
366
|
+
/>
|
|
367
|
+
);
|
|
368
|
+
|
|
369
|
+
const circle = getByTestId('circle');
|
|
370
|
+
expect(circle).toHaveAttribute('stroke', 'green');
|
|
371
|
+
});
|
|
372
|
+
|
|
373
|
+
it('should show red outline when incorrect and not markAsCorrect', () => {
|
|
374
|
+
const { getByTestId } = render(
|
|
375
|
+
<CircleComponent
|
|
376
|
+
{...defaultProps}
|
|
377
|
+
isEvaluateMode={true}
|
|
378
|
+
isCorrect={false}
|
|
379
|
+
markAsCorrect={false}
|
|
380
|
+
/>
|
|
381
|
+
);
|
|
382
|
+
|
|
383
|
+
const circle = getByTestId('circle');
|
|
384
|
+
expect(circle).toHaveAttribute('stroke', 'red');
|
|
385
|
+
});
|
|
386
|
+
|
|
387
|
+
it('should display evaluate text in tooltip', () => {
|
|
388
|
+
const { getByTestId } = render(
|
|
389
|
+
<CircleComponent
|
|
390
|
+
{...defaultProps}
|
|
391
|
+
isEvaluateMode={true}
|
|
392
|
+
selected={true}
|
|
393
|
+
isCorrect={true}
|
|
394
|
+
evaluateText="Great job!"
|
|
395
|
+
showCorrectEnabled={false}
|
|
396
|
+
/>
|
|
397
|
+
);
|
|
398
|
+
|
|
399
|
+
const icon = getByTestId('icon-image');
|
|
400
|
+
expect(icon).toHaveAttribute('data-tooltip', 'Great job!');
|
|
401
|
+
});
|
|
402
|
+
});
|
|
403
|
+
|
|
404
|
+
describe('icon positioning', () => {
|
|
405
|
+
it('should position icon at center of circle minus offset', () => {
|
|
406
|
+
const { getByTestId } = render(
|
|
407
|
+
<CircleComponent
|
|
408
|
+
{...defaultProps}
|
|
409
|
+
x={100}
|
|
410
|
+
y={100}
|
|
411
|
+
radius={30}
|
|
412
|
+
isEvaluateMode={true}
|
|
413
|
+
selected={true}
|
|
414
|
+
isCorrect={true}
|
|
415
|
+
showCorrectEnabled={false}
|
|
416
|
+
/>
|
|
417
|
+
);
|
|
418
|
+
|
|
419
|
+
const icon = getByTestId('icon-image');
|
|
420
|
+
// Icon should be at x - 10, y - 10
|
|
421
|
+
expect(icon).toHaveAttribute('data-x', '90');
|
|
422
|
+
expect(icon).toHaveAttribute('data-y', '90');
|
|
423
|
+
});
|
|
424
|
+
});
|
|
425
|
+
|
|
426
|
+
describe('edge cases', () => {
|
|
427
|
+
it('should handle very small radius', () => {
|
|
428
|
+
const { getByTestId } = render(
|
|
429
|
+
<CircleComponent
|
|
430
|
+
{...defaultProps}
|
|
431
|
+
radius={5}
|
|
432
|
+
/>
|
|
433
|
+
);
|
|
434
|
+
|
|
435
|
+
const circle = getByTestId('circle');
|
|
436
|
+
expect(circle).toHaveAttribute('radius', '5');
|
|
437
|
+
});
|
|
438
|
+
|
|
439
|
+
it('should handle very large radius', () => {
|
|
440
|
+
const { getByTestId } = render(
|
|
441
|
+
<CircleComponent
|
|
442
|
+
{...defaultProps}
|
|
443
|
+
radius={200}
|
|
444
|
+
/>
|
|
445
|
+
);
|
|
446
|
+
|
|
447
|
+
const circle = getByTestId('circle');
|
|
448
|
+
expect(circle).toHaveAttribute('radius', '200');
|
|
449
|
+
});
|
|
450
|
+
|
|
451
|
+
it('should handle different scale values', () => {
|
|
452
|
+
const { getByTestId } = render(
|
|
453
|
+
<CircleComponent
|
|
454
|
+
{...defaultProps}
|
|
455
|
+
scale={0.5}
|
|
456
|
+
/>
|
|
457
|
+
);
|
|
458
|
+
|
|
459
|
+
const group = getByTestId('group');
|
|
460
|
+
expect(group).toHaveAttribute('scaleX', '0.5');
|
|
461
|
+
expect(group).toHaveAttribute('scaleY', '0.5');
|
|
462
|
+
});
|
|
463
|
+
});
|
|
464
|
+
});
|