@pie-element/hotspot 11.1.7 → 11.2.0

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.
@@ -1 +1 @@
1
- {"version":3,"file":"rectangle.js","names":["_react","_interopRequireDefault","require","_propTypes","_reactKonva","_imageKonvaTooltip","_icons","RectComponent","React","Component","constructor","props","_defineProperty2","default","e","onClick","id","selected","disabled","cancelBubble","selector","document","body","style","cursor","setState","hovered","isCorrect","markAsCorrect","outlineColor","showCorrectEnabled","strokeWidth","state","render","height","hotspotColor","hoverOutlineColor","selectedHotspotColor","isEvaluateMode","width","x","y","evaluateText","scale","outlineColorParsed","getEvaluateOutlineColor","outlineWidth","getOutlineWidth","iconX","iconY","iconSrc","faCorrect","faWrong","useHoveredStyle","createElement","Group","scaleX","scaleY","Rect","stroke","listening","fill","handleClick","onTap","draggable","onMouseLeave","handleMouseLeave","onMouseEnter","handleMouseEnter","src","tooltip","propTypes","PropTypes","number","isRequired","string","oneOfType","bool","func","defaultProps","_default","exports"],"sources":["../../src/hotspot/rectangle.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { Rect, Group } from 'react-konva';\nimport ImageComponent from './image-konva-tooltip';\nimport { faCorrect, faWrong } from './icons';\n\nclass RectComponent extends React.Component {\n constructor(props) {\n super(props);\n this.state = {\n hovered: false,\n };\n }\n\n handleClick = (e) => {\n const { onClick, id, selected, disabled } = this.props;\n\n if (!disabled) {\n e.cancelBubble = true;\n onClick({ id, selected: !selected, selector: 'Mouse' });\n }\n };\n\n handleMouseEnter = () => {\n const { disabled } = this.props;\n\n if (!disabled) {\n document.body.style.cursor = 'pointer';\n }\n this.setState({ hovered: true });\n };\n\n handleMouseLeave = () => {\n document.body.style.cursor = 'default';\n this.setState({ hovered: false });\n };\n\n getEvaluateOutlineColor = (isCorrect, markAsCorrect, outlineColor) =>\n markAsCorrect ? 'green' : isCorrect ? outlineColor : 'red';\n\n getOutlineWidth = (showCorrectEnabled, selected, markAsCorrect, strokeWidth) =>\n markAsCorrect || (!markAsCorrect && !showCorrectEnabled && selected) ? strokeWidth : 0;\n\n render() {\n const {\n height,\n hotspotColor,\n hoverOutlineColor,\n selectedHotspotColor,\n isCorrect,\n isEvaluateMode,\n outlineColor,\n selected,\n width,\n x,\n y,\n evaluateText,\n strokeWidth,\n scale,\n markAsCorrect,\n showCorrectEnabled,\n } = this.props;\n\n const outlineColorParsed = isEvaluateMode\n ? this.getEvaluateOutlineColor(isCorrect, markAsCorrect, outlineColor)\n : outlineColor;\n\n const outlineWidth = this.getOutlineWidth(showCorrectEnabled, selected, markAsCorrect, strokeWidth);\n\n const iconX = x + width / 2 - 10;\n const iconY = y + height / 2 - 10;\n\n // \"Show Correct Answer\" Enabled:\n // - Correctly Selected: white checkmark in green circle\n // - Correctly Not Selected: none\n // - Incorrectly Selected: none\n // - Incorrectly Not Selected: white checkmark in green circle\n // \"Show Correct Answer\" Disabled:\n // - Correctly Selected:\n // - white checkmark in green circle\n // - heavy outline, as on “Gather”\n // - Correctly Not Selected: none\n // - Incorrectly Selected:\n // - white \"X\" in red circle\n // - heavy outline around the selection should appear in red\n // - Incorrectly Not Selected: white \"X\" in red circle\n let iconSrc;\n\n if (showCorrectEnabled) {\n if ((selected && isCorrect) || (!selected && !isCorrect)) {\n iconSrc = faCorrect;\n }\n } else {\n if (selected) {\n if (isCorrect) {\n iconSrc = faCorrect;\n } else {\n iconSrc = faWrong;\n }\n } else if (!isCorrect) {\n iconSrc = faWrong;\n }\n }\n\n const { hovered } = this.state;\n const useHoveredStyle = hovered && hoverOutlineColor;\n\n return (\n <Group scaleX={scale} scaleY={scale}>\n {useHoveredStyle && (\n <Rect\n x={x}\n y={y}\n width={width}\n height={height}\n stroke={selected ? 'transparent' : hoverOutlineColor}\n strokeWidth={strokeWidth}\n listening={false}\n />\n )}\n <Rect\n x={x}\n y={y}\n width={width}\n height={height}\n fill={selected && selectedHotspotColor ? selectedHotspotColor : hotspotColor}\n onClick={this.handleClick}\n onTap={this.handleClick}\n draggable={false}\n stroke={useHoveredStyle && !selected ? 'transparent' : outlineColorParsed}\n strokeWidth={useHoveredStyle && !selected ? 0 : outlineWidth}\n onMouseLeave={this.handleMouseLeave}\n onMouseEnter={this.handleMouseEnter}\n cursor=\"pointer\"\n />\n {isEvaluateMode && iconSrc ? <ImageComponent src={iconSrc} x={iconX} y={iconY} tooltip={evaluateText} /> : null}\n </Group>\n );\n }\n}\n\nRectComponent.propTypes = {\n height: PropTypes.number.isRequired,\n hotspotColor: PropTypes.string.isRequired,\n id: PropTypes.string.isRequired,\n isCorrect: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]),\n isEvaluateMode: PropTypes.bool.isRequired,\n hoverOutlineColor: PropTypes.string,\n disabled: PropTypes.bool.isRequired,\n onClick: PropTypes.func.isRequired,\n outlineColor: PropTypes.string.isRequired,\n selected: PropTypes.bool.isRequired,\n width: PropTypes.number.isRequired,\n x: PropTypes.number.isRequired,\n y: PropTypes.number.isRequired,\n evaluateText: PropTypes.string,\n strokeWidth: PropTypes.number,\n scale: PropTypes.number,\n selectedHotspotColor: PropTypes.string,\n markAsCorrect: PropTypes.bool.isRequired,\n showCorrectEnabled: PropTypes.bool.isRequired,\n};\n\nRectComponent.defaultProps = {\n isCorrect: false,\n evaluateText: null,\n strokeWidth: 5,\n scale: 1,\n};\n\nexport default RectComponent;\n"],"mappings":";;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,kBAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AAEA,MAAMK,aAAa,SAASC,cAAK,CAACC,SAAS,CAAC;EAC1CC,WAAWA,CAACC,KAAK,EAAE;IACjB,KAAK,CAACA,KAAK,CAAC;IAAC,IAAAC,gBAAA,CAAAC,OAAA,uB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AC,IAAAqC,QAAA,GAAAC,OAAA,CAAApE,OAAA,GAEaN,aAAa","ignoreList":[]}
1
+ {"version":3,"file":"rectangle.js","names":["_react","_interopRequireDefault","require","_propTypes","_reactKonva","_imageKonvaTooltip","_icons","RectComponent","React","Component","constructor","props","_defineProperty2","default","e","onClick","id","selected","disabled","cancelBubble","selector","document","body","style","cursor","setState","hovered","isCorrect","markAsCorrect","outlineColor","showCorrectEnabled","strokeWidth","state","render","height","hotspotColor","hoverOutlineColor","selectedHotspotColor","isEvaluateMode","focused","width","x","y","evaluateText","scale","outlineColorParsed","getEvaluateOutlineColor","outlineWidth","getOutlineWidth","iconX","iconY","iconSrc","faCorrect","faWrong","useHoveredStyle","createElement","Group","scaleX","scaleY","onMouseLeave","handleMouseLeave","onMouseEnter","handleMouseEnter","Rect","fill","handleClick","onTap","draggable","stroke","listening","src","tooltip","propTypes","PropTypes","number","isRequired","string","oneOfType","bool","func","defaultProps","_default","exports"],"sources":["../../src/hotspot/rectangle.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { Rect, Group } from 'react-konva';\nimport ImageComponent from './image-konva-tooltip';\nimport { faCorrect, faWrong } from './icons';\n\nclass RectComponent extends React.Component {\n constructor(props) {\n super(props);\n this.state = {\n hovered: false,\n };\n }\n\n handleClick = (e) => {\n const { onClick, id, selected, disabled } = this.props;\n\n if (!disabled) {\n e.cancelBubble = true;\n onClick({ id, selected: !selected, selector: 'Mouse' });\n }\n };\n\n handleMouseEnter = () => {\n const { disabled } = this.props;\n\n if (!disabled) {\n document.body.style.cursor = 'pointer';\n }\n this.setState({ hovered: true });\n };\n\n handleMouseLeave = () => {\n document.body.style.cursor = 'default';\n this.setState({ hovered: false });\n };\n\n getEvaluateOutlineColor = (isCorrect, markAsCorrect, outlineColor) =>\n markAsCorrect ? 'green' : isCorrect ? outlineColor : 'red';\n\n getOutlineWidth = (showCorrectEnabled, selected, markAsCorrect, strokeWidth) =>\n markAsCorrect || (!markAsCorrect && !showCorrectEnabled && selected) ? strokeWidth : 0;\n\n render() {\n const {\n height,\n hotspotColor,\n hoverOutlineColor,\n selectedHotspotColor,\n isCorrect,\n isEvaluateMode,\n outlineColor,\n selected,\n focused,\n width,\n x,\n y,\n evaluateText,\n strokeWidth,\n scale,\n markAsCorrect,\n showCorrectEnabled,\n } = this.props;\n const { hovered } = this.state;\n\n const outlineColorParsed = isEvaluateMode\n ? this.getEvaluateOutlineColor(isCorrect, markAsCorrect, outlineColor)\n : outlineColor;\n\n const outlineWidth = this.getOutlineWidth(showCorrectEnabled, selected, markAsCorrect, strokeWidth);\n\n const iconX = x + width / 2 - 10;\n const iconY = y + height / 2 - 10;\n\n // \"Show Correct Answer\" Enabled:\n // - Correctly Selected: white checkmark in green circle\n // - Correctly Not Selected: none\n // - Incorrectly Selected: none\n // - Incorrectly Not Selected: white checkmark in green circle\n // \"Show Correct Answer\" Disabled:\n // - Correctly Selected:\n // - white checkmark in green circle\n // - heavy outline, as on “Gather”\n // - Correctly Not Selected: none\n // - Incorrectly Selected:\n // - white \"X\" in red circle\n // - heavy outline around the selection should appear in red\n // - Incorrectly Not Selected: white \"X\" in red circle\n let iconSrc;\n\n if (showCorrectEnabled) {\n if ((selected && isCorrect) || (!selected && !isCorrect)) {\n iconSrc = faCorrect;\n }\n } else {\n if (selected) {\n if (isCorrect) {\n iconSrc = faCorrect;\n } else {\n iconSrc = faWrong;\n }\n } else if (!isCorrect) {\n iconSrc = faWrong;\n }\n }\n\n const useHoveredStyle = (hovered || focused) && hoverOutlineColor;\n\n return (\n <Group scaleX={scale} scaleY={scale} onMouseLeave={this.handleMouseLeave} onMouseEnter={this.handleMouseEnter}>\n <Rect\n x={x}\n y={y}\n width={width}\n height={height}\n fill={selected && selectedHotspotColor ? selectedHotspotColor : hotspotColor}\n onClick={this.handleClick}\n onTap={this.handleClick}\n draggable={false}\n stroke={useHoveredStyle && !selected ? 'transparent' : outlineColorParsed}\n strokeWidth={useHoveredStyle && !selected ? 0 : outlineWidth}\n cursor=\"pointer\"\n />\n {useHoveredStyle && (\n <Rect\n x={x}\n y={y}\n width={width}\n height={height}\n stroke={hoverOutlineColor}\n strokeWidth={strokeWidth}\n listening={false}\n />\n )}\n {isEvaluateMode && iconSrc ? <ImageComponent src={iconSrc} x={iconX} y={iconY} tooltip={evaluateText} /> : null}\n </Group>\n );\n }\n}\n\nRectComponent.propTypes = {\n height: PropTypes.number.isRequired,\n hotspotColor: PropTypes.string.isRequired,\n id: PropTypes.string.isRequired,\n isCorrect: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]),\n isEvaluateMode: PropTypes.bool.isRequired,\n hoverOutlineColor: PropTypes.string,\n disabled: PropTypes.bool.isRequired,\n focused: PropTypes.bool,\n onClick: PropTypes.func.isRequired,\n outlineColor: PropTypes.string.isRequired,\n selected: PropTypes.bool.isRequired,\n width: PropTypes.number.isRequired,\n x: PropTypes.number.isRequired,\n y: PropTypes.number.isRequired,\n evaluateText: PropTypes.string,\n strokeWidth: PropTypes.number,\n scale: PropTypes.number,\n selectedHotspotColor: PropTypes.string,\n markAsCorrect: PropTypes.bool.isRequired,\n showCorrectEnabled: PropTypes.bool.isRequired,\n};\n\nRectComponent.defaultProps = {\n isCorrect: false,\n evaluateText: null,\n focused: false,\n strokeWidth: 5,\n scale: 1,\n};\n\nexport default RectComponent;\n"],"mappings":";;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,kBAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AAEA,MAAMK,aAAa,SAASC,cAAK,CAACC,SAAS,CAAC;EAC1CC,WAAWA,CAACC,KAAK,EAAE;IACjB,KAAK,CAACA,KAAK,CAAC;IAAC,IAAAC,gBAAA,CAAAC,OAAA,uBAMAC,CAAC,IAAK;MACnB,MAAM;QAA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AAC;EACda,KAAK,EAAE;AACT,CAAC;AAAC,IAAAqC,QAAA,GAAAC,OAAA,CAAArE,OAAA,GAEaN,aAAa","ignoreList":[]}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pie-element/hotspot",
3
3
  "repository": "pie-framework/pie-elements",
4
- "version": "11.1.7",
4
+ "version": "11.2.0",
5
5
  "description": "",
6
6
  "publishConfig": {
7
7
  "access": "public"
@@ -24,7 +24,7 @@
24
24
  },
25
25
  "author": "pie framework developers",
26
26
  "license": "ISC",
27
- "gitHead": "15b95b0767ae81eec579967743dbc954450acf7a",
27
+ "gitHead": "2b221481f30b228062d17fd0c2d41a402a9ded26",
28
28
  "scripts": {
29
29
  "postpublish": "../../scripts/postpublish"
30
30
  },
@@ -70,7 +70,7 @@ describe('CircleComponent', () => {
70
70
  it('should render with correct position and radius', () => {
71
71
  const { getByTestId } = render(<CircleComponent {...defaultProps} />);
72
72
  const circle = getByTestId('circle');
73
-
73
+
74
74
  expect(circle).toHaveAttribute('x', '50');
75
75
  expect(circle).toHaveAttribute('y', '50');
76
76
  expect(circle).toHaveAttribute('radius', '30');
@@ -79,21 +79,21 @@ describe('CircleComponent', () => {
79
79
  it('should render with hotspot color when not selected', () => {
80
80
  const { getByTestId } = render(<CircleComponent {...defaultProps} />);
81
81
  const circle = getByTestId('circle');
82
-
82
+
83
83
  expect(circle).toHaveAttribute('fill', '#FF0000');
84
84
  });
85
85
 
86
86
  it('should render with selected color when selected', () => {
87
87
  const { getByTestId } = render(<CircleComponent {...defaultProps} selected={true} />);
88
88
  const circle = getByTestId('circle');
89
-
89
+
90
90
  expect(circle).toHaveAttribute('fill', '#00FF00');
91
91
  });
92
92
 
93
93
  it('should apply scale transform', () => {
94
94
  const { getByTestId } = render(<CircleComponent {...defaultProps} scale={2.0} />);
95
95
  const group = getByTestId('group');
96
-
96
+
97
97
  expect(group).toHaveAttribute('scaleX', '2');
98
98
  expect(group).toHaveAttribute('scaleY', '2');
99
99
  });
@@ -101,7 +101,7 @@ describe('CircleComponent', () => {
101
101
  it('should render with default scale of 1', () => {
102
102
  const { getByTestId } = render(<CircleComponent {...defaultProps} />);
103
103
  const group = getByTestId('group');
104
-
104
+
105
105
  expect(group).toHaveAttribute('scaleX', '1');
106
106
  expect(group).toHaveAttribute('scaleY', '1');
107
107
  });
@@ -112,9 +112,9 @@ describe('CircleComponent', () => {
112
112
  const onClick = jest.fn();
113
113
  const { getByTestId } = render(<CircleComponent {...defaultProps} onClick={onClick} />);
114
114
  const circle = getByTestId('circle');
115
-
115
+
116
116
  fireEvent.click(circle);
117
-
117
+
118
118
  expect(onClick).toHaveBeenCalledWith({
119
119
  id: 'circle1',
120
120
  selected: true,
@@ -126,20 +126,20 @@ describe('CircleComponent', () => {
126
126
  const onClick = jest.fn();
127
127
  const { getByTestId, rerender } = render(<CircleComponent {...defaultProps} onClick={onClick} selected={false} />);
128
128
  const circle = getByTestId('circle');
129
-
129
+
130
130
  fireEvent.click(circle);
131
-
131
+
132
132
  expect(onClick).toHaveBeenCalledWith({
133
133
  id: 'circle1',
134
134
  selected: true,
135
135
  selector: 'Mouse',
136
136
  });
137
-
137
+
138
138
  rerender(<CircleComponent {...defaultProps} onClick={onClick} selected={true} />);
139
-
139
+
140
140
  const circleAfter = getByTestId('circle');
141
141
  fireEvent.click(circleAfter);
142
-
142
+
143
143
  expect(onClick).toHaveBeenCalledWith({
144
144
  id: 'circle1',
145
145
  selected: false,
@@ -151,37 +151,37 @@ describe('CircleComponent', () => {
151
151
  const onClick = jest.fn();
152
152
  const { getByTestId } = render(<CircleComponent {...defaultProps} onClick={onClick} disabled={true} />);
153
153
  const circle = getByTestId('circle');
154
-
154
+
155
155
  fireEvent.click(circle);
156
-
156
+
157
157
  expect(onClick).not.toHaveBeenCalled();
158
158
  });
159
159
 
160
160
  it('should change cursor to pointer on mouse enter when not disabled', () => {
161
161
  const { getByTestId } = render(<CircleComponent {...defaultProps} />);
162
162
  const circle = getByTestId('circle');
163
-
163
+
164
164
  fireEvent.mouseEnter(circle);
165
-
165
+
166
166
  expect(document.body.style.cursor).toBe('pointer');
167
167
  });
168
168
 
169
169
  it('should not change cursor when disabled', () => {
170
170
  const { getByTestId } = render(<CircleComponent {...defaultProps} disabled={true} />);
171
171
  const circle = getByTestId('circle');
172
-
172
+
173
173
  fireEvent.mouseEnter(circle);
174
-
174
+
175
175
  expect(document.body.style.cursor).toBe('default');
176
176
  });
177
177
 
178
178
  it('should reset cursor to default on mouse leave', () => {
179
179
  const { getByTestId } = render(<CircleComponent {...defaultProps} />);
180
180
  const circle = getByTestId('circle');
181
-
181
+
182
182
  fireEvent.mouseEnter(circle);
183
183
  fireEvent.mouseLeave(circle);
184
-
184
+
185
185
  expect(document.body.style.cursor).toBe('default');
186
186
  });
187
187
  });
@@ -190,9 +190,9 @@ describe('CircleComponent', () => {
190
190
  it('should show hover rect when hoverOutlineColor is provided', () => {
191
191
  const { container, getByTestId } = render(<CircleComponent {...defaultProps} hoverOutlineColor="#FFFF00" />);
192
192
  const circle = getByTestId('circle');
193
-
193
+
194
194
  fireEvent.mouseEnter(circle);
195
-
195
+
196
196
  const rects = container.querySelectorAll('[data-testid="rect"]');
197
197
  expect(rects.length).toBeGreaterThan(0);
198
198
  });
@@ -208,9 +208,9 @@ describe('CircleComponent', () => {
208
208
  />
209
209
  );
210
210
  const circle = getByTestId('circle');
211
-
211
+
212
212
  fireEvent.mouseEnter(circle);
213
-
213
+
214
214
  const rect = container.querySelector('[data-testid="rect"]');
215
215
  if (rect) {
216
216
  // Rect should be positioned at (x - radius, y - radius) with width/height = radius * 2
@@ -226,12 +226,12 @@ describe('CircleComponent', () => {
226
226
  <CircleComponent {...defaultProps} selected={true} hoverOutlineColor="#FFFF00" />
227
227
  );
228
228
  const circle = getByTestId('circle');
229
-
229
+
230
230
  fireEvent.mouseEnter(circle);
231
-
231
+
232
232
  const rect = container.querySelector('[data-testid="rect"]');
233
233
  if (rect) {
234
- expect(rect).toHaveAttribute('stroke', 'transparent');
234
+ expect(rect).toHaveAttribute('stroke', '#FFFF00');
235
235
  }
236
236
  });
237
237
  });
@@ -247,7 +247,7 @@ describe('CircleComponent', () => {
247
247
  showCorrectEnabled={false}
248
248
  />
249
249
  );
250
-
250
+
251
251
  const icon = getByTestId('icon-image');
252
252
  expect(icon).toBeInTheDocument();
253
253
  });
@@ -262,7 +262,7 @@ describe('CircleComponent', () => {
262
262
  showCorrectEnabled={false}
263
263
  />
264
264
  );
265
-
265
+
266
266
  const icon = getByTestId('icon-image');
267
267
  expect(icon).toBeInTheDocument();
268
268
  });
@@ -277,7 +277,7 @@ describe('CircleComponent', () => {
277
277
  showCorrectEnabled={false}
278
278
  />
279
279
  );
280
-
280
+
281
281
  const icon = getByTestId('icon-image');
282
282
  expect(icon).toBeInTheDocument();
283
283
  });
@@ -292,7 +292,7 @@ describe('CircleComponent', () => {
292
292
  showCorrectEnabled={false}
293
293
  />
294
294
  );
295
-
295
+
296
296
  const icon = queryByTestId('icon-image');
297
297
  expect(icon).not.toBeInTheDocument();
298
298
  });
@@ -307,7 +307,7 @@ describe('CircleComponent', () => {
307
307
  showCorrectEnabled={true}
308
308
  />
309
309
  );
310
-
310
+
311
311
  const icon = getByTestId('icon-image');
312
312
  expect(icon).toBeInTheDocument();
313
313
  });
@@ -322,7 +322,7 @@ describe('CircleComponent', () => {
322
322
  showCorrectEnabled={true}
323
323
  />
324
324
  );
325
-
325
+
326
326
  const icon = getByTestId('icon-image');
327
327
  expect(icon).toBeInTheDocument();
328
328
  });
@@ -337,7 +337,7 @@ describe('CircleComponent', () => {
337
337
  showCorrectEnabled={true}
338
338
  />
339
339
  );
340
-
340
+
341
341
  const icon = queryByTestId('icon-image');
342
342
  expect(icon).not.toBeInTheDocument();
343
343
  });
@@ -352,7 +352,7 @@ describe('CircleComponent', () => {
352
352
  showCorrectEnabled={true}
353
353
  />
354
354
  );
355
-
355
+
356
356
  const icon = queryByTestId('icon-image');
357
357
  expect(icon).not.toBeInTheDocument();
358
358
  });
@@ -365,7 +365,7 @@ describe('CircleComponent', () => {
365
365
  markAsCorrect={true}
366
366
  />
367
367
  );
368
-
368
+
369
369
  const circle = getByTestId('circle');
370
370
  expect(circle).toHaveAttribute('stroke', 'green');
371
371
  });
@@ -379,7 +379,7 @@ describe('CircleComponent', () => {
379
379
  markAsCorrect={false}
380
380
  />
381
381
  );
382
-
382
+
383
383
  const circle = getByTestId('circle');
384
384
  expect(circle).toHaveAttribute('stroke', 'red');
385
385
  });
@@ -395,7 +395,7 @@ describe('CircleComponent', () => {
395
395
  showCorrectEnabled={false}
396
396
  />
397
397
  );
398
-
398
+
399
399
  const icon = getByTestId('icon-image');
400
400
  expect(icon).toHaveAttribute('data-tooltip', 'Great job!');
401
401
  });
@@ -415,7 +415,7 @@ describe('CircleComponent', () => {
415
415
  showCorrectEnabled={false}
416
416
  />
417
417
  );
418
-
418
+
419
419
  const icon = getByTestId('icon-image');
420
420
  // Icon should be at x - 10, y - 10
421
421
  expect(icon).toHaveAttribute('data-x', '90');
@@ -431,7 +431,7 @@ describe('CircleComponent', () => {
431
431
  radius={5}
432
432
  />
433
433
  );
434
-
434
+
435
435
  const circle = getByTestId('circle');
436
436
  expect(circle).toHaveAttribute('radius', '5');
437
437
  });
@@ -443,7 +443,7 @@ describe('CircleComponent', () => {
443
443
  radius={200}
444
444
  />
445
445
  );
446
-
446
+
447
447
  const circle = getByTestId('circle');
448
448
  expect(circle).toHaveAttribute('radius', '200');
449
449
  });
@@ -455,7 +455,7 @@ describe('CircleComponent', () => {
455
455
  scale={0.5}
456
456
  />
457
457
  );
458
-
458
+
459
459
  const group = getByTestId('group');
460
460
  expect(group).toHaveAttribute('scaleX', '0.5');
461
461
  expect(group).toHaveAttribute('scaleY', '0.5');
@@ -71,7 +71,7 @@ describe('RectComponent', () => {
71
71
  const { container } = render(<RectComponent {...defaultProps} />);
72
72
  const rects = container.querySelectorAll('[data-testid="rect"]');
73
73
  const mainRect = rects[rects.length - 1];
74
-
74
+
75
75
  expect(mainRect).toHaveAttribute('x', '10');
76
76
  expect(mainRect).toHaveAttribute('y', '20');
77
77
  expect(mainRect).toHaveAttribute('width', '100');
@@ -82,7 +82,7 @@ describe('RectComponent', () => {
82
82
  const { container } = render(<RectComponent {...defaultProps} />);
83
83
  const rects = container.querySelectorAll('[data-testid="rect"]');
84
84
  const mainRect = rects[rects.length - 1];
85
-
85
+
86
86
  expect(mainRect).toHaveAttribute('fill', '#FF0000');
87
87
  });
88
88
 
@@ -90,14 +90,14 @@ describe('RectComponent', () => {
90
90
  const { container } = render(<RectComponent {...defaultProps} selected={true} />);
91
91
  const rects = container.querySelectorAll('[data-testid="rect"]');
92
92
  const mainRect = rects[rects.length - 1];
93
-
93
+
94
94
  expect(mainRect).toHaveAttribute('fill', '#00FF00');
95
95
  });
96
96
 
97
97
  it('should apply scale transform', () => {
98
98
  const { getByTestId } = render(<RectComponent {...defaultProps} scale={1.5} />);
99
99
  const group = getByTestId('group');
100
-
100
+
101
101
  expect(group).toHaveAttribute('scaleX', '1.5');
102
102
  expect(group).toHaveAttribute('scaleY', '1.5');
103
103
  });
@@ -105,7 +105,7 @@ describe('RectComponent', () => {
105
105
  it('should render with default scale of 1', () => {
106
106
  const { getByTestId } = render(<RectComponent {...defaultProps} />);
107
107
  const group = getByTestId('group');
108
-
108
+
109
109
  expect(group).toHaveAttribute('scaleX', '1');
110
110
  expect(group).toHaveAttribute('scaleY', '1');
111
111
  });
@@ -117,9 +117,9 @@ describe('RectComponent', () => {
117
117
  const { container } = render(<RectComponent {...defaultProps} onClick={onClick} />);
118
118
  const rects = container.querySelectorAll('[data-testid="rect"]');
119
119
  const mainRect = rects[rects.length - 1];
120
-
120
+
121
121
  fireEvent.click(mainRect);
122
-
122
+
123
123
  expect(onClick).toHaveBeenCalledWith({
124
124
  id: 'rect1',
125
125
  selected: true,
@@ -132,21 +132,21 @@ describe('RectComponent', () => {
132
132
  const { container, rerender } = render(<RectComponent {...defaultProps} onClick={onClick} selected={false} />);
133
133
  const rects = container.querySelectorAll('[data-testid="rect"]');
134
134
  const mainRect = rects[rects.length - 1];
135
-
135
+
136
136
  fireEvent.click(mainRect);
137
-
137
+
138
138
  expect(onClick).toHaveBeenCalledWith({
139
139
  id: 'rect1',
140
140
  selected: true,
141
141
  selector: 'Mouse',
142
142
  });
143
-
143
+
144
144
  rerender(<RectComponent {...defaultProps} onClick={onClick} selected={true} />);
145
-
145
+
146
146
  const rectsAfter = container.querySelectorAll('[data-testid="rect"]');
147
147
  const mainRectAfter = rectsAfter[rectsAfter.length - 1];
148
148
  fireEvent.click(mainRectAfter);
149
-
149
+
150
150
  expect(onClick).toHaveBeenCalledWith({
151
151
  id: 'rect1',
152
152
  selected: false,
@@ -159,9 +159,9 @@ describe('RectComponent', () => {
159
159
  const { container } = render(<RectComponent {...defaultProps} onClick={onClick} disabled={true} />);
160
160
  const rects = container.querySelectorAll('[data-testid="rect"]');
161
161
  const mainRect = rects[rects.length - 1];
162
-
162
+
163
163
  fireEvent.click(mainRect);
164
-
164
+
165
165
  expect(onClick).not.toHaveBeenCalled();
166
166
  });
167
167
 
@@ -169,9 +169,9 @@ describe('RectComponent', () => {
169
169
  const { container } = render(<RectComponent {...defaultProps} />);
170
170
  const rects = container.querySelectorAll('[data-testid="rect"]');
171
171
  const mainRect = rects[rects.length - 1];
172
-
172
+
173
173
  fireEvent.mouseEnter(mainRect);
174
-
174
+
175
175
  expect(document.body.style.cursor).toBe('pointer');
176
176
  });
177
177
 
@@ -179,9 +179,9 @@ describe('RectComponent', () => {
179
179
  const { container } = render(<RectComponent {...defaultProps} disabled={true} />);
180
180
  const rects = container.querySelectorAll('[data-testid="rect"]');
181
181
  const mainRect = rects[rects.length - 1];
182
-
182
+
183
183
  fireEvent.mouseEnter(mainRect);
184
-
184
+
185
185
  expect(document.body.style.cursor).toBe('default');
186
186
  });
187
187
 
@@ -189,10 +189,10 @@ describe('RectComponent', () => {
189
189
  const { container } = render(<RectComponent {...defaultProps} />);
190
190
  const rects = container.querySelectorAll('[data-testid="rect"]');
191
191
  const mainRect = rects[rects.length - 1];
192
-
192
+
193
193
  fireEvent.mouseEnter(mainRect);
194
194
  fireEvent.mouseLeave(mainRect);
195
-
195
+
196
196
  expect(document.body.style.cursor).toBe('default');
197
197
  });
198
198
  });
@@ -202,9 +202,9 @@ describe('RectComponent', () => {
202
202
  const { container } = render(<RectComponent {...defaultProps} hoverOutlineColor="#FFFF00" />);
203
203
  const rects = container.querySelectorAll('[data-testid="rect"]');
204
204
  const mainRect = rects[rects.length - 1];
205
-
205
+
206
206
  fireEvent.mouseEnter(mainRect);
207
-
207
+
208
208
  const rectsAfterHover = container.querySelectorAll('[data-testid="rect"]');
209
209
  expect(rectsAfterHover.length).toBeGreaterThan(1);
210
210
  });
@@ -215,12 +215,12 @@ describe('RectComponent', () => {
215
215
  );
216
216
  const rects = container.querySelectorAll('[data-testid="rect"]');
217
217
  const mainRect = rects[rects.length - 1];
218
-
218
+
219
219
  fireEvent.mouseEnter(mainRect);
220
-
220
+
221
221
  const hoverRect = container.querySelector('[stroke="#FFFF00"]');
222
222
  if (hoverRect) {
223
- expect(hoverRect).toHaveAttribute('stroke', 'transparent');
223
+ expect(hoverRect).toHaveAttribute('stroke', '#FFFF00');
224
224
  }
225
225
  });
226
226
  });
@@ -236,7 +236,7 @@ describe('RectComponent', () => {
236
236
  showCorrectEnabled={false}
237
237
  />
238
238
  );
239
-
239
+
240
240
  const icon = getByTestId('icon-image');
241
241
  expect(icon).toBeInTheDocument();
242
242
  expect(icon).toHaveAttribute('data-src');
@@ -252,7 +252,7 @@ describe('RectComponent', () => {
252
252
  showCorrectEnabled={false}
253
253
  />
254
254
  );
255
-
255
+
256
256
  const icon = getByTestId('icon-image');
257
257
  expect(icon).toBeInTheDocument();
258
258
  });
@@ -267,7 +267,7 @@ describe('RectComponent', () => {
267
267
  showCorrectEnabled={false}
268
268
  />
269
269
  );
270
-
270
+
271
271
  const icon = getByTestId('icon-image');
272
272
  expect(icon).toBeInTheDocument();
273
273
  });
@@ -282,7 +282,7 @@ describe('RectComponent', () => {
282
282
  showCorrectEnabled={false}
283
283
  />
284
284
  );
285
-
285
+
286
286
  const icon = queryByTestId('icon-image');
287
287
  expect(icon).not.toBeInTheDocument();
288
288
  });
@@ -297,7 +297,7 @@ describe('RectComponent', () => {
297
297
  showCorrectEnabled={true}
298
298
  />
299
299
  );
300
-
300
+
301
301
  const icon = getByTestId('icon-image');
302
302
  expect(icon).toBeInTheDocument();
303
303
  });
@@ -312,7 +312,7 @@ describe('RectComponent', () => {
312
312
  showCorrectEnabled={true}
313
313
  />
314
314
  );
315
-
315
+
316
316
  const icon = getByTestId('icon-image');
317
317
  expect(icon).toBeInTheDocument();
318
318
  });
@@ -327,7 +327,7 @@ describe('RectComponent', () => {
327
327
  showCorrectEnabled={true}
328
328
  />
329
329
  );
330
-
330
+
331
331
  const icon = queryByTestId('icon-image');
332
332
  expect(icon).not.toBeInTheDocument();
333
333
  });
@@ -342,7 +342,7 @@ describe('RectComponent', () => {
342
342
  showCorrectEnabled={true}
343
343
  />
344
344
  );
345
-
345
+
346
346
  const icon = queryByTestId('icon-image');
347
347
  expect(icon).not.toBeInTheDocument();
348
348
  });
@@ -355,7 +355,7 @@ describe('RectComponent', () => {
355
355
  markAsCorrect={true}
356
356
  />
357
357
  );
358
-
358
+
359
359
  const rects = container.querySelectorAll('[data-testid="rect"]');
360
360
  const mainRect = rects[rects.length - 1];
361
361
  expect(mainRect).toHaveAttribute('stroke', 'green');
@@ -370,7 +370,7 @@ describe('RectComponent', () => {
370
370
  markAsCorrect={false}
371
371
  />
372
372
  );
373
-
373
+
374
374
  const rects = container.querySelectorAll('[data-testid="rect"]');
375
375
  const mainRect = rects[rects.length - 1];
376
376
  expect(mainRect).toHaveAttribute('stroke', 'red');
@@ -387,7 +387,7 @@ describe('RectComponent', () => {
387
387
  showCorrectEnabled={false}
388
388
  />
389
389
  );
390
-
390
+
391
391
  const icon = getByTestId('icon-image');
392
392
  expect(icon).toHaveAttribute('data-tooltip', 'Correct answer!');
393
393
  });
@@ -408,7 +408,7 @@ describe('RectComponent', () => {
408
408
  showCorrectEnabled={false}
409
409
  />
410
410
  );
411
-
411
+
412
412
  const icon = getByTestId('icon-image');
413
413
  // Icon should be centered: x + width/2 - 10, y + height/2 - 10
414
414
  expect(icon).toHaveAttribute('data-x', '50'); // 10 + 100/2 - 10