@enact/spotlight 5.0.0-beta.1 → 5.0.0-rc.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.
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
 
3
- var _container12 = require("../container");
3
+ var _container10 = require("../container");
4
4
  var _target = require("../target");
5
5
  var _utils = require("./utils");
6
6
  function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
@@ -21,17 +21,17 @@ var positionedSpottable = function positionedSpottable(id, top, left) {
21
21
  });
22
22
  };
23
23
  var grid = function grid() {
24
- return (0, _utils.container)(_defineProperty(_defineProperty(_defineProperty({}, _container12.containerAttribute, 'grid'), "style", 'position: relative; height: 30px; width: 30px;'), "children", (0, _utils.join)(positionedSpottable('top-left', 0, 0), positionedSpottable('top-center', 0, 10), positionedSpottable('top-right', 0, 20), positionedSpottable('middle-left', 10, 0), positionedSpottable('middle-center', 10, 10), positionedSpottable('middle-right', 10, 20), positionedSpottable('bottom-left', 20, 0), positionedSpottable('bottom-center', 20, 10), positionedSpottable('bottom-right', 20, 20))));
24
+ return (0, _utils.container)(_defineProperty(_defineProperty(_defineProperty({}, _container10.containerAttribute, 'grid'), "style", 'position: relative; height: 30px; width: 30px;'), "children", (0, _utils.join)(positionedSpottable('top-left', 0, 0), positionedSpottable('top-center', 0, 10), positionedSpottable('top-right', 0, 20), positionedSpottable('middle-left', 10, 0), positionedSpottable('middle-center', 10, 10), positionedSpottable('middle-right', 10, 20), positionedSpottable('bottom-left', 20, 0), positionedSpottable('bottom-center', 20, 10), positionedSpottable('bottom-right', 20, 20))));
25
25
  };
26
26
  var scenarios = {
27
- complexTree: (0, _utils.join)((0, _utils.spottable)(nonSpottable()), (0, _utils.container)(_defineProperty(_defineProperty({}, _container12.containerAttribute, 'first-container'), "children", (0, _utils.join)((0, _utils.someSpottables)(2), (0, _utils.container)(_defineProperty(_defineProperty({}, _container12.containerAttribute, 'second-container'), "children", (0, _utils.join)((0, _utils.someSpottables)(3), (0, _utils.container)(_defineProperty(_defineProperty(_defineProperty({}, _container12.containerAttribute, 'third-container'), 'data-spotlight-container-disabled', true), "children", (0, _utils.join)((0, _utils.someSpottables)(4), (0, _utils.node)({
27
+ complexTree: (0, _utils.join)((0, _utils.spottable)(nonSpottable()), (0, _utils.container)(_defineProperty(_defineProperty({}, _container10.containerAttribute, 'first-container'), "children", (0, _utils.join)((0, _utils.someSpottables)(2), (0, _utils.container)(_defineProperty(_defineProperty({}, _container10.containerAttribute, 'second-container'), "children", (0, _utils.join)((0, _utils.someSpottables)(3), (0, _utils.container)(_defineProperty(_defineProperty(_defineProperty({}, _container10.containerAttribute, 'third-container'), 'data-spotlight-container-disabled', true), "children", (0, _utils.join)((0, _utils.someSpottables)(4), (0, _utils.node)({
28
28
  id: 'child-of-third'
29
29
  }))))))))))),
30
30
  nonSpottableInContainer: (0, _utils.join)((0, _utils.spottable)({
31
31
  id: 'in-root'
32
- }), (0, _utils.container)(_defineProperty(_defineProperty({}, _container12.containerAttribute, 'first'), "children", (0, _utils.join)(nonSpottable(), (0, _utils.spottable)({
32
+ }), (0, _utils.container)(_defineProperty(_defineProperty({}, _container10.containerAttribute, 'first'), "children", (0, _utils.join)(nonSpottable(), (0, _utils.spottable)({
33
33
  id: 'in-first'
34
- })))), (0, _utils.container)(_defineProperty(_defineProperty({}, _container12.containerAttribute, 'second'), "children", (0, _utils.join)(nonSpottable())))),
34
+ })))), (0, _utils.container)(_defineProperty(_defineProperty({}, _container10.containerAttribute, 'second'), "children", (0, _utils.join)(nonSpottable())))),
35
35
  grid: (0, _utils.join)((0, _utils.spottable)({
36
36
  id: 'before-grid',
37
37
  style: 'height: 10px'
@@ -51,7 +51,7 @@ var scenarios = {
51
51
  }), (0, _utils.node)({
52
52
  // allocate some empty space so that overflow items would be otherwise navigable
53
53
  style: 'height: 100px'
54
- }), (0, _utils.container)(_defineProperty(_defineProperty(_defineProperty({}, _container12.containerAttribute, 'overflow-container'), "style", 'position: relative; height: 30px; width: 30px;'), "children", (0, _utils.join)((0, _utils.spottable)({
54
+ }), (0, _utils.container)(_defineProperty(_defineProperty(_defineProperty({}, _container10.containerAttribute, 'overflow-container'), "style", 'position: relative; height: 30px; width: 30px;'), "children", (0, _utils.join)((0, _utils.spottable)({
55
55
  id: 'overflow-above',
56
56
  style: 'position: absolute; top: -10px; left: 0px; height: 10px; width: 10px;'
57
57
  }), (0, _utils.spottable)({
@@ -66,7 +66,7 @@ var scenarios = {
66
66
  }), (0, _utils.node)({
67
67
  // allocate some empty space so that overflow items would be otherwise navigable
68
68
  style: 'height: 100px'
69
- }), (0, _utils.container)(_defineProperty(_defineProperty(_defineProperty({}, _container12.containerAttribute, 'overflow-container'), "style", 'position: relative; height: 30px; width: 30px;'), "children", (0, _utils.join)((0, _utils.container)(_defineProperty(_defineProperty(_defineProperty({}, _container12.containerAttribute, 'inside'), "style", 'position: absolute; top: -10px; left: 0px; height: 50px; width: 10px;'), "children", (0, _utils.join)((0, _utils.node)({
69
+ }), (0, _utils.container)(_defineProperty(_defineProperty(_defineProperty({}, _container10.containerAttribute, 'overflow-container'), "style", 'position: relative; height: 30px; width: 30px;'), "children", (0, _utils.join)((0, _utils.container)(_defineProperty(_defineProperty(_defineProperty({}, _container10.containerAttribute, 'inside'), "style", 'position: absolute; top: -10px; left: 0px; height: 50px; width: 10px;'), "children", (0, _utils.join)((0, _utils.node)({
70
70
  // allocate space to push following spottable into view
71
71
  style: 'height: 10px'
72
72
  }), (0, _utils.spottable)({
@@ -75,22 +75,22 @@ var scenarios = {
75
75
  id: 'below-large-container',
76
76
  style: 'position: absolute; top: 40px; left: 0px; height: 10px; width: 10px;'
77
77
  }))))),
78
- emptyContainer: (0, _utils.join)(positionedSpottable('above', 0, 10), (0, _utils.container)(_defineProperty(_defineProperty({}, _container12.containerAttribute, 'empty-container'), "style", position(10, 10))), positionedSpottable('below', 30, 0)),
79
- emptyContainerOverlap: (0, _utils.join)(positionedSpottable('above', 5, 10), (0, _utils.container)(_defineProperty(_defineProperty({}, _container12.containerAttribute, 'empty-container'), "style", position(10, 10))), positionedSpottable('below', 30, 0))
78
+ emptyContainer: (0, _utils.join)(positionedSpottable('above', 0, 10), (0, _utils.container)(_defineProperty(_defineProperty({}, _container10.containerAttribute, 'empty-container'), "style", position(10, 10))), positionedSpottable('below', 30, 0)),
79
+ emptyContainerOverlap: (0, _utils.join)(positionedSpottable('above', 5, 10), (0, _utils.container)(_defineProperty(_defineProperty({}, _container10.containerAttribute, 'empty-container'), "style", position(10, 10))), positionedSpottable('below', 30, 0))
80
80
  };
81
81
  var safeTarget = function safeTarget(n, fn) {
82
82
  return n ? fn(n) : 'NOT FOUND';
83
83
  };
84
84
  var setupContainers = function setupContainers() {
85
- (0, _container12.configureDefaults)({
85
+ (0, _container10.configureDefaults)({
86
86
  selector: '.spottable'
87
87
  });
88
- (0, _container12.configureContainer)(_container12.rootContainerId);
88
+ (0, _container10.configureContainer)(_container10.rootContainerId);
89
89
  };
90
90
  var teardownContainers = function teardownContainers() {
91
91
  // clean up any containers we create for safe tests
92
- (0, _container12.getAllContainerIds)().forEach(_container12.removeContainer);
93
- (0, _container12.setDefaultContainer)();
92
+ (0, _container10.getAllContainerIds)().forEach(_container10.removeContainer);
93
+ (0, _container10.setDefaultContainer)();
94
94
  };
95
95
 
96
96
  // NOTE: Skipping most tests because JSDOM does not support measurments
@@ -105,7 +105,7 @@ describe('target', function () {
105
105
  expect(actual).toBe(expected);
106
106
  }));
107
107
  test('should skip containers', (0, _utils.testScenario)(scenarios.nonSpottableInContainer, function (root) {
108
- (0, _container12.configureContainer)('first');
108
+ (0, _container10.configureContainer)('first');
109
109
  var other = root.querySelector('.other');
110
110
  var expected = null;
111
111
  var actual = (0, _target.getNavigableTarget)(other);
@@ -113,7 +113,7 @@ describe('target', function () {
113
113
  }));
114
114
  test('should respect container-specific selector', (0, _utils.testScenario)(scenarios.nonSpottableInContainer, function (root) {
115
115
  // make '.other' a valid spottable element
116
- (0, _container12.configureContainer)('first', {
116
+ (0, _container10.configureContainer)('first', {
117
117
  selector: '.other'
118
118
  });
119
119
  var other = root.querySelector('.other');
@@ -122,8 +122,8 @@ describe('target', function () {
122
122
  expect(actual).toBe(expected);
123
123
  }));
124
124
  test('should respect disabled containers', (0, _utils.testScenario)(scenarios.complexTree, function (root) {
125
- (0, _container12.configureContainer)('third-container');
126
- var other = root.querySelector("[".concat(_container12.containerAttribute, "='third-container'] .spottable"));
125
+ (0, _container10.configureContainer)('third-container');
126
+ var other = root.querySelector("[".concat(_container10.containerAttribute, "='third-container'] .spottable"));
127
127
  var expected = null;
128
128
  var actual = (0, _target.getNavigableTarget)(other);
129
129
  expect(actual).toBe(expected);
@@ -131,7 +131,7 @@ describe('target', function () {
131
131
  });
132
132
  describe('#getTargetByContainer', function () {
133
133
  test('should find spottable element within provided container', (0, _utils.testScenario)(scenarios.complexTree, function () {
134
- (0, _container12.configureContainer)('first-container');
134
+ (0, _container10.configureContainer)('first-container');
135
135
  var expected = 'spottable';
136
136
  var actual = safeTarget((0, _target.getTargetByContainer)('first-container'), function (t) {
137
137
  return t.className;
@@ -139,15 +139,15 @@ describe('target', function () {
139
139
  expect(actual).toBe(expected);
140
140
  }));
141
141
  test('should return null when container does not contain any spottable elements', (0, _utils.testScenario)(scenarios.nonSpottableInContainer, function () {
142
- (0, _container12.configureContainer)('first');
143
- (0, _container12.configureContainer)('second');
142
+ (0, _container10.configureContainer)('first');
143
+ (0, _container10.configureContainer)('second');
144
144
  var expected = null;
145
145
  var actual = (0, _target.getTargetByContainer)('second');
146
146
  expect(actual).toBe(expected);
147
147
  }));
148
148
  test('should find the first spottable in the root when no container specified', (0, _utils.testScenario)(scenarios.nonSpottableInContainer, function () {
149
- (0, _container12.configureContainer)('first');
150
- (0, _container12.configureContainer)('second');
149
+ (0, _container10.configureContainer)('first');
150
+ (0, _container10.configureContainer)('second');
151
151
  var expected = 'in-root';
152
152
  var actual = safeTarget((0, _target.getTargetByContainer)(), function (t) {
153
153
  return t.id;
@@ -155,9 +155,9 @@ describe('target', function () {
155
155
  expect(actual).toBe(expected);
156
156
  }));
157
157
  test('should find the first spottable in the default container when set and no container specified', (0, _utils.testScenario)(scenarios.nonSpottableInContainer, function () {
158
- (0, _container12.configureContainer)('first');
159
- (0, _container12.configureContainer)('second');
160
- (0, _container12.setDefaultContainer)('first');
158
+ (0, _container10.configureContainer)('first');
159
+ (0, _container10.configureContainer)('second');
160
+ (0, _container10.setDefaultContainer)('first');
161
161
  var expected = 'spottable';
162
162
  var actual = safeTarget((0, _target.getTargetByContainer)(), function (t) {
163
163
  return t.className;
@@ -165,7 +165,7 @@ describe('target', function () {
165
165
  expect(actual).toBe(expected);
166
166
  }));
167
167
  test('should return `default-element` when last focused is unset', (0, _utils.testScenario)(scenarios.grid, function () {
168
- (0, _container12.configureContainer)('grid', {
168
+ (0, _container10.configureContainer)('grid', {
169
169
  enterTo: 'last-focused',
170
170
  defaultElement: '#middle-center'
171
171
  });
@@ -176,7 +176,7 @@ describe('target', function () {
176
176
  expect(actual).toBe(expected);
177
177
  }));
178
178
  test('should return `default-element` when `last-focused` is requested but is unset', (0, _utils.testScenario)(scenarios.grid, function () {
179
- (0, _container12.configureContainer)('grid', {
179
+ (0, _container10.configureContainer)('grid', {
180
180
  defaultElement: '#middle-center'
181
181
  });
182
182
  var expected = 'middle-center';
@@ -186,7 +186,7 @@ describe('target', function () {
186
186
  expect(actual).toBe(expected);
187
187
  }));
188
188
  test('should return default element when configured for `last-focused` but requested `default-element`', (0, _utils.testScenario)(scenarios.grid, function () {
189
- (0, _container12.configureContainer)('grid', {
189
+ (0, _container10.configureContainer)('grid', {
190
190
  enterTo: 'last-focused',
191
191
  lastFocusedElement: document.querySelector('#top-left'),
192
192
  defaultElement: '#middle-center'
@@ -198,7 +198,7 @@ describe('target', function () {
198
198
  expect(actual).toBe(expected);
199
199
  }));
200
200
  test('should return last focused element when configured for `default-element` but requested `last-focused`', (0, _utils.testScenario)(scenarios.grid, function () {
201
- (0, _container12.configureContainer)('grid', {
201
+ (0, _container10.configureContainer)('grid', {
202
202
  enterTo: 'default-element',
203
203
  lastFocusedElement: document.querySelector('#top-left'),
204
204
  defaultElement: '#middle-center'
@@ -212,7 +212,7 @@ describe('target', function () {
212
212
  });
213
213
  describe('#getTargetBySelector', function () {
214
214
  test('should find spottable element within container when "@" prefix used', (0, _utils.testScenario)(scenarios.nonSpottableInContainer, function () {
215
- (0, _container12.configureContainer)('first');
215
+ (0, _container10.configureContainer)('first');
216
216
  var expected = 'spottable';
217
217
  var actual = safeTarget((0, _target.getTargetBySelector)('@first'), function (t) {
218
218
  return t.className;
@@ -220,7 +220,7 @@ describe('target', function () {
220
220
  expect(actual).toBe(expected);
221
221
  }));
222
222
  test('should find spottable element within container when "#" prefix used', (0, _utils.testScenario)(scenarios.nonSpottableInContainer, function () {
223
- (0, _container12.configureContainer)('first');
223
+ (0, _container10.configureContainer)('first');
224
224
  var expected = 'in-first';
225
225
  var actual = safeTarget((0, _target.getTargetBySelector)('#in-first'), function (t) {
226
226
  return t.id;
@@ -228,7 +228,7 @@ describe('target', function () {
228
228
  expect(actual).toBe(expected);
229
229
  }));
230
230
  test('should return null when the node exists but is not navigable within its container', (0, _utils.testScenario)(scenarios.nonSpottableInContainer, function () {
231
- (0, _container12.configureContainer)('first', {
231
+ (0, _container10.configureContainer)('first', {
232
232
  navigableFilter: function navigableFilter() {
233
233
  return false;
234
234
  }
@@ -238,9 +238,9 @@ describe('target', function () {
238
238
  expect(actual).toBe(expected);
239
239
  }));
240
240
  test('should return null when the node exists but does not match the container\'s selector', (0, _utils.testScenario)(scenarios.nonSpottableInContainer, function () {
241
- (0, _container12.configureContainer)('first');
241
+ (0, _container10.configureContainer)('first');
242
242
  var expected = null;
243
- var actual = (0, _target.getTargetBySelector)("[".concat(_container12.containerAttribute, "='first'] .other"));
243
+ var actual = (0, _target.getTargetBySelector)("[".concat(_container10.containerAttribute, "='first'] .other"));
244
244
  expect(actual).toBe(expected);
245
245
  }));
246
246
  test('should return null for an empty selectors', (0, _utils.testScenario)(scenarios.nonSpottableInContainer, function () {
@@ -254,7 +254,7 @@ describe('target', function () {
254
254
  });
255
255
  describe.skip('#getTargetByDirectionFromElement', function () {
256
256
  test('should find target within container by direction', (0, _utils.testScenario)(scenarios.grid, function (root) {
257
- (0, _container12.configureContainer)('grid');
257
+ (0, _container10.configureContainer)('grid');
258
258
  var center = root.querySelector('#middle-center');
259
259
  expect(safeTarget((0, _target.getTargetByDirectionFromElement)('up', center), function (t) {
260
260
  return t.id;
@@ -270,7 +270,7 @@ describe('target', function () {
270
270
  })).toBe('middle-right');
271
271
  }));
272
272
  test('should find target within container from floating element', (0, _utils.testScenario)(scenarios.overlap, function (root) {
273
- (0, _container12.configureContainer)('grid', {
273
+ (0, _container10.configureContainer)('grid', {
274
274
  enterTo: 'default-element',
275
275
  defaultElement: '#bottom-right'
276
276
  });
@@ -280,7 +280,7 @@ describe('target', function () {
280
280
  })).toBe('middle-center');
281
281
  }));
282
282
  test('should ignore targets outside the bounds of an overflow container', (0, _utils.testScenario)(scenarios.overflow, function (root) {
283
- (0, _container12.configureContainer)('overflow-container', {
283
+ (0, _container10.configureContainer)('overflow-container', {
284
284
  overflow: true
285
285
  });
286
286
  var element = root.querySelector('#outside-overflow');
@@ -289,10 +289,10 @@ describe('target', function () {
289
289
  })).toBe('overflow-within');
290
290
  }));
291
291
  test('should find target within container larger than overflow container', (0, _utils.testScenario)(scenarios.overflowLargeSubContainer, function (root) {
292
- (0, _container12.configureContainer)('overflow-container', {
292
+ (0, _container10.configureContainer)('overflow-container', {
293
293
  overflow: true
294
294
  });
295
- (0, _container12.configureContainer)('inside', {
295
+ (0, _container10.configureContainer)('inside', {
296
296
  enterTo: null
297
297
  });
298
298
  var element = root.querySelector('#outside-overflow');
@@ -301,7 +301,7 @@ describe('target', function () {
301
301
  })).toBe('in-large-container');
302
302
  }));
303
303
  test('should find target out of bounds of overflow container from within container', (0, _utils.testScenario)(scenarios.overflow, function (root) {
304
- (0, _container12.configureContainer)('overflow-container', {
304
+ (0, _container10.configureContainer)('overflow-container', {
305
305
  overflow: true
306
306
  });
307
307
  var element = root.querySelector('#overflow-within');
@@ -313,19 +313,19 @@ describe('target', function () {
313
313
  })).toBe('overflow-above');
314
314
  }));
315
315
  test('should stop at restrict="self-only" boundaries', (0, _utils.testScenario)(scenarios.complexTree, function (root) {
316
- (0, _container12.configureContainer)('first-container', {
316
+ (0, _container10.configureContainer)('first-container', {
317
317
  restrict: 'none'
318
318
  });
319
- (0, _container12.configureContainer)('second-container', {
319
+ (0, _container10.configureContainer)('second-container', {
320
320
  restrict: 'self-only'
321
321
  });
322
- var element = root.querySelector("[".concat(_container12.containerAttribute, "=\"second-container\"] .spottable"));
322
+ var element = root.querySelector("[".concat(_container10.containerAttribute, "=\"second-container\"] .spottable"));
323
323
  expect(safeTarget((0, _target.getTargetByDirectionFromElement)('up', element), function (t) {
324
324
  return t.id;
325
325
  })).toBe('NOT FOUND');
326
326
  }));
327
327
  test('should respect enterTo="default-element" containers', (0, _utils.testScenario)(scenarios.grid, function (root) {
328
- (0, _container12.configureContainer)('grid', {
328
+ (0, _container10.configureContainer)('grid', {
329
329
  restrict: 'none',
330
330
  enterTo: 'default-element',
331
331
  defaultElement: '#bottom-right'
@@ -336,7 +336,7 @@ describe('target', function () {
336
336
  })).toBe('bottom-right');
337
337
  }));
338
338
  test('should respect enterTo="last-focused" containers', (0, _utils.testScenario)(scenarios.grid, function (root) {
339
- (0, _container12.configureContainer)('grid', {
339
+ (0, _container10.configureContainer)('grid', {
340
340
  restrict: 'none',
341
341
  enterTo: 'last-focused',
342
342
  lastFocusedKey: {
@@ -351,7 +351,7 @@ describe('target', function () {
351
351
  })).toBe('bottom-right');
352
352
  }));
353
353
  test('should follow the leaveFor config when no target is found within the container in the given direction', (0, _utils.testScenario)(scenarios.grid, function (root) {
354
- (0, _container12.configureContainer)('grid', {
354
+ (0, _container10.configureContainer)('grid', {
355
355
  restrict: 'none',
356
356
  leaveFor: {
357
357
  up: '#after-grid'
@@ -363,7 +363,7 @@ describe('target', function () {
363
363
  })).toBe('after-grid');
364
364
  }));
365
365
  test('should not follow the leaveFor config when a target is found within the container in the given direction', (0, _utils.testScenario)(scenarios.grid, function (root) {
366
- (0, _container12.configureContainer)('grid', {
366
+ (0, _container10.configureContainer)('grid', {
367
367
  restrict: 'none',
368
368
  leaveFor: {
369
369
  up: '#after-grid'
@@ -375,7 +375,7 @@ describe('target', function () {
375
375
  })).toBe('top-center');
376
376
  }));
377
377
  test('should not follow the leaveFor config when the selector does not match an element', (0, _utils.testScenario)(scenarios.grid, function (root) {
378
- (0, _container12.configureContainer)('grid', {
378
+ (0, _container10.configureContainer)('grid', {
379
379
  restrict: 'none',
380
380
  leaveFor: {
381
381
  up: '#does-not-exist'
@@ -387,14 +387,14 @@ describe('target', function () {
387
387
  })).toBe('before-grid');
388
388
  }));
389
389
  test('should ignore empty containers', (0, _utils.testScenario)(scenarios.emptyContainer, function (root) {
390
- (0, _container12.configureContainer)('empty-container');
390
+ (0, _container10.configureContainer)('empty-container');
391
391
  var element = root.querySelector('#above');
392
392
  expect(safeTarget((0, _target.getTargetByDirectionFromElement)('down', element), function (t) {
393
393
  return t.id;
394
394
  })).toBe('below');
395
395
  }));
396
396
  test('should ignore overlapping empty containers', (0, _utils.testScenario)(scenarios.emptyContainerOverlap, function (root) {
397
- (0, _container12.configureContainer)('empty-container');
397
+ (0, _container10.configureContainer)('empty-container');
398
398
  var element = root.querySelector('#above');
399
399
  expect(safeTarget((0, _target.getTargetByDirectionFromElement)('down', element), function (t) {
400
400
  return t.id;
@@ -403,7 +403,7 @@ describe('target', function () {
403
403
  });
404
404
  describe.skip('#getTargetByDirectionFromPosition', function () {
405
405
  test('should find target within container', (0, _utils.testScenario)(scenarios.grid, function (root) {
406
- (0, _container12.configureContainer)('grid');
406
+ (0, _container10.configureContainer)('grid');
407
407
  var rect = root.querySelector('#middle-center').getBoundingClientRect();
408
408
  var center = {
409
409
  x: rect.left + rect.width / 2,
@@ -423,7 +423,7 @@ describe('target', function () {
423
423
  })).toBe('middle-right');
424
424
  }));
425
425
  test('should not find a target when at bounds of container with restrict="self-only"', (0, _utils.testScenario)(scenarios.grid, function (root) {
426
- (0, _container12.configureContainer)('grid', {
426
+ (0, _container10.configureContainer)('grid', {
427
427
  restrict: 'self-only'
428
428
  });
429
429
  var rect = root.querySelector('#top-center').getBoundingClientRect();
@@ -436,7 +436,7 @@ describe('target', function () {
436
436
  })).toBe('NOT FOUND');
437
437
  }));
438
438
  test('should not find a target outside of container when restrict is not set', (0, _utils.testScenario)(scenarios.grid, function (root) {
439
- (0, _container12.configureContainer)('grid', {
439
+ (0, _container10.configureContainer)('grid', {
440
440
  restrict: 'none'
441
441
  });
442
442
  var rect = root.querySelector('#top-center').getBoundingClientRect();
@@ -449,7 +449,7 @@ describe('target', function () {
449
449
  })).toBe('before-grid');
450
450
  }));
451
451
  test('should cascade into unrestricted subcontainers', (0, _utils.testScenario)(scenarios.grid, function (root) {
452
- (0, _container12.configureContainer)('grid', {
452
+ (0, _container10.configureContainer)('grid', {
453
453
  restrict: 'none'
454
454
  });
455
455
  var rect = root.querySelector('#top-center').getBoundingClientRect();
@@ -457,12 +457,12 @@ describe('target', function () {
457
457
  x: rect.left + rect.width / 2,
458
458
  y: rect.top - 1
459
459
  };
460
- expect(safeTarget((0, _target.getTargetByDirectionFromPosition)('down', aboveCenterOfGrid, _container12.rootContainerId), function (t) {
460
+ expect(safeTarget((0, _target.getTargetByDirectionFromPosition)('down', aboveCenterOfGrid, _container10.rootContainerId), function (t) {
461
461
  return t.id;
462
462
  })).toBe('top-center');
463
463
  }));
464
464
  test('should ignore enterTo config of restricted subcontainers', (0, _utils.testScenario)(scenarios.grid, function (root) {
465
- (0, _container12.configureContainer)('grid', {
465
+ (0, _container10.configureContainer)('grid', {
466
466
  restrict: 'none',
467
467
  enterTo: 'default-element',
468
468
  defaultElement: '#bottom-right'
@@ -472,12 +472,12 @@ describe('target', function () {
472
472
  x: rect.left + rect.width / 2,
473
473
  y: rect.top - 1
474
474
  };
475
- expect(safeTarget((0, _target.getTargetByDirectionFromPosition)('down', aboveCenterOfGrid, _container12.rootContainerId), function (t) {
475
+ expect(safeTarget((0, _target.getTargetByDirectionFromPosition)('down', aboveCenterOfGrid, _container10.rootContainerId), function (t) {
476
476
  return t.id;
477
477
  })).toBe('top-center');
478
478
  }));
479
479
  test('should find target within container from floating element', (0, _utils.testScenario)(scenarios.overlap, function (root) {
480
- (0, _container12.configureContainer)('grid', {
480
+ (0, _container10.configureContainer)('grid', {
481
481
  enterTo: 'default-element',
482
482
  defaultElement: '#bottom-right'
483
483
  });
@@ -488,12 +488,12 @@ describe('target', function () {
488
488
  expect(safeTarget((0, _target.getTargetByDirectionFromPosition)('down', {
489
489
  x: x,
490
490
  y: y
491
- }, _container12.rootContainerId), function (t) {
491
+ }, _container10.rootContainerId), function (t) {
492
492
  return t.id;
493
493
  })).toBe('middle-center');
494
494
  }));
495
495
  test('should ignore targets outside the bounds of an overflow container', (0, _utils.testScenario)(scenarios.overflow, function (root) {
496
- (0, _container12.configureContainer)('overflow-container', {
496
+ (0, _container10.configureContainer)('overflow-container', {
497
497
  overflow: true
498
498
  });
499
499
  var element = root.querySelector('#outside-overflow');
@@ -503,15 +503,15 @@ describe('target', function () {
503
503
  expect(safeTarget((0, _target.getTargetByDirectionFromPosition)('down', {
504
504
  x: x,
505
505
  y: y
506
- }, _container12.rootContainerId), function (t) {
506
+ }, _container10.rootContainerId), function (t) {
507
507
  return t.id;
508
508
  })).toBe('overflow-within');
509
509
  }));
510
510
  test('should find target within container larger than overflow container', (0, _utils.testScenario)(scenarios.overflowLargeSubContainer, function (root) {
511
- (0, _container12.configureContainer)('overflow-container', {
511
+ (0, _container10.configureContainer)('overflow-container', {
512
512
  overflow: true
513
513
  });
514
- (0, _container12.configureContainer)('inside', {
514
+ (0, _container10.configureContainer)('inside', {
515
515
  enterTo: null
516
516
  });
517
517
  var element = root.querySelector('#outside-overflow');
@@ -521,12 +521,12 @@ describe('target', function () {
521
521
  expect(safeTarget((0, _target.getTargetByDirectionFromPosition)('down', {
522
522
  x: x,
523
523
  y: y
524
- }, _container12.rootContainerId), function (t) {
524
+ }, _container10.rootContainerId), function (t) {
525
525
  return t.id;
526
526
  })).toBe('in-large-container');
527
527
  }));
528
528
  test('should find target out of bounds of overflow container from within container', (0, _utils.testScenario)(scenarios.overflow, function (root) {
529
- (0, _container12.configureContainer)('overflow-container', {
529
+ (0, _container10.configureContainer)('overflow-container', {
530
530
  overflow: true
531
531
  });
532
532
  var element = root.querySelector('#overflow-within');
@@ -540,18 +540,18 @@ describe('target', function () {
540
540
  expect(safeTarget((0, _target.getTargetByDirectionFromPosition)('down', {
541
541
  x: x,
542
542
  y: y + 1
543
- }, _container12.rootContainerId), function (t) {
543
+ }, _container10.rootContainerId), function (t) {
544
544
  return t.id;
545
545
  })).toBe('overflow-below');
546
546
  expect(safeTarget((0, _target.getTargetByDirectionFromPosition)('up', {
547
547
  x: x,
548
548
  y: y - 1
549
- }, _container12.rootContainerId), function (t) {
549
+ }, _container10.rootContainerId), function (t) {
550
550
  return t.id;
551
551
  })).toBe('overflow-above');
552
552
  }));
553
553
  test('should ignore empty containers', (0, _utils.testScenario)(scenarios.emptyContainer, function (root) {
554
- (0, _container12.configureContainer)('empty-container');
554
+ (0, _container10.configureContainer)('empty-container');
555
555
  var element = root.querySelector('#above');
556
556
  var _element$getBoundingC4 = element.getBoundingClientRect(),
557
557
  left = _element$getBoundingC4.left,
@@ -564,12 +564,12 @@ describe('target', function () {
564
564
  expect(safeTarget((0, _target.getTargetByDirectionFromPosition)('down', {
565
565
  x: x,
566
566
  y: y
567
- }, _container12.rootContainerId), function (t) {
567
+ }, _container10.rootContainerId), function (t) {
568
568
  return t.id;
569
569
  })).toBe('below');
570
570
  }));
571
571
  test('should ignore overlapping empty containers', (0, _utils.testScenario)(scenarios.emptyContainer, function (root) {
572
- (0, _container12.configureContainer)('empty-container');
572
+ (0, _container10.configureContainer)('empty-container');
573
573
  var element = root.querySelector('#above');
574
574
  var _element$getBoundingC5 = element.getBoundingClientRect(),
575
575
  left = _element$getBoundingC5.left,
@@ -582,7 +582,7 @@ describe('target', function () {
582
582
  expect(safeTarget((0, _target.getTargetByDirectionFromPosition)('down', {
583
583
  x: x,
584
584
  y: y
585
- }, _container12.rootContainerId), function (t) {
585
+ }, _container10.rootContainerId), function (t) {
586
586
  return t.id;
587
587
  })).toBe('below');
588
588
  }));