@enact/ui 4.1.2 → 4.1.3

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 (84) hide show
  1. package/AnnounceDecorator/tests/Announce-specs.js +13 -5
  2. package/AnnounceDecorator/tests/AnnounceDecorator-specs.js +9 -7
  3. package/AnnounceDecorator/tests/useAnnounce-specs.js +25 -17
  4. package/BodyText/BodyText.d.ts +1 -1
  5. package/BodyText/tests/BodyText-specs.js +49 -35
  6. package/Button/Button.d.ts +6 -6
  7. package/Button/tests/Button-specs.js +104 -3
  8. package/CHANGELOG.md +4 -0
  9. package/Cancelable/Cancelable.js +1 -1
  10. package/Cancelable/tests/Cancelable-specs.js +131 -70
  11. package/Changeable/tests/Changeable-specs.js +162 -110
  12. package/FloatingLayer/FloatingLayer.js +5 -17
  13. package/FloatingLayer/tests/FloatingLayer-specs.js +83 -8
  14. package/FloatingLayer/tests/Scrim-specs.js +20 -11
  15. package/FloatingLayer/tests/useFloatingLayerDecorator-specs.js +15 -9
  16. package/GridListImageItem/GridListImageItem.d.ts +1 -1
  17. package/Group/Group.d.ts +2 -2
  18. package/Group/tests/Group-specs.js +71 -41
  19. package/Heading/Heading.d.ts +2 -1
  20. package/Heading/tests/Heading-specs.js +27 -20
  21. package/Icon/Icon.d.ts +4 -4
  22. package/Icon/tests/Icon-specs.js +52 -31
  23. package/IconButton/IconButton.d.ts +4 -4
  24. package/IconButton/tests/IconButton-specs.js +2 -2
  25. package/Image/tests/Image-specs.js +39 -29
  26. package/ImageItem/tests/ImageItem-specs.js +71 -68
  27. package/Item/tests/Item-specs.js +59 -35
  28. package/LabeledIcon/LabeledIcon.d.ts +4 -4
  29. package/LabeledIcon/tests/LabeledIcon-specs.js +30 -19
  30. package/Layout/Layout.d.ts +16 -16
  31. package/Layout/tests/Layout-specs.js +37 -25
  32. package/Marquee/MarqueeBase.js +1 -5
  33. package/Marquee/tests/Marquee-specs.js +221 -116
  34. package/Media/Media.js +1 -3
  35. package/ProgressBar/tests/ProgressBar-specs.js +60 -42
  36. package/README.md +1 -1
  37. package/RadioDecorator/RadioDecorator.js +3 -5
  38. package/RadioDecorator/tests/RadioDecorator-specs.js +179 -65
  39. package/Repeater/Repeater.d.ts +2 -1
  40. package/Repeater/tests/Repeater-specs.js +86 -45
  41. package/Routable/Routable.d.ts +2 -2
  42. package/Routable/tests/Routable-specs.js +26 -17
  43. package/Routable/tests/Router-specs.js +65 -41
  44. package/Scrollable/Scrollable.js +1 -0
  45. package/Scrollable/ScrollableNative.js +1 -0
  46. package/Scroller/Scroller.d.ts +2 -2
  47. package/Skinnable/tests/Skinnable-specs.js +102 -54
  48. package/Skinnable/tests/useSkins-specs.js +37 -42
  49. package/Slider/Slider.d.ts +3 -3
  50. package/Slider/tests/Slider-specs.js +4 -4
  51. package/SlotItem/SlotItem.d.ts +2 -2
  52. package/SlotItem/tests/SlotItem-specs.js +4 -4
  53. package/Slottable/tests/Slottable-specs.js +67 -36
  54. package/Slottable/tests/useSlots-specs.js +68 -35
  55. package/Spinner/Spinner.d.ts +1 -1
  56. package/Spinner/tests/Spinner-specs.js +46 -31
  57. package/ToggleIcon/tests/ToggleIcon-specs.js +32 -20
  58. package/ToggleItem/ToggleItem.d.ts +13 -11
  59. package/ToggleItem/tests/ToggleItem-specs.js +51 -34
  60. package/Toggleable/Toggle.js +6 -6
  61. package/Toggleable/Toggleable.js +6 -12
  62. package/Toggleable/tests/Toggleable-specs.js +428 -324
  63. package/Touchable/Drag.js +13 -17
  64. package/Touchable/Flick.js +20 -16
  65. package/Touchable/Hold.js +14 -19
  66. package/Touchable/Touchable.d.ts +3 -3
  67. package/Touchable/tests/Touchable-specs.js +223 -109
  68. package/Touchable/tests/useTouch-specs.js +159 -84
  69. package/Transition/Transition.d.ts +29 -27
  70. package/Transition/Transition.js +5 -9
  71. package/Transition/tests/Transition-specs.js +135 -31
  72. package/ViewManager/TransitionGroup.js +6 -5
  73. package/ViewManager/View.js +1 -1
  74. package/ViewManager/ViewManager.d.ts +4 -4
  75. package/ViewManager/ViewManager.js +10 -10
  76. package/ViewManager/tests/View-specs.js +109 -81
  77. package/ViewManager/tests/ViewManager-specs.js +471 -185
  78. package/VirtualList/VirtualList.d.ts +11 -9
  79. package/VirtualList/tests/VirtualList-specs.js +44 -31
  80. package/internal/IdProvider/tests/useId-specs.js +35 -18
  81. package/package.json +11 -11
  82. package/resolution/tests/ResolutionDecorator-specs.js +17 -8
  83. package/styles/mixins.less +14 -2
  84. package/useControlledState/tests/useControlledState-specs.js +67 -42
@@ -1,8 +1,10 @@
1
1
  "use strict";
2
2
 
3
- var _react = require("react");
3
+ require("@testing-library/jest-dom");
4
4
 
5
- var _enzyme = require("enzyme");
5
+ var _react = require("@testing-library/react");
6
+
7
+ var _react2 = require("react");
6
8
 
7
9
  var _ = _interopRequireDefault(require("../"));
8
10
 
@@ -12,6 +14,10 @@ var _jsxRuntime = require("react/jsx-runtime");
12
14
 
13
15
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
14
16
 
17
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
18
+
19
+ function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
20
+
15
21
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
16
22
 
17
23
  function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
@@ -35,151 +41,189 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
35
41
  describe('ViewManager', function () {
36
42
  // Suite-wide setup
37
43
  test('should render {component} as its child - <div/> by default', function () {
38
- var subject = (0, _enzyme.mount)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_["default"], {
44
+ (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_["default"], {
45
+ "data-testid": "component",
39
46
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {})
40
47
  }));
41
- var expected = 1;
42
- var actual = subject.find('div').length;
48
+ var expected = 'DIV';
49
+
50
+ var actual = _react.screen.getByTestId('component').tagName;
51
+
43
52
  expect(actual).toBe(expected);
44
53
  });
45
54
  test('should render {component} as its child', function () {
46
- var subject = (0, _enzyme.mount)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_["default"], {
55
+ (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_["default"], {
47
56
  component: "span",
57
+ "data-testid": "component",
48
58
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {})
49
59
  }));
50
- var expected = 1;
51
- var actual = subject.find('span').length;
60
+ var expected = 'SPAN';
61
+
62
+ var actual = _react.screen.getByTestId('component').tagName;
63
+
52
64
  expect(actual).toBe(expected);
53
65
  });
54
66
  test('should render only 1 child view', function () {
55
- var subject = (0, _enzyme.mount)( /*#__PURE__*/(0, _jsxRuntime.jsxs)(_["default"], {
67
+ (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsxs)(_["default"], {
56
68
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
57
- className: "view",
58
69
  children: "View 1"
59
70
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
60
- className: "view",
61
71
  children: "View 2"
62
72
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
63
- className: "view",
64
73
  children: "View 3"
65
74
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
66
- className: "view",
67
75
  children: "View 4"
68
76
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
69
- className: "view",
70
77
  children: "View 5"
71
78
  })]
72
79
  }));
73
80
  var expected = 1;
74
- var actual = subject.find('.view').length;
81
+
82
+ var actual = _react.screen.getAllByText(/View/).length;
83
+
75
84
  expect(actual).toBe(expected);
76
85
  });
77
86
  test('should render the child at {index}', function () {
78
- var subject = (0, _enzyme.mount)( /*#__PURE__*/(0, _jsxRuntime.jsxs)(_["default"], {
87
+ (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsxs)(_["default"], {
79
88
  index: 3,
80
89
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
81
- className: "view",
82
90
  children: "View 1"
83
91
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
84
- className: "view",
85
92
  children: "View 2"
86
93
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
87
- className: "view",
88
94
  children: "View 3"
89
95
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
90
- className: "view",
91
96
  children: "View 4"
92
97
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
93
- className: "view",
94
98
  children: "View 5"
95
99
  })]
96
100
  }));
97
- var expected = 'View 4';
98
- var actual = subject.find('.view').text();
99
- expect(actual).toBe(expected);
101
+
102
+ var actual = _react.screen.getByText('View 4');
103
+
104
+ expect(actual).toBeInTheDocument();
100
105
  });
101
106
  test('should have 1 child immediately after setting new {index} without an {arranger}', function () {
102
- var subject = (0, _enzyme.mount)( /*#__PURE__*/(0, _jsxRuntime.jsxs)(_["default"], {
107
+ var _render = (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsxs)(_["default"], {
108
+ "data-testid": "viewManager",
103
109
  index: 3,
104
110
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
105
- className: "view",
106
111
  children: "View 1"
107
112
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
108
- className: "view",
109
113
  children: "View 2"
110
114
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
111
- className: "view",
112
115
  children: "View 3"
113
116
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
114
- className: "view",
115
117
  children: "View 4"
116
118
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
117
- className: "view",
119
+ children: "View 5"
120
+ })]
121
+ })),
122
+ rerender = _render.rerender;
123
+
124
+ rerender( /*#__PURE__*/(0, _jsxRuntime.jsxs)(_["default"], {
125
+ "data-testid": "viewManager",
126
+ index: 4,
127
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
128
+ children: "View 1"
129
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
130
+ children: "View 2"
131
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
132
+ children: "View 3"
133
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
134
+ children: "View 4"
135
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
118
136
  children: "View 5"
119
137
  })]
120
138
  }));
121
- subject.setProps({
122
- index: 4
123
- });
124
139
  var expected = 1;
125
- var actual = subject.find('.view').length;
140
+
141
+ var actual = _react.screen.getByTestId('viewManager').children.length;
142
+
126
143
  expect(actual).toBe(expected);
127
144
  });
128
145
  test('should have 1 child immediately after setting new {index} with an {arranger} and {noAnimation} is false', function () {
129
- var subject = (0, _enzyme.mount)( /*#__PURE__*/(0, _jsxRuntime.jsxs)(_["default"], {
146
+ var _render2 = (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsxs)(_["default"], {
147
+ arranger: _testUtils.MockArranger,
148
+ "data-testid": "viewManager",
130
149
  index: 3,
150
+ noAnimation: true,
151
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
152
+ children: "View 1"
153
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
154
+ children: "View 2"
155
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
156
+ children: "View 3"
157
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
158
+ children: "View 4"
159
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
160
+ children: "View 5"
161
+ })]
162
+ })),
163
+ rerender = _render2.rerender;
164
+
165
+ rerender( /*#__PURE__*/(0, _jsxRuntime.jsxs)(_["default"], {
131
166
  arranger: _testUtils.MockArranger,
167
+ "data-testid": "viewManager",
168
+ index: 4,
132
169
  noAnimation: true,
133
170
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
134
- className: "view",
135
171
  children: "View 1"
136
172
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
137
- className: "view",
138
173
  children: "View 2"
139
174
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
140
- className: "view",
141
175
  children: "View 3"
142
176
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
143
- className: "view",
144
177
  children: "View 4"
145
178
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
146
- className: "view",
147
179
  children: "View 5"
148
180
  })]
149
181
  }));
150
- subject.setProps({
151
- index: 4
152
- });
153
182
  var expected = 1;
154
- var actual = subject.find('.view').length;
183
+
184
+ var actual = _react.screen.getByTestId('viewManager').children.length;
185
+
155
186
  expect(actual).toBe(expected);
156
187
  });
157
188
  test('should have 2 children immediately after setting new {index} with an {arranger}', function () {
158
- var subject = (0, _enzyme.mount)( /*#__PURE__*/(0, _jsxRuntime.jsxs)(_["default"], {
189
+ var _render3 = (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsxs)(_["default"], {
190
+ arranger: _testUtils.MockArranger,
191
+ "data-testid": "viewManager",
159
192
  index: 3,
193
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
194
+ children: "View 1"
195
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
196
+ children: "View 2"
197
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
198
+ children: "View 3"
199
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
200
+ children: "View 4"
201
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
202
+ children: "View 5"
203
+ })]
204
+ })),
205
+ rerender = _render3.rerender;
206
+
207
+ rerender( /*#__PURE__*/(0, _jsxRuntime.jsxs)(_["default"], {
160
208
  arranger: _testUtils.MockArranger,
209
+ "data-testid": "viewManager",
210
+ index: 4,
161
211
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
162
- className: "view",
163
212
  children: "View 1"
164
213
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
165
- className: "view",
166
214
  children: "View 2"
167
215
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
168
- className: "view",
169
216
  children: "View 3"
170
217
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
171
- className: "view",
172
218
  children: "View 4"
173
219
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
174
- className: "view",
175
220
  children: "View 5"
176
221
  })]
177
222
  }));
178
- subject.setProps({
179
- index: 4
180
- });
181
223
  var expected = 2;
182
- var actual = subject.find('.view').length;
224
+
225
+ var actual = _react.screen.getByTestId('viewManager').children.length;
226
+
183
227
  expect(actual).toBe(expected);
184
228
  });
185
229
  test('should allow child props to update', function () {
@@ -201,7 +245,7 @@ describe('ViewManager', function () {
201
245
  value: function render() {
202
246
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_["default"], {
203
247
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
204
- className: "view",
248
+ "data-testid": "view",
205
249
  children: this.props.content
206
250
  })
207
251
  });
@@ -209,55 +253,98 @@ describe('ViewManager', function () {
209
253
  }]);
210
254
 
211
255
  return ViewManagerTest;
212
- }(_react.Component);
256
+ }(_react2.Component);
213
257
 
214
- var subject = (0, _enzyme.mount)( /*#__PURE__*/(0, _jsxRuntime.jsx)(ViewManagerTest, {
258
+ var _render4 = (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(ViewManagerTest, {
215
259
  content: "original"
216
- }));
217
- subject.setProps({
260
+ })),
261
+ rerender = _render4.rerender;
262
+
263
+ rerender( /*#__PURE__*/(0, _jsxRuntime.jsx)(ViewManagerTest, {
218
264
  content: content
219
- });
265
+ }));
220
266
  var expected = content;
221
- var actual = subject.find('.view').text();
267
+
268
+ var actual = _react.screen.getByTestId('view').textContent;
269
+
222
270
  expect(actual).toBe(expected);
223
271
  });
224
272
  test('should have 1 child {duration}ms after setting new {index}', function (done) {
225
273
  var duration = 50;
226
- var subject = (0, _enzyme.mount)( /*#__PURE__*/(0, _jsxRuntime.jsxs)(_["default"], {
274
+
275
+ var _render5 = (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsxs)(_["default"], {
276
+ "data-testid": "viewManager",
277
+ duration: duration,
227
278
  index: 3,
279
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
280
+ children: "View 1"
281
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
282
+ children: "View 2"
283
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
284
+ children: "View 3"
285
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
286
+ children: "View 4"
287
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
288
+ children: "View 5"
289
+ })]
290
+ })),
291
+ rerender = _render5.rerender;
292
+
293
+ rerender( /*#__PURE__*/(0, _jsxRuntime.jsxs)(_["default"], {
294
+ "data-testid": "viewManager",
228
295
  duration: duration,
296
+ index: 4,
229
297
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
230
- className: "view",
231
298
  children: "View 1"
232
299
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
233
- className: "view",
234
300
  children: "View 2"
235
301
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
236
- className: "view",
237
302
  children: "View 3"
238
303
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
239
- className: "view",
240
304
  children: "View 4"
241
305
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
242
- className: "view",
243
306
  children: "View 5"
244
307
  })]
245
308
  }));
246
- subject.setProps({
247
- index: 4
248
- });
249
309
  window.setTimeout(function () {
250
310
  var expected = 1;
251
- var actual = subject.find('.view').length;
311
+
312
+ var actual = _react.screen.getByTestId('viewManager').children.length;
313
+
252
314
  expect(actual).toBe(expected);
253
315
  done();
254
316
  }, duration + 10);
255
317
  });
256
- test('should have size of 1 on TransitionGroup', function () {
257
- var subject = (0, _enzyme.mount)( /*#__PURE__*/(0, _jsxRuntime.jsxs)(_["default"], {
258
- noAnimation: true,
318
+ test('should have 1 child when noAnimation is true', function () {
319
+ (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsxs)(_["default"], {
320
+ "data-testid": "viewManager",
321
+ duration: 0,
259
322
  index: 0,
323
+ noAnimation: true,
324
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
325
+ children: "View 1"
326
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
327
+ children: "View 2"
328
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
329
+ children: "View 3"
330
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
331
+ children: "View 4"
332
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
333
+ children: "View 5"
334
+ })]
335
+ }));
336
+ var expected = 1;
337
+
338
+ var actual = _react.screen.getByTestId('viewManager').children.length;
339
+
340
+ expect(actual).toBe(expected);
341
+ }); // TODO cannot read props of child components
342
+
343
+ test.skip('should update the View reverseTransition prop.', function () {
344
+ var _render6 = (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsxs)(_["default"], {
260
345
  duration: 0,
346
+ index: 0,
347
+ noAnimation: true,
261
348
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
262
349
  className: "view",
263
350
  children: "View 1"
@@ -274,16 +361,14 @@ describe('ViewManager', function () {
274
361
  className: "view",
275
362
  children: "View 5"
276
363
  })]
277
- }));
278
- var expected = 1;
279
- var actual = subject.find('TransitionGroup').prop('size');
280
- expect(actual).toBe(expected);
281
- });
282
- test('should update the View reverseTransition prop.', function () {
283
- var subject = (0, _enzyme.mount)( /*#__PURE__*/(0, _jsxRuntime.jsxs)(_["default"], {
284
- noAnimation: true,
285
- index: 0,
364
+ })),
365
+ rerender = _render6.rerender;
366
+
367
+ rerender( /*#__PURE__*/(0, _jsxRuntime.jsxs)(_["default"], {
286
368
  duration: 0,
369
+ index: 0,
370
+ noAnimation: true,
371
+ reverseTransition: true,
287
372
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
288
373
  className: "view",
289
374
  children: "View 1"
@@ -300,18 +385,15 @@ describe('ViewManager', function () {
300
385
  className: "view",
301
386
  children: "View 5"
302
387
  })]
303
- }));
304
- subject.setProps({
305
- reverseTransition: true
306
- });
307
- var actual = subject.find('View').props().reverseTransition;
308
- expect(actual).toBeTruthy();
309
- });
310
- test('should update the View reverseTransition prop to true if it is updated with a smaller index prop.', function () {
311
- var subject = (0, _enzyme.mount)( /*#__PURE__*/(0, _jsxRuntime.jsxs)(_["default"], {
312
- index: 2,
313
- duration: 0,
388
+ })); // const actual = subject.find('View').props().reverseTransition;
389
+ // expect(actual).toBeTruthy();
390
+ }); // TODO cannot read props of child components
391
+
392
+ test.skip('should update the View reverseTransition prop to true if it is updated with a smaller index prop.', function () {
393
+ var _render7 = (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsxs)(_["default"], {
314
394
  arranger: _testUtils.MockArranger,
395
+ duration: 0,
396
+ index: 2,
315
397
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
316
398
  children: "View 1"
317
399
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
@@ -323,18 +405,33 @@ describe('ViewManager', function () {
323
405
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
324
406
  children: "View 5"
325
407
  })]
326
- }));
327
- subject.setProps({
328
- index: 1
329
- });
330
- var actual = subject.find('View').at(0).props().reverseTransition;
331
- expect(actual).toBeTruthy();
332
- });
333
- test('should update the View reverseTransition prop to false even though it is updated with a smaller index prop.', function () {
334
- var subject = (0, _enzyme.mount)( /*#__PURE__*/(0, _jsxRuntime.jsxs)(_["default"], {
335
- index: 2,
408
+ })),
409
+ rerender = _render7.rerender;
410
+
411
+ rerender( /*#__PURE__*/(0, _jsxRuntime.jsxs)(_["default"], {
412
+ arranger: _testUtils.MockArranger,
336
413
  duration: 0,
414
+ index: 1,
415
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
416
+ children: "View 1"
417
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
418
+ children: "View 2"
419
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
420
+ children: "View 3"
421
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
422
+ children: "View 4"
423
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
424
+ children: "View 5"
425
+ })]
426
+ })); // const actual = subject.find('View').at(0).props().reverseTransition;
427
+ // expect(actual).toBeTruthy();
428
+ }); // TODO cannot read props of child components
429
+
430
+ test.skip('should update the View reverseTransition prop to false even though it is updated with a smaller index prop.', function () {
431
+ var _render8 = (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsxs)(_["default"], {
337
432
  arranger: _testUtils.MockArranger,
433
+ duration: 0,
434
+ index: 2,
338
435
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
339
436
  children: "View 1"
340
437
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
@@ -342,53 +439,91 @@ describe('ViewManager', function () {
342
439
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
343
440
  children: "View 3"
344
441
  })]
345
- }));
346
- subject.setProps({
442
+ })),
443
+ rerender = _render8.rerender;
444
+
445
+ rerender( /*#__PURE__*/(0, _jsxRuntime.jsxs)(_["default"], {
446
+ arranger: _testUtils.MockArranger,
447
+ duration: 0,
347
448
  index: 1,
348
- reverseTransition: false
349
- });
350
- var actual = subject.find('View').at(0).props().reverseTransition;
351
- expect(actual).toBeFalsy();
449
+ reverseTransition: false,
450
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
451
+ children: "View 1"
452
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
453
+ children: "View 2"
454
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
455
+ children: "View 3"
456
+ })]
457
+ })); // const actual = subject.find('View').at(0).props().reverseTransition;
458
+ // expect(actual).toBeFalsy();
352
459
  });
353
460
  test('should update the view when children are reordered', function () {
354
- var subject = (0, _enzyme.mount)( /*#__PURE__*/(0, _jsxRuntime.jsxs)(_["default"], {
461
+ var _render9 = (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsxs)(_["default"], {
355
462
  index: 1,
356
463
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
357
464
  children: "View 1"
358
465
  }, "view1"), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
359
466
  children: "View 2"
360
467
  }, "view2")]
361
- }));
362
- expect(subject.find('View div').prop('children')).toBe('View 2');
363
- subject.setProps({
468
+ })),
469
+ rerender = _render9.rerender;
470
+
471
+ expect(_react.screen.getByText('View 2')).toBeInTheDocument();
472
+ rerender( /*#__PURE__*/(0, _jsxRuntime.jsxs)(_["default"], {
473
+ index: 1,
364
474
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
365
475
  children: "View 2"
366
476
  }, "view2"), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
367
477
  children: "View 1"
368
478
  }, "view1")]
369
- });
370
- expect(subject.find('View div').prop('children')).toBe('View 1');
479
+ }));
480
+ expect(_react.screen.getByText('View 1')).toBeInTheDocument();
371
481
  });
372
482
  test('should update the view when children are replaced', function () {
373
- var subject = (0, _enzyme.mount)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_["default"], {
483
+ var _render10 = (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_["default"], {
374
484
  index: 0,
375
485
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
376
486
  children: "View 1"
377
487
  }, "view1")
378
- }));
379
- expect(subject.find('View div').prop('children')).toBe('View 1');
380
- subject.setProps({
381
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
488
+ })),
489
+ rerender = _render10.rerender;
490
+
491
+ expect(_react.screen.getByText('View 1')).toBeInTheDocument();
492
+ rerender( /*#__PURE__*/(0, _jsxRuntime.jsx)(_["default"], {
493
+ index: 0,
494
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
382
495
  children: "View 2"
383
- }, "view2")]
384
- });
385
- expect(subject.find('View div').prop('children')).toBe('View 2');
496
+ }, "view2")
497
+ }));
498
+ expect(_react.screen.getByText('View 2')).toBeInTheDocument();
386
499
  });
387
500
  test('should update the number of views when {start} updates', function () {
388
- var subject = (0, _enzyme.mount)( /*#__PURE__*/(0, _jsxRuntime.jsxs)(_["default"], {
501
+ var _render11 = (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsxs)(_["default"], {
502
+ "data-testid": "viewManager",
503
+ end: 3,
389
504
  index: 3,
390
505
  start: 2,
506
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
507
+ children: "View 1"
508
+ }, "view1"), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
509
+ children: "View 2"
510
+ }, "view2"), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
511
+ children: "View 3"
512
+ }, "view3"), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
513
+ children: "View 4"
514
+ }, "view4")]
515
+ })),
516
+ rerender = _render11.rerender;
517
+
518
+ var children = _react.screen.getByTestId('viewManager').children;
519
+
520
+ expect(children).toHaveLength(2);
521
+ expect(children.item(0)).toHaveTextContent('View 3');
522
+ rerender( /*#__PURE__*/(0, _jsxRuntime.jsxs)(_["default"], {
523
+ "data-testid": "viewManager",
391
524
  end: 3,
525
+ index: 3,
526
+ start: 1,
392
527
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
393
528
  children: "View 1"
394
529
  }, "view1"), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
@@ -399,19 +534,15 @@ describe('ViewManager', function () {
399
534
  children: "View 4"
400
535
  }, "view4")]
401
536
  }));
402
- expect(subject.find('View')).toHaveLength(2);
403
- expect(subject.find('View div').at(0).prop('children')).toBe('View 3');
404
- subject.setProps({
405
- start: 1
406
- });
407
- expect(subject.find('View')).toHaveLength(3);
408
- expect(subject.find('View div').at(0).prop('children')).toBe('View 2');
537
+ expect(children).toHaveLength(3);
538
+ expect(children.item(0)).toHaveTextContent('View 2');
409
539
  });
410
540
  test('should update the active view when {start}, {end}, and {index} update', function () {
411
- var subject = (0, _enzyme.mount)( /*#__PURE__*/(0, _jsxRuntime.jsxs)(_["default"], {
541
+ var _render12 = (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsxs)(_["default"], {
542
+ "data-testid": "viewManager",
543
+ end: 3,
412
544
  index: 3,
413
545
  start: 3,
414
- end: 3,
415
546
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
416
547
  children: "View 1"
417
548
  }, "view1"), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
@@ -421,22 +552,42 @@ describe('ViewManager', function () {
421
552
  }, "view3"), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
422
553
  children: "View 4"
423
554
  }, "view4")]
424
- }));
425
- expect(subject.find('View')).toHaveLength(1);
426
- expect(subject.find('View div').prop('children')).toBe('View 4');
427
- subject.setProps({
428
- start: 2,
555
+ })),
556
+ rerender = _render12.rerender;
557
+
558
+ var children = _react.screen.getByTestId('viewManager').children;
559
+
560
+ var expected = 1;
561
+ expect(children).toHaveLength(expected);
562
+ expect(_react.screen.getByTestId('viewManager')).toHaveTextContent('View 4');
563
+ rerender( /*#__PURE__*/(0, _jsxRuntime.jsxs)(_["default"], {
564
+ "data-testid": "viewManager",
429
565
  end: 2,
430
- index: 2
431
- });
432
- expect(subject.find('View')).toHaveLength(1);
433
- expect(subject.find('View div').prop('children')).toBe('View 3');
566
+ index: 2,
567
+ start: 2,
568
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
569
+ children: "View 1"
570
+ }, "view1"), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
571
+ children: "View 2"
572
+ }, "view2"), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
573
+ children: "View 3"
574
+ }, "view3"), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
575
+ children: "View 4"
576
+ }, "view4")]
577
+ }));
578
+
579
+ var newChildren = _react.screen.getByTestId('viewManager').children;
580
+
581
+ var newExpected = 1;
582
+ expect(newChildren).toHaveLength(newExpected);
583
+ expect(_react.screen.getByTestId('viewManager')).toHaveTextContent('View 3');
434
584
  });
435
585
  test('should extend the view range when {index} is less than {start}', function () {
436
- var subject = (0, _enzyme.mount)( /*#__PURE__*/(0, _jsxRuntime.jsxs)(_["default"], {
586
+ (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsxs)(_["default"], {
587
+ "data-testid": "viewManager",
588
+ end: 3,
437
589
  index: 1,
438
590
  start: 2,
439
- end: 3,
440
591
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
441
592
  children: "View 1"
442
593
  }, "view1"), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
@@ -447,13 +598,17 @@ describe('ViewManager', function () {
447
598
  children: "View 4"
448
599
  }, "view4")]
449
600
  }));
450
- expect(subject.find('View')).toHaveLength(3);
601
+
602
+ var children = _react.screen.getByTestId('viewManager').children;
603
+
604
+ var expected = 3;
605
+ expect(children).toHaveLength(expected);
451
606
  });
452
607
  test('should extend the view range when {index} is greater than {end}', function () {
453
- var subject = (0, _enzyme.mount)( /*#__PURE__*/(0, _jsxRuntime.jsxs)(_["default"], {
608
+ (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsxs)(_["default"], {
609
+ end: 2,
454
610
  index: 3,
455
611
  start: 1,
456
- end: 2,
457
612
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
458
613
  children: "View 1"
459
614
  }, "view1"), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
@@ -464,12 +619,99 @@ describe('ViewManager', function () {
464
619
  children: "View 4"
465
620
  }, "view4")]
466
621
  }));
467
- expect(subject.find('View')).toHaveLength(3);
622
+
623
+ var children = _react.screen.getAllByText(/View/);
624
+
625
+ var expected = 3;
626
+ expect(children).toHaveLength(expected);
468
627
  });
628
+ test('should fire onEnter with type once a view has entered', function () {
629
+ var spy = jest.fn();
630
+
631
+ var _render13 = (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsxs)(_["default"], {
632
+ index: 0,
633
+ noAnimation: true,
634
+ onEnter: spy,
635
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
636
+ children: "View 1"
637
+ }, "view1"), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
638
+ children: "View 2"
639
+ }, "view2")]
640
+ })),
641
+ rerender = _render13.rerender;
642
+
643
+ spy.mockClear();
644
+ rerender( /*#__PURE__*/(0, _jsxRuntime.jsxs)(_["default"], {
645
+ index: 1,
646
+ onEnter: spy,
647
+ noAnimation: true,
648
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
649
+ children: "View 1"
650
+ }, "view1"), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
651
+ children: "View 2"
652
+ }, "view2")]
653
+ }));
654
+ var expected = 1;
655
+ var expectedType = {
656
+ type: 'onEnter'
657
+ };
658
+ var actual = spy.mock.calls.length && spy.mock.calls[0][0];
659
+ expect(spy).toHaveBeenCalledTimes(expected);
660
+ expect(actual).toMatchObject(expectedType);
661
+ });
662
+ test('should fire onAppear with type once a view has appeared', /*#__PURE__*/_asyncToGenerator(function* () {
663
+ var spy = jest.fn();
664
+
665
+ var _render14 = (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsxs)(_["default"], {
666
+ index: 0,
667
+ noAnimation: true,
668
+ onAppear: spy,
669
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
670
+ children: "View 1"
671
+ }, "view1"), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
672
+ children: "View 2"
673
+ }, "view2")]
674
+ })),
675
+ rerender = _render14.rerender;
676
+
677
+ rerender( /*#__PURE__*/(0, _jsxRuntime.jsxs)(_["default"], {
678
+ index: 1,
679
+ onAppear: spy,
680
+ noAnimation: true,
681
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
682
+ children: "View 1"
683
+ }, "view1"), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
684
+ children: "View 2"
685
+ }, "view2")]
686
+ }));
687
+ yield (0, _react.waitFor)(function () {
688
+ var expected = 1;
689
+ var expectedType = {
690
+ type: 'onAppear'
691
+ };
692
+ var actual = spy.mock.calls.length && spy.mock.calls[0][0];
693
+ expect(spy).toHaveBeenCalledTimes(expected);
694
+ expect(actual).toMatchObject(expectedType);
695
+ });
696
+ }));
469
697
  test('should fire onTransition once per transition', function () {
470
698
  var spy = jest.fn();
471
- var subject = (0, _enzyme.mount)( /*#__PURE__*/(0, _jsxRuntime.jsxs)(_["default"], {
699
+
700
+ var _render15 = (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsxs)(_["default"], {
472
701
  index: 0,
702
+ noAnimation: true,
703
+ onTransition: spy,
704
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
705
+ children: "View 1"
706
+ }, "view1"), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
707
+ children: "View 2"
708
+ }, "view2")]
709
+ })),
710
+ rerender = _render15.rerender;
711
+
712
+ spy.mockClear();
713
+ rerender( /*#__PURE__*/(0, _jsxRuntime.jsxs)(_["default"], {
714
+ index: 1,
473
715
  onTransition: spy,
474
716
  noAnimation: true,
475
717
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
@@ -478,18 +720,15 @@ describe('ViewManager', function () {
478
720
  children: "View 2"
479
721
  }, "view2")]
480
722
  }));
481
- spy.mockClear();
482
- subject.setProps({
483
- index: 1
484
- });
485
- expect(spy).toHaveBeenCalledTimes(1);
723
+ var expected = 1;
724
+ expect(spy).toHaveBeenCalledTimes(expected);
486
725
  });
487
- it('should not receive onTransition event on mount', function () {
726
+ test('should not receive onTransition event on mount', function () {
488
727
  var spy = jest.fn();
489
- (0, _enzyme.mount)( /*#__PURE__*/(0, _jsxRuntime.jsxs)(_["default"], {
728
+ (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsxs)(_["default"], {
490
729
  index: 0,
491
- onTransition: spy,
492
730
  noAnimation: true,
731
+ onTransition: spy,
493
732
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
494
733
  children: "View 1"
495
734
  }, "view1"), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
@@ -497,13 +736,26 @@ describe('ViewManager', function () {
497
736
  }, "view2")]
498
737
  }));
499
738
  var expected = 0;
500
- var actual = spy.mock.calls.length;
501
- expect(actual).toBe(expected);
739
+ expect(spy).toHaveBeenCalledTimes(expected);
502
740
  });
503
741
  test('should include the current index and previous index in onTransition event payload', function () {
504
742
  var spy = jest.fn();
505
- var subject = (0, _enzyme.mount)( /*#__PURE__*/(0, _jsxRuntime.jsxs)(_["default"], {
743
+
744
+ var _render16 = (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsxs)(_["default"], {
506
745
  index: 0,
746
+ noAnimation: true,
747
+ onTransition: spy,
748
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
749
+ children: "View 1"
750
+ }, "view1"), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
751
+ children: "View 2"
752
+ }, "view2")]
753
+ })),
754
+ rerender = _render16.rerender;
755
+
756
+ spy.mockClear();
757
+ rerender( /*#__PURE__*/(0, _jsxRuntime.jsxs)(_["default"], {
758
+ index: 1,
507
759
  onTransition: spy,
508
760
  noAnimation: true,
509
761
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
@@ -512,26 +764,44 @@ describe('ViewManager', function () {
512
764
  children: "View 2"
513
765
  }, "view2")]
514
766
  }));
515
- spy.mockClear();
516
- subject.setProps({
517
- index: 1
518
- });
519
767
  expect(spy).toHaveBeenLastCalledWith({
520
768
  index: 1,
521
- previousIndex: 0
522
- });
523
- subject.setProps({
524
- index: 0
769
+ previousIndex: 0,
770
+ type: 'onTransition'
525
771
  });
772
+ rerender( /*#__PURE__*/(0, _jsxRuntime.jsxs)(_["default"], {
773
+ index: 0,
774
+ onTransition: spy,
775
+ noAnimation: true,
776
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
777
+ children: "View 1"
778
+ }, "view1"), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
779
+ children: "View 2"
780
+ }, "view2")]
781
+ }));
526
782
  expect(spy).toHaveBeenLastCalledWith({
527
783
  index: 0,
528
- previousIndex: 1
784
+ previousIndex: 1,
785
+ type: 'onTransition'
529
786
  });
530
787
  });
531
788
  test('should fire onWillTransition once per transition', function () {
532
789
  var spy = jest.fn();
533
- var subject = (0, _enzyme.mount)( /*#__PURE__*/(0, _jsxRuntime.jsxs)(_["default"], {
790
+
791
+ var _render17 = (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsxs)(_["default"], {
534
792
  index: 0,
793
+ noAnimation: true,
794
+ onWillTransition: spy,
795
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
796
+ children: "View 1"
797
+ }, "view1"), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
798
+ children: "View 2"
799
+ }, "view2")]
800
+ })),
801
+ rerender = _render17.rerender;
802
+
803
+ rerender( /*#__PURE__*/(0, _jsxRuntime.jsxs)(_["default"], {
804
+ index: 1,
535
805
  onWillTransition: spy,
536
806
  noAnimation: true,
537
807
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
@@ -540,15 +810,25 @@ describe('ViewManager', function () {
540
810
  children: "View 2"
541
811
  }, "view2")]
542
812
  }));
543
- subject.setProps({
544
- index: 1
545
- });
546
813
  expect(spy).toHaveBeenCalledTimes(1);
547
814
  });
548
815
  test('should include the current index and previous index in onWillTransition event payload', function () {
549
816
  var spy = jest.fn();
550
- var subject = (0, _enzyme.mount)( /*#__PURE__*/(0, _jsxRuntime.jsxs)(_["default"], {
817
+
818
+ var _render18 = (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsxs)(_["default"], {
551
819
  index: 0,
820
+ noAnimation: true,
821
+ onWillTransition: spy,
822
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
823
+ children: "View 1"
824
+ }, "view1"), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
825
+ children: "View 2"
826
+ }, "view2")]
827
+ })),
828
+ rerender = _render18.rerender;
829
+
830
+ rerender( /*#__PURE__*/(0, _jsxRuntime.jsxs)(_["default"], {
831
+ index: 1,
552
832
  onWillTransition: spy,
553
833
  noAnimation: true,
554
834
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
@@ -557,24 +837,30 @@ describe('ViewManager', function () {
557
837
  children: "View 2"
558
838
  }, "view2")]
559
839
  }));
560
- subject.setProps({
561
- index: 1
562
- });
563
840
  expect(spy).toHaveBeenLastCalledWith({
564
841
  index: 1,
565
- previousIndex: 0
566
- });
567
- subject.setProps({
568
- index: 0
842
+ previousIndex: 0,
843
+ type: 'onWillTransition'
569
844
  });
845
+ rerender( /*#__PURE__*/(0, _jsxRuntime.jsxs)(_["default"], {
846
+ index: 0,
847
+ onWillTransition: spy,
848
+ noAnimation: true,
849
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
850
+ children: "View 1"
851
+ }, "view1"), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
852
+ children: "View 2"
853
+ }, "view2")]
854
+ }));
570
855
  expect(spy).toHaveBeenLastCalledWith({
571
856
  index: 0,
572
- previousIndex: 1
857
+ previousIndex: 1,
858
+ type: 'onWillTransition'
573
859
  });
574
860
  });
575
861
  test('should pass `rtl` prop to arranger when `true`', function () {
576
862
  var spy = jest.spyOn(_testUtils.MockArranger, 'stay');
577
- (0, _enzyme.mount)( /*#__PURE__*/(0, _jsxRuntime.jsxs)(_["default"], {
863
+ (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsxs)(_["default"], {
578
864
  arranger: _testUtils.MockArranger,
579
865
  index: 0,
580
866
  rtl: true,
@@ -593,7 +879,7 @@ describe('ViewManager', function () {
593
879
  });
594
880
  test('should pass `rtl` prop to arranger when unset', function () {
595
881
  var spy = jest.spyOn(_testUtils.MockArranger, 'stay');
596
- (0, _enzyme.mount)( /*#__PURE__*/(0, _jsxRuntime.jsxs)(_["default"], {
882
+ (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsxs)(_["default"], {
597
883
  arranger: _testUtils.MockArranger,
598
884
  index: 0,
599
885
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {