@pie-element/hotspot 4.8.4-next.133 → 4.8.4-next.1335

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 (71) hide show
  1. package/CHANGELOG.md +241 -0
  2. package/configure/CHANGELOG.md +214 -0
  3. package/configure/lib/defaults.js +20 -0
  4. package/configure/lib/defaults.js.map +1 -1
  5. package/configure/lib/hotspot-container.js +26 -12
  6. package/configure/lib/hotspot-container.js.map +1 -1
  7. package/configure/lib/hotspot-drawable.js +11 -5
  8. package/configure/lib/hotspot-drawable.js.map +1 -1
  9. package/configure/lib/hotspot-palette.js +1 -1
  10. package/configure/lib/hotspot-palette.js.map +1 -1
  11. package/configure/lib/hotspot-polygon.js +1 -1
  12. package/configure/lib/hotspot-polygon.js.map +1 -1
  13. package/configure/lib/hotspot-rectangle.js +1 -1
  14. package/configure/lib/hotspot-rectangle.js.map +1 -1
  15. package/configure/lib/index.js +17 -3
  16. package/configure/lib/index.js.map +1 -1
  17. package/configure/lib/root.js +107 -13
  18. package/configure/lib/root.js.map +1 -1
  19. package/configure/lib/utils.js +18 -4
  20. package/configure/lib/utils.js.map +1 -1
  21. package/configure/package.json +4 -4
  22. package/configure/src/__tests__/__snapshots__/hotspot-container.test.js.snap +1 -0
  23. package/configure/src/__tests__/__snapshots__/root.test.js.snap +53 -4
  24. package/configure/src/defaults.js +20 -0
  25. package/configure/src/hotspot-container.jsx +16 -5
  26. package/configure/src/hotspot-drawable.jsx +8 -2
  27. package/configure/src/index.js +14 -0
  28. package/configure/src/root.jsx +87 -9
  29. package/configure/src/utils.js +23 -1
  30. package/controller/CHANGELOG.md +28 -0
  31. package/controller/lib/index.js +44 -5
  32. package/controller/lib/index.js.map +1 -1
  33. package/controller/lib/utils.js.map +1 -1
  34. package/controller/package.json +1 -1
  35. package/controller/src/index.js +26 -0
  36. package/docs/config-schema.json +212 -0
  37. package/docs/config-schema.json.md +165 -0
  38. package/docs/demo/generate.js +1 -0
  39. package/docs/pie-schema.json +49 -0
  40. package/docs/pie-schema.json.md +36 -0
  41. package/lib/hotspot/container.js +25 -7
  42. package/lib/hotspot/container.js.map +1 -1
  43. package/lib/hotspot/image.js +1 -1
  44. package/lib/hotspot/image.js.map +1 -1
  45. package/lib/hotspot/index.js +72 -18
  46. package/lib/hotspot/index.js.map +1 -1
  47. package/lib/hotspot/polygon.js +46 -20
  48. package/lib/hotspot/polygon.js.map +1 -1
  49. package/lib/hotspot/rectangle.js +46 -20
  50. package/lib/hotspot/rectangle.js.map +1 -1
  51. package/lib/index.js +4 -1
  52. package/lib/index.js.map +1 -1
  53. package/lib/session-updater.js.map +1 -1
  54. package/package.json +6 -4
  55. package/src/__tests__/__snapshots__/{container-test.jsx.snap → container.test.jsx.snap} +8 -0
  56. package/src/__tests__/__snapshots__/image.test.jsx.snap +43 -0
  57. package/src/__tests__/__snapshots__/{polygon-test.jsx.snap → polygon.test.jsx.snap} +11 -0
  58. package/src/__tests__/__snapshots__/{rectangle-test.jsx.snap → rectangle.test.jsx.snap} +11 -0
  59. package/src/__tests__/{container-test.jsx → container.test.jsx} +57 -0
  60. package/src/__tests__/{image-test.jsx → image.test.jsx} +0 -0
  61. package/src/__tests__/polygon.test.jsx +224 -0
  62. package/src/__tests__/rectangle.test.jsx +233 -0
  63. package/src/__tests__/{session-updater-test.jsx → session-updater.test.jsx} +0 -0
  64. package/src/hotspot/container.jsx +23 -3
  65. package/src/hotspot/index.jsx +68 -8
  66. package/src/hotspot/polygon.jsx +40 -17
  67. package/src/hotspot/rectangle.jsx +40 -17
  68. package/src/index.js +5 -0
  69. package/src/__tests__/__snapshots__/image-test.jsx.snap +0 -21
  70. package/src/__tests__/polygon-test.jsx +0 -77
  71. package/src/__tests__/rectangle-test.jsx +0 -78
@@ -1,77 +0,0 @@
1
- import React from 'react';
2
- import _ from 'lodash';
3
- import { shallow } from 'enzyme';
4
- import toJson from 'enzyme-to-json';
5
- import Konva from 'konva';
6
-
7
- import Polygon from '../hotspot/polygon';
8
-
9
- Konva.isBrowser = false;
10
-
11
- describe('Polygon', () => {
12
- let onClick, wrapper;
13
-
14
- const mkWrapper = (opts = {}) => {
15
- opts = _.extend(
16
- {
17
- classes: {
18
- base: 'base'
19
- },
20
- height: 200,
21
- hotspotColor: 'rgba(137, 183, 244, 0.65)',
22
- id: '1',
23
- isCorrect: false,
24
- isEvaluateMode: false,
25
- evaluateText: null,
26
- disabled: false,
27
- outlineColor: 'blue',
28
- selected: false,
29
- points: [{ x: 94, y: 4 }, { x: 89, y: 4 }, { x: 36, y: 40 }]
30
- },
31
- opts
32
- );
33
-
34
- return shallow(<Polygon {...opts} onClick={onClick} />);
35
- };
36
-
37
- beforeEach(() => {
38
- onClick = jest.fn();
39
- wrapper = mkWrapper();
40
- });
41
-
42
- describe('snapshots', () => {
43
- describe('outline color', () => {
44
- it('renders', () => {
45
- const wrapper = mkWrapper({ outlineColor: 'red' });
46
- expect(toJson(wrapper)).toMatchSnapshot();
47
- });
48
- });
49
-
50
- describe('outline width', () => {
51
- it('renders with default border width', () => {
52
- const wrapper = mkWrapper();
53
- expect(toJson(wrapper)).toMatchSnapshot();
54
- });
55
-
56
- it('renders with given border width', () => {
57
- const wrapper = mkWrapper({ strokeWidth: 10 });
58
- expect(toJson(wrapper)).toMatchSnapshot();
59
- });
60
- });
61
-
62
-
63
- describe('hotspot color', () => {
64
- it('renders', () => {
65
- const wrapper = mkWrapper({ hotspotColor: 'rgba(217, 30, 24, 0.65)' });
66
- expect(toJson(wrapper)).toMatchSnapshot();
67
- });
68
- });
69
-
70
- describe('evaluate with correct answer', () => {
71
- it('renders', () => {
72
- const wrapper = mkWrapper({ isEvaluateMode: true, isCorrect: true, evaluateText: 'Correctly\nselected' });
73
- expect(toJson(wrapper)).toMatchSnapshot();
74
- });
75
- });
76
- });
77
- });
@@ -1,78 +0,0 @@
1
- import React from 'react';
2
- import _ from 'lodash';
3
- import { shallow } from 'enzyme';
4
- import toJson from 'enzyme-to-json';
5
- import Konva from 'konva';
6
-
7
- import Rectangle from '../hotspot/rectangle';
8
-
9
- Konva.isBrowser = false;
10
-
11
- describe('Rectangle', () => {
12
- let onClick, wrapper;
13
-
14
- const mkWrapper = (opts = {}) => {
15
- opts = _.extend(
16
- {
17
- classes: {
18
- base: 'base'
19
- },
20
- height: 200,
21
- hotspotColor: 'rgba(137, 183, 244, 0.65)',
22
- id: '1',
23
- isCorrect: false,
24
- isEvaluateMode: false,
25
- evaluateText: null,
26
- disabled: false,
27
- outlineColor: 'blue',
28
- selected: false,
29
- width: 300,
30
- x: 5,
31
- y: 5
32
- },
33
- opts
34
- );
35
-
36
- return shallow(<Rectangle {...opts} onClick={onClick} />);
37
- };
38
-
39
- beforeEach(() => {
40
- onClick = jest.fn();
41
- wrapper = mkWrapper();
42
- });
43
-
44
- describe('snapshots', () => {
45
- describe('outline color', () => {
46
- it('renders', () => {
47
- const wrapper = mkWrapper({ outlineColor: 'red' });
48
- expect(toJson(wrapper)).toMatchSnapshot();
49
- });
50
- });
51
-
52
- describe('outline width', () => {
53
- it('renders with default border width', () => {
54
- const wrapper = mkWrapper();
55
- expect(toJson(wrapper)).toMatchSnapshot();
56
- });
57
-
58
- it('renders with given border width', () => {
59
- const wrapper = mkWrapper({ strokeWidth: 10 });
60
- expect(toJson(wrapper)).toMatchSnapshot();
61
- });
62
- });
63
-
64
- describe('hotspot color', () => {
65
- it('renders', () => {
66
- const wrapper = mkWrapper({ hotspotColor: 'rgba(217, 30, 24, 0.65)' });
67
- expect(toJson(wrapper)).toMatchSnapshot();
68
- });
69
- });
70
-
71
- describe('evaluate with correct answer', () => {
72
- it('renders', () => {
73
- const wrapper = mkWrapper({ isEvaluateMode: true, isCorrect: true, evaluateText: 'Correctly\nselected' });
74
- expect(toJson(wrapper)).toMatchSnapshot();
75
- });
76
- });
77
- });
78
- });