@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.
Files changed (68) hide show
  1. package/{build/Accelerator → Accelerator}/Accelerator.d.ts +0 -0
  2. package/Accelerator/Accelerator.js +149 -156
  3. package/CHANGELOG.md +22 -0
  4. package/{build/Pause → Pause}/Pause.d.ts +0 -0
  5. package/Pause/Pause.js +102 -80
  6. package/Pause/tests/Pause-specs.js +65 -97
  7. package/SpotlightContainerDecorator/SpotlightContainer.js +175 -140
  8. package/{build/SpotlightContainerDecorator → SpotlightContainerDecorator}/SpotlightContainerDecorator.d.ts +0 -0
  9. package/SpotlightContainerDecorator/SpotlightContainerDecorator.js +222 -176
  10. package/SpotlightContainerDecorator/tests/Element.prototype.closest.js +44 -40
  11. package/SpotlightContainerDecorator/tests/SpotlightContainerDecorator-specs.js +221 -210
  12. package/SpotlightContainerDecorator/tests/useSpotlightContainer-specs.js +150 -243
  13. package/SpotlightContainerDecorator/useSpotlightContainer.js +47 -28
  14. package/{build/SpotlightRootDecorator → SpotlightRootDecorator}/SpotlightRootDecorator.d.ts +0 -0
  15. package/SpotlightRootDecorator/SpotlightRootDecorator.js +206 -111
  16. package/{build/Spottable → Spottable}/Spottable.d.ts +0 -0
  17. package/Spottable/Spottable.js +448 -410
  18. package/Spottable/tests/Spottable-specs.js +90 -117
  19. package/package.json +3 -2
  20. package/src/container.js +718 -653
  21. package/src/navigate.js +406 -491
  22. package/src/pointer.js +86 -78
  23. package/{build/src → src}/spotlight.d.ts +0 -0
  24. package/src/spotlight.js +846 -885
  25. package/src/target.js +448 -474
  26. package/src/tests/container-specs.js +643 -1251
  27. package/src/tests/navigate-specs.js +77 -134
  28. package/src/tests/pointer-specs.js +126 -182
  29. package/src/tests/spotlight-specs.js +103 -133
  30. package/src/tests/target-specs.js +597 -960
  31. package/src/tests/utils.js +89 -67
  32. package/src/utils.js +155 -158
  33. package/build/Accelerator/Accelerator.js +0 -162
  34. package/build/Accelerator/package.json +0 -3
  35. package/build/CHANGELOG.md +0 -838
  36. package/build/Pause/Pause.js +0 -164
  37. package/build/Pause/package.json +0 -3
  38. package/build/Pause/tests/Pause-specs.js +0 -65
  39. package/build/README.md +0 -61
  40. package/build/SpotlightContainerDecorator/SpotlightContainer.js +0 -176
  41. package/build/SpotlightContainerDecorator/SpotlightContainerDecorator.js +0 -282
  42. package/build/SpotlightContainerDecorator/package.json +0 -3
  43. package/build/SpotlightContainerDecorator/tests/Element.prototype.closest.js +0 -45
  44. package/build/SpotlightContainerDecorator/tests/SpotlightContainerDecorator-specs.js +0 -221
  45. package/build/SpotlightContainerDecorator/tests/useSpotlightContainer-specs.js +0 -160
  46. package/build/SpotlightContainerDecorator/useSpotlightContainer.js +0 -133
  47. package/build/SpotlightRootDecorator/SpotlightRootDecorator.js +0 -189
  48. package/build/SpotlightRootDecorator/package.json +0 -3
  49. package/build/Spottable/Spottable.js +0 -491
  50. package/build/Spottable/package.json +0 -3
  51. package/build/Spottable/tests/Spottable-specs.js +0 -90
  52. package/build/package-lock.json +0 -229
  53. package/build/package.json +0 -28
  54. package/build/src/container.js +0 -1201
  55. package/build/src/navigate.js +0 -419
  56. package/build/src/pointer.js +0 -183
  57. package/build/src/spotlight.js +0 -896
  58. package/build/src/target.js +0 -507
  59. package/build/src/tests/container-specs.js +0 -653
  60. package/build/src/tests/navigate-specs.js +0 -87
  61. package/build/src/tests/pointer-specs.js +0 -130
  62. package/build/src/tests/spotlight-specs.js +0 -112
  63. package/build/src/tests/target-specs.js +0 -614
  64. package/build/src/tests/utils.js +0 -104
  65. package/build/src/utils.js +0 -180
  66. package/build/styles/debug.less +0 -97
  67. package/build/styles/mixins.less +0 -63
  68. package/docs/index.md +0 -364
@@ -1,142 +1,112 @@
1
- import {
2
- configureContainer,
3
- configureDefaults,
4
- containerAttribute,
5
- removeAllContainers,
6
- rootContainerId,
7
- setLastContainer
8
- } from '../container';
9
- import Spotlight from '../spotlight';
10
-
11
- import {
12
- container,
13
- join,
14
- node,
15
- someSpottables,
16
- spottable,
17
- testScenario
18
- } from './utils';
19
-
20
- const nonSpottable = () => node({className: 'other'});
21
-
22
- const scenarios = {
23
- complexTree: join(
24
- spottable({'data-spotlight-id': 's1'}),
25
- spottable(nonSpottable()),
26
- container({[containerAttribute]: 'first-container', children: join(
27
- someSpottables(2),
28
- container({[containerAttribute]: 'second-container', children: join(
29
- spottable({id: 'secondContainerFirstSpottable'}),
30
- someSpottables(2),
31
- container({
32
- [containerAttribute]: 'third-container',
33
- 'data-spotlight-container-disabled': true,
34
- children: join(
35
- someSpottables(4),
36
- node({id: 'child-of-third'})
37
- )
38
- })
39
- )})
40
- )})
41
- )
1
+ "use strict";
2
+
3
+ var _container4 = require("../container");
4
+
5
+ var _spotlight = _interopRequireDefault(require("../spotlight"));
6
+
7
+ var _utils = require("./utils");
8
+
9
+ var _container, _container2, _container3;
10
+
11
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
12
+
13
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
14
+
15
+ var nonSpottable = function nonSpottable() {
16
+ return (0, _utils.node)({
17
+ className: 'other'
18
+ });
42
19
  };
43
20
 
44
- const setupContainers = () => {
45
- Spotlight.setPointerMode(false);
46
- configureDefaults({
47
- selector: '.spottable'
48
- });
49
- configureContainer(rootContainerId);
50
- setLastContainer(rootContainerId);
21
+ var scenarios = {
22
+ complexTree: (0, _utils.join)((0, _utils.spottable)({
23
+ 'data-spotlight-id': 's1'
24
+ }), (0, _utils.spottable)(nonSpottable()), (0, _utils.container)((_container3 = {}, _defineProperty(_container3, _container4.containerAttribute, 'first-container'), _defineProperty(_container3, "children", (0, _utils.join)((0, _utils.someSpottables)(2), (0, _utils.container)((_container2 = {}, _defineProperty(_container2, _container4.containerAttribute, 'second-container'), _defineProperty(_container2, "children", (0, _utils.join)((0, _utils.spottable)({
25
+ id: 'secondContainerFirstSpottable'
26
+ }), (0, _utils.someSpottables)(2), (0, _utils.container)((_container = {}, _defineProperty(_container, _container4.containerAttribute, 'third-container'), _defineProperty(_container, 'data-spotlight-container-disabled', true), _defineProperty(_container, "children", (0, _utils.join)((0, _utils.someSpottables)(4), (0, _utils.node)({
27
+ id: 'child-of-third'
28
+ }))), _container)))), _container2)))), _container3)))
51
29
  };
52
30
 
53
- const teardownContainers = () => {
54
- // clean up any containers we create for safe tests
55
- removeAllContainers();
31
+ var setupContainers = function setupContainers() {
32
+ _spotlight["default"].setPointerMode(false);
33
+
34
+ (0, _container4.configureDefaults)({
35
+ selector: '.spottable'
36
+ });
37
+ (0, _container4.configureContainer)(_container4.rootContainerId);
38
+ (0, _container4.setLastContainer)(_container4.rootContainerId);
56
39
  };
57
40
 
58
- const mockFocus = (n) => {
59
- const fn = jest.fn().mockImplementation(() => true);
60
- Object.defineProperty(n, 'focus', {
61
- get: () => fn
62
- });
41
+ var teardownContainers = function teardownContainers() {
42
+ // clean up any containers we create for safe tests
43
+ (0, _container4.removeAllContainers)();
44
+ };
63
45
 
64
- return fn;
46
+ var mockFocus = function mockFocus(n) {
47
+ var fn = jest.fn().mockImplementation(function () {
48
+ return true;
49
+ });
50
+ Object.defineProperty(n, 'focus', {
51
+ get: function get() {
52
+ return fn;
53
+ }
54
+ });
55
+ return fn;
65
56
  };
66
57
 
67
- describe('Spotlight', () => {
68
- describe('#focus', () => {
69
- beforeEach(setupContainers);
70
- afterEach(teardownContainers);
71
-
72
- test('should focus spottable by id', testScenario(
73
- scenarios.complexTree,
74
- (root) => {
75
- const fn = mockFocus(root.querySelector('[data-spotlight-id="s1"]'));
76
- Spotlight.focus('s1');
77
-
78
- expect(fn).toBeCalled();
79
- }
80
- ));
81
-
82
- test('should focus container by id', testScenario(
83
- scenarios.complexTree,
84
- (root) => {
85
- configureContainer('first-container');
86
-
87
- const fn = mockFocus(root.querySelector('[data-spotlight-id="first-container"] > .spottable'));
88
- Spotlight.focus('first-container');
89
-
90
- expect(fn).toBeCalled();
91
- }
92
- ));
93
-
94
- test('should focus spottable by node', testScenario(
95
- scenarios.complexTree,
96
- (root) => {
97
- const n = root.querySelector('[data-spotlight-id="s1"]');
98
- const fn = mockFocus(n);
99
- Spotlight.focus(n);
100
-
101
- expect(fn).toBeCalled();
102
- }
103
- ));
104
-
105
- test('should focus container by node', testScenario(
106
- scenarios.complexTree,
107
- (root) => {
108
- configureContainer('first-container');
109
-
110
- const n = root.querySelector('[data-spotlight-id="first-container"]');
111
- const fn = mockFocus(n.querySelector('.spottable'));
112
- Spotlight.focus(n);
113
-
114
- expect(fn).toBeCalled();
115
- }
116
- ));
117
-
118
- test('should focus spottable by selector', testScenario(
119
- scenarios.complexTree,
120
- (root) => {
121
- const n = root.querySelector('[data-spotlight-id="s1"]');
122
- const fn = mockFocus(n);
123
- Spotlight.focus('[data-spotlight-id="s1"]');
124
-
125
- expect(fn).toBeCalled();
126
- }
127
- ));
128
-
129
- test('should focus container by node', testScenario(
130
- scenarios.complexTree,
131
- (root) => {
132
- configureContainer('first-container');
133
-
134
- const n = root.querySelector('[data-spotlight-id="first-container"]');
135
- const fn = mockFocus(n.querySelector('.spottable'));
136
- Spotlight.focus('[data-spotlight-id="first-container"]');
137
-
138
- expect(fn).toBeCalled();
139
- }
140
- ));
141
- });
142
- });
58
+ describe('Spotlight', function () {
59
+ describe('#focus', function () {
60
+ beforeEach(setupContainers);
61
+ afterEach(teardownContainers);
62
+ test('should focus spottable by id', (0, _utils.testScenario)(scenarios.complexTree, function (root) {
63
+ var fn = mockFocus(root.querySelector('[data-spotlight-id="s1"]'));
64
+
65
+ _spotlight["default"].focus('s1');
66
+
67
+ expect(fn).toBeCalled();
68
+ }));
69
+ test('should focus container by id', (0, _utils.testScenario)(scenarios.complexTree, function (root) {
70
+ (0, _container4.configureContainer)('first-container');
71
+ var fn = mockFocus(root.querySelector('[data-spotlight-id="first-container"] > .spottable'));
72
+
73
+ _spotlight["default"].focus('first-container');
74
+
75
+ expect(fn).toBeCalled();
76
+ }));
77
+ test('should focus spottable by node', (0, _utils.testScenario)(scenarios.complexTree, function (root) {
78
+ var n = root.querySelector('[data-spotlight-id="s1"]');
79
+ var fn = mockFocus(n);
80
+
81
+ _spotlight["default"].focus(n);
82
+
83
+ expect(fn).toBeCalled();
84
+ }));
85
+ test('should focus container by node', (0, _utils.testScenario)(scenarios.complexTree, function (root) {
86
+ (0, _container4.configureContainer)('first-container');
87
+ var n = root.querySelector('[data-spotlight-id="first-container"]');
88
+ var fn = mockFocus(n.querySelector('.spottable'));
89
+
90
+ _spotlight["default"].focus(n);
91
+
92
+ expect(fn).toBeCalled();
93
+ }));
94
+ test('should focus spottable by selector', (0, _utils.testScenario)(scenarios.complexTree, function (root) {
95
+ var n = root.querySelector('[data-spotlight-id="s1"]');
96
+ var fn = mockFocus(n);
97
+
98
+ _spotlight["default"].focus('[data-spotlight-id="s1"]');
99
+
100
+ expect(fn).toBeCalled();
101
+ }));
102
+ test('should focus container by node', (0, _utils.testScenario)(scenarios.complexTree, function (root) {
103
+ (0, _container4.configureContainer)('first-container');
104
+ var n = root.querySelector('[data-spotlight-id="first-container"]');
105
+ var fn = mockFocus(n.querySelector('.spottable'));
106
+
107
+ _spotlight["default"].focus('[data-spotlight-id="first-container"]');
108
+
109
+ expect(fn).toBeCalled();
110
+ }));
111
+ });
112
+ });