@enact/spotlight 3.4.9-experimental-3 → 3.4.9-experimental-7
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/{build/Accelerator → Accelerator}/Accelerator.d.ts +0 -0
- package/Accelerator/Accelerator.js +149 -156
- package/CHANGELOG.md +22 -0
- package/{build/Pause → Pause}/Pause.d.ts +0 -0
- package/Pause/Pause.js +102 -80
- package/Pause/tests/Pause-specs.js +65 -97
- package/SpotlightContainerDecorator/SpotlightContainer.js +175 -140
- package/{build/SpotlightContainerDecorator → SpotlightContainerDecorator}/SpotlightContainerDecorator.d.ts +0 -0
- package/SpotlightContainerDecorator/SpotlightContainerDecorator.js +222 -176
- package/SpotlightContainerDecorator/tests/Element.prototype.closest.js +44 -40
- package/SpotlightContainerDecorator/tests/SpotlightContainerDecorator-specs.js +221 -210
- package/SpotlightContainerDecorator/tests/useSpotlightContainer-specs.js +150 -243
- package/SpotlightContainerDecorator/useSpotlightContainer.js +47 -28
- package/{build/SpotlightRootDecorator → SpotlightRootDecorator}/SpotlightRootDecorator.d.ts +0 -0
- package/SpotlightRootDecorator/SpotlightRootDecorator.js +206 -111
- package/{build/Spottable → Spottable}/Spottable.d.ts +0 -0
- package/Spottable/Spottable.js +448 -410
- package/Spottable/tests/Spottable-specs.js +90 -117
- package/package.json +3 -2
- package/src/container.js +718 -653
- package/src/navigate.js +406 -491
- package/src/pointer.js +86 -78
- package/{build/src → src}/spotlight.d.ts +0 -0
- package/src/spotlight.js +846 -885
- package/src/target.js +448 -474
- package/src/tests/container-specs.js +643 -1251
- package/src/tests/navigate-specs.js +77 -134
- package/src/tests/pointer-specs.js +126 -182
- package/src/tests/spotlight-specs.js +103 -133
- package/src/tests/target-specs.js +597 -960
- package/src/tests/utils.js +89 -67
- package/src/utils.js +155 -158
- package/build/Accelerator/Accelerator.js +0 -162
- package/build/Accelerator/package.json +0 -3
- package/build/CHANGELOG.md +0 -838
- package/build/Pause/Pause.js +0 -164
- package/build/Pause/package.json +0 -3
- package/build/Pause/tests/Pause-specs.js +0 -65
- package/build/README.md +0 -61
- package/build/SpotlightContainerDecorator/SpotlightContainer.js +0 -176
- package/build/SpotlightContainerDecorator/SpotlightContainerDecorator.js +0 -282
- package/build/SpotlightContainerDecorator/package.json +0 -3
- package/build/SpotlightContainerDecorator/tests/Element.prototype.closest.js +0 -45
- package/build/SpotlightContainerDecorator/tests/SpotlightContainerDecorator-specs.js +0 -221
- package/build/SpotlightContainerDecorator/tests/useSpotlightContainer-specs.js +0 -160
- package/build/SpotlightContainerDecorator/useSpotlightContainer.js +0 -133
- package/build/SpotlightRootDecorator/SpotlightRootDecorator.js +0 -189
- package/build/SpotlightRootDecorator/package.json +0 -3
- package/build/Spottable/Spottable.js +0 -491
- package/build/Spottable/package.json +0 -3
- package/build/Spottable/tests/Spottable-specs.js +0 -90
- package/build/package-lock.json +0 -229
- package/build/package.json +0 -28
- package/build/src/container.js +0 -1201
- package/build/src/navigate.js +0 -419
- package/build/src/pointer.js +0 -183
- package/build/src/spotlight.js +0 -896
- package/build/src/target.js +0 -507
- package/build/src/tests/container-specs.js +0 -653
- package/build/src/tests/navigate-specs.js +0 -87
- package/build/src/tests/pointer-specs.js +0 -130
- package/build/src/tests/spotlight-specs.js +0 -112
- package/build/src/tests/target-specs.js +0 -614
- package/build/src/tests/utils.js +0 -104
- package/build/src/utils.js +0 -180
- package/build/styles/debug.less +0 -97
- package/build/styles/mixins.less +0 -63
- package/docs/index.md +0 -364
|
@@ -1,117 +1,90 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
subject.setProps({
|
|
92
|
-
selectionKeys: [2, 1, 3]
|
|
93
|
-
});
|
|
94
|
-
|
|
95
|
-
const expected = 2;
|
|
96
|
-
const actual = spy.mock.calls.length;
|
|
97
|
-
|
|
98
|
-
expect(actual).toEqual(expected);
|
|
99
|
-
});
|
|
100
|
-
|
|
101
|
-
test('should not re-render when focused', () => {
|
|
102
|
-
const spy = jest.fn((props) => <div {...props} />);
|
|
103
|
-
const Component = Spottable(spy);
|
|
104
|
-
|
|
105
|
-
const subject = mount(
|
|
106
|
-
<Component />
|
|
107
|
-
);
|
|
108
|
-
|
|
109
|
-
subject.simulate('focus');
|
|
110
|
-
|
|
111
|
-
const expected = 1;
|
|
112
|
-
const actual = spy.mock.calls.length;
|
|
113
|
-
|
|
114
|
-
expect(actual).toEqual(expected);
|
|
115
|
-
});
|
|
116
|
-
});
|
|
117
|
-
});
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _enzyme = require("enzyme");
|
|
4
|
+
|
|
5
|
+
var _react = _interopRequireDefault(require("react"));
|
|
6
|
+
|
|
7
|
+
var _Spottable = _interopRequireDefault(require("../Spottable"));
|
|
8
|
+
|
|
9
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
10
|
+
|
|
11
|
+
describe('Spottable', function () {
|
|
12
|
+
test('should add the spottable class', function () {
|
|
13
|
+
var Component = (0, _Spottable["default"])('div');
|
|
14
|
+
var subject = (0, _enzyme.mount)( /*#__PURE__*/_react["default"].createElement(Component, null));
|
|
15
|
+
var expected = 'spottable';
|
|
16
|
+
var actual = subject.find('div').prop('className');
|
|
17
|
+
expect(actual).toEqual(expected);
|
|
18
|
+
});
|
|
19
|
+
test('should add the spottable class to a {disabled} component', function () {
|
|
20
|
+
var Component = (0, _Spottable["default"])('div');
|
|
21
|
+
var subject = (0, _enzyme.mount)( /*#__PURE__*/_react["default"].createElement(Component, {
|
|
22
|
+
disabled: true
|
|
23
|
+
}));
|
|
24
|
+
var expected = 'spottable';
|
|
25
|
+
var actual = subject.find('div').prop('className');
|
|
26
|
+
expect(actual).toEqual(expected);
|
|
27
|
+
});
|
|
28
|
+
test('should not add the spottable class to a {spotlightDisabled} component', function () {
|
|
29
|
+
var Component = (0, _Spottable["default"])('div');
|
|
30
|
+
var subject = (0, _enzyme.mount)( /*#__PURE__*/_react["default"].createElement(Component, {
|
|
31
|
+
spotlightDisabled: true
|
|
32
|
+
}));
|
|
33
|
+
var expected = 'spottable';
|
|
34
|
+
var actual = subject.find('div').prop('className');
|
|
35
|
+
expect(actual).not.toEqual(expected);
|
|
36
|
+
});
|
|
37
|
+
test('should emit {onSpotlightDisappear} when unmounted while focused', function () {
|
|
38
|
+
var spy = jest.fn();
|
|
39
|
+
var Component = (0, _Spottable["default"])('div');
|
|
40
|
+
var subject = (0, _enzyme.mount)( /*#__PURE__*/_react["default"].createElement(Component, {
|
|
41
|
+
onSpotlightDisappear: spy
|
|
42
|
+
}));
|
|
43
|
+
subject.simulate('focus');
|
|
44
|
+
subject.unmount();
|
|
45
|
+
var expected = 1;
|
|
46
|
+
var actual = spy.mock.calls.length;
|
|
47
|
+
expect(actual).toEqual(expected);
|
|
48
|
+
});
|
|
49
|
+
describe('shouldComponentUpdate', function () {
|
|
50
|
+
test('should re-render when a non-Spottable prop changes', function () {
|
|
51
|
+
var spy = jest.fn(function (props) {
|
|
52
|
+
return /*#__PURE__*/_react["default"].createElement("div", props);
|
|
53
|
+
});
|
|
54
|
+
var Component = (0, _Spottable["default"])(spy);
|
|
55
|
+
var subject = (0, _enzyme.mount)( /*#__PURE__*/_react["default"].createElement(Component, null));
|
|
56
|
+
subject.setProps({
|
|
57
|
+
'data-id': '123'
|
|
58
|
+
});
|
|
59
|
+
var expected = 2;
|
|
60
|
+
var actual = spy.mock.calls.length;
|
|
61
|
+
expect(actual).toEqual(expected);
|
|
62
|
+
});
|
|
63
|
+
test('should re-render when {selectionKeys} changes', function () {
|
|
64
|
+
var spy = jest.fn(function (props) {
|
|
65
|
+
return /*#__PURE__*/_react["default"].createElement("div", props);
|
|
66
|
+
});
|
|
67
|
+
var Component = (0, _Spottable["default"])(spy);
|
|
68
|
+
var subject = (0, _enzyme.mount)( /*#__PURE__*/_react["default"].createElement(Component, {
|
|
69
|
+
selectionKeys: [1, 2, 3]
|
|
70
|
+
}));
|
|
71
|
+
subject.setProps({
|
|
72
|
+
selectionKeys: [2, 1, 3]
|
|
73
|
+
});
|
|
74
|
+
var expected = 2;
|
|
75
|
+
var actual = spy.mock.calls.length;
|
|
76
|
+
expect(actual).toEqual(expected);
|
|
77
|
+
});
|
|
78
|
+
test('should not re-render when focused', function () {
|
|
79
|
+
var spy = jest.fn(function (props) {
|
|
80
|
+
return /*#__PURE__*/_react["default"].createElement("div", props);
|
|
81
|
+
});
|
|
82
|
+
var Component = (0, _Spottable["default"])(spy);
|
|
83
|
+
var subject = (0, _enzyme.mount)( /*#__PURE__*/_react["default"].createElement(Component, null));
|
|
84
|
+
subject.simulate('focus');
|
|
85
|
+
var expected = 1;
|
|
86
|
+
var actual = spy.mock.calls.length;
|
|
87
|
+
expect(actual).toEqual(expected);
|
|
88
|
+
});
|
|
89
|
+
});
|
|
90
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@enact/spotlight",
|
|
3
|
-
"version": "3.4.9-experimental-
|
|
3
|
+
"version": "3.4.9-experimental-7",
|
|
4
4
|
"description": "A focus management library",
|
|
5
5
|
"main": "src/spotlight.js",
|
|
6
6
|
"scripts": {
|
|
@@ -18,7 +18,8 @@
|
|
|
18
18
|
}
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@enact/core": "^3.4.9-experimental-
|
|
21
|
+
"@enact/core": "^3.4.9-experimental-7",
|
|
22
|
+
"@enact/webos": "^3.4.9-experimental-7",
|
|
22
23
|
"prop-types": "^15.7.2",
|
|
23
24
|
"ramda": "^0.24.1",
|
|
24
25
|
"react": "^16.7.0",
|