@enact/ui 4.5.2 → 4.6.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.
- package/AnnounceDecorator/Announce.js +1 -40
- package/AnnounceDecorator/AnnounceDecorator.js +3 -21
- package/AnnounceDecorator/tests/Announce-specs.js +2 -7
- package/AnnounceDecorator/tests/AnnounceDecorator-specs.js +2 -6
- package/AnnounceDecorator/tests/useAnnounce-specs.js +8 -19
- package/AnnounceDecorator/useAnnounce.js +0 -6
- package/BodyText/BodyText.js +8 -28
- package/BodyText/tests/BodyText-specs.js +0 -19
- package/Button/Button.js +33 -63
- package/Button/tests/Button-specs.js +0 -26
- package/CHANGELOG.md +45 -0
- package/Cancelable/Cancelable.js +8 -47
- package/Cancelable/cancelHandler.js +5 -12
- package/Cancelable/modalHandler.js +3 -11
- package/Cancelable/tests/Cancelable-specs.js +3 -57
- package/Changeable/Changeable.js +2 -34
- package/Changeable/tests/Changeable-specs.js +20 -66
- package/ComponentOverride/ComponentOverride.js +1 -13
- package/FloatingLayer/FloatingLayer.js +17 -73
- package/FloatingLayer/FloatingLayerContainer.js +0 -15
- package/FloatingLayer/FloatingLayerDecorator.js +4 -17
- package/FloatingLayer/Scrim.js +9 -53
- package/FloatingLayer/index.js +0 -4
- package/FloatingLayer/package.json +3 -0
- package/FloatingLayer/tests/FloatingLayer-specs.js +8 -22
- package/FloatingLayer/tests/Scrim-specs.js +0 -9
- package/FloatingLayer/tests/useFloatingLayerDecorator-specs.js +0 -13
- package/FloatingLayer/useFloatingLayer.js +3 -14
- package/FloatingLayer/useFloatingLayerDecorator.js +3 -11
- package/ForwardRef/ForwardRef.js +1 -10
- package/GridListImageItem/GridListImageItem.js +18 -51
- package/Group/Group.js +5 -36
- package/Group/GroupItem.js +16 -33
- package/Group/tests/Group-specs.js +0 -32
- package/Heading/Heading.js +8 -36
- package/Heading/tests/Heading-specs.js +81 -14
- package/Icon/Icon.js +19 -53
- package/Icon/tests/Icon-specs.js +0 -22
- package/IconButton/IconButton.js +24 -57
- package/IconButton/tests/IconButton-specs.js +0 -7
- package/Image/Image.js +17 -46
- package/Image/tests/Image-specs.js +0 -14
- package/ImageItem/ImageItem.js +18 -47
- package/ImageItem/tests/ImageItem-specs.js +0 -25
- package/Item/Item.js +9 -33
- package/Item/tests/Item-specs.js +0 -24
- package/LabeledIcon/LabeledIcon.js +22 -53
- package/LabeledIcon/tests/LabeledIcon-specs.js +0 -14
- package/Layout/Cell.js +18 -44
- package/Layout/Layout.js +23 -46
- package/Layout/tests/Layout-specs.js +10 -39
- package/Marquee/MarqueeBase.js +29 -63
- package/Marquee/MarqueeController.js +11 -72
- package/Marquee/MarqueeDecorator.js +70 -196
- package/Marquee/index.js +1 -5
- package/Marquee/tests/Marquee-specs.js +295 -87
- package/Measurable/Measurable.js +12 -34
- package/Measurable/tests/Measurable-specs.js +115 -0
- package/Media/Media.js +15 -65
- package/Media/tests/Media-specs.js +168 -0
- package/Placeholder/PlaceholderControllerDecorator.js +7 -43
- package/Placeholder/PlaceholderDecorator.js +7 -38
- package/Placeholder/index.js +1 -5
- package/Placeholder/tests/PlaceholderControllerDecorator-specs.js +25 -0
- package/Placeholder/tests/PlaceholderDecorator-specs.js +28 -0
- package/ProgressBar/ProgressBar.js +14 -45
- package/ProgressBar/tests/ProgressBar-specs.js +0 -17
- package/RadioDecorator/RadioControllerDecorator.js +7 -29
- package/RadioDecorator/RadioDecorator.js +9 -42
- package/RadioDecorator/tests/RadioDecorator-specs.js +12 -49
- package/Repeater/Repeater.js +9 -33
- package/Repeater/tests/Repeater-specs.js +0 -38
- package/Resizable/Resizable.js +9 -37
- package/Resizable/tests/Resizable-specs.js +34 -0
- package/Routable/Link.js +11 -47
- package/Routable/Routable.js +12 -35
- package/Routable/Route.js +0 -6
- package/Routable/Router.js +15 -58
- package/Routable/tests/Routable-specs.js +7 -33
- package/Routable/tests/Router-specs.js +18 -44
- package/Routable/useLink.js +4 -8
- package/Routable/util.js +18 -24
- package/Scrollable/ScrollAnimator.js +49 -65
- package/Scrollable/ScrollThumb.js +2 -13
- package/Scrollable/Scrollable.js +180 -387
- package/Scrollable/ScrollableNative.js +189 -392
- package/Scrollable/Scrollbar.js +30 -102
- package/Scroller/Scroller.js +15 -39
- package/Scroller/ScrollerBasic.js +34 -89
- package/Scroller/UiScrollerBase.js +37 -84
- package/Scroller/tests/Scroller-specs.js +56 -0
- package/Skinnable/Skinnable.js +11 -38
- package/Skinnable/tests/Skinnable-specs.js +3 -74
- package/Skinnable/tests/useSkins-specs.js +1 -13
- package/Skinnable/tests/util-specs.js +0 -14
- package/Skinnable/useSkins.js +8 -15
- package/Skinnable/util.js +9 -20
- package/Slider/Knob.js +5 -24
- package/Slider/PositionDecorator.js +16 -54
- package/Slider/Slider.js +29 -67
- package/Slider/tests/Slider-specs.js +94 -7
- package/Slider/utils.js +0 -2
- package/SlotItem/SlotItem.js +23 -45
- package/SlotItem/tests/SlotItem-specs.js +0 -5
- package/Slottable/Slottable.js +4 -12
- package/Slottable/tests/Slottable-specs.js +19 -46
- package/Slottable/tests/useSlots-specs.js +27 -65
- package/Slottable/useSlots.js +8 -33
- package/Spinner/Spinner.js +16 -43
- package/Spinner/tests/Spinner-specs.js +0 -15
- package/ToggleIcon/ToggleIcon.js +10 -36
- package/ToggleIcon/tests/ToggleIcon-specs.js +0 -16
- package/ToggleItem/ToggleItem.js +24 -57
- package/ToggleItem/tests/ToggleItem-specs.js +0 -30
- package/Toggleable/Toggle.js +1 -15
- package/Toggleable/Toggleable.js +12 -45
- package/Toggleable/tests/Toggleable-specs.js +28 -96
- package/Toggleable/useToggle.js +3 -19
- package/Touchable/ClickAllow.js +5 -14
- package/Touchable/Drag.js +16 -54
- package/Touchable/Flick.js +11 -42
- package/Touchable/Hold.js +21 -68
- package/Touchable/Pinch.js +185 -0
- package/Touchable/Touch.js +71 -76
- package/Touchable/Touchable.js +95 -75
- package/Touchable/config.js +27 -24
- package/Touchable/tests/Touchable-specs.js +360 -119
- package/Touchable/tests/useTouch-specs.js +6 -80
- package/Touchable/useTouch.js +57 -65
- package/Transition/Transition.js +37 -118
- package/Transition/tests/Transition-specs.js +20 -60
- package/ViewManager/Arranger.js +10 -22
- package/ViewManager/TransitionGroup.js +32 -107
- package/ViewManager/View.js +35 -91
- package/ViewManager/ViewManager.js +20 -84
- package/ViewManager/tests/View-specs.js +0 -17
- package/ViewManager/tests/ViewManager-specs.js +236 -305
- package/ViewManager/tests/test-utils.js +0 -8
- package/VirtualList/UiVirtualListBase.js +265 -409
- package/VirtualList/VirtualList.js +29 -69
- package/VirtualList/VirtualListBase.js +0 -3
- package/VirtualList/VirtualListBasic.js +273 -431
- package/VirtualList/tests/VirtualGridList-native-specs.js +161 -0
- package/VirtualList/tests/VirtualGridList-specs.js +614 -0
- package/VirtualList/tests/VirtualList-native-specs.js +152 -0
- package/VirtualList/tests/VirtualList-specs.js +423 -95
- package/internal/IdProvider/IdProvider.js +7 -21
- package/internal/IdProvider/Provider.js +4 -17
- package/internal/IdProvider/tests/IdProvider-specs.js +44 -0
- package/internal/IdProvider/tests/useId-specs.js +6 -20
- package/internal/IdProvider/useId.js +0 -6
- package/internal/Pure/Pure.js +3 -30
- package/internal/Pure/tests/Pure-specs.js +88 -0
- package/internal/localized-fonts/localized-fonts.js +33 -62
- package/internal/localized-fonts/tests/localized-fonts-specs.js +33 -0
- package/internal/selection/selection.js +1 -6
- package/internal/selection/tests/selection-specs.js +6 -4
- package/internal/validators/tests/validators-specs.js +80 -0
- package/internal/validators/validators.js +14 -34
- package/package.json +9 -3
- package/resolution/ResolutionDecorator.js +4 -40
- package/resolution/index.js +0 -7
- package/resolution/resolution.js +42 -80
- package/resolution/tests/ResolutionDecorator-specs.js +4 -11
- package/resolution/tests/resolution-specs.js +2 -2
- package/useControlledState/tests/useControlledState-specs.js +15 -46
- package/useControlledState/useControlledState.js +11 -22
- package/useScroll/ScrollAnimator.js +49 -65
- package/useScroll/Scrollbar.js +22 -58
- package/useScroll/ScrollbarTrack.js +3 -19
- package/useScroll/useScroll.js +267 -454
- package/useScroll/utilDOM.js +8 -14
- package/useScroll/utilEvent.js +0 -4
- package/AnnounceDecorator/AnnounceDecorator.d.ts +0 -64
- package/BodyText/BodyText.d.ts +0 -66
- package/Button/Button.d.ts +0 -125
- package/Cancelable/Cancelable.d.ts +0 -64
- package/Changeable/Changeable.d.ts +0 -54
- package/ComponentOverride/ComponentOverride.d.ts +0 -52
- package/ForwardRef/ForwardRef.d.ts +0 -22
- package/GridListImageItem/GridListImageItem.d.ts +0 -85
- package/Group/Group.d.ts +0 -107
- package/Heading/Heading.d.ts +0 -90
- package/Icon/Icon.d.ts +0 -88
- package/IconButton/IconButton.d.ts +0 -115
- package/Image/Image.d.ts +0 -113
- package/ImageItem/ImageItem.d.ts +0 -83
- package/Item/Item.d.ts +0 -64
- package/LabeledIcon/LabeledIcon.d.ts +0 -130
- package/Layout/Layout.d.ts +0 -247
- package/Marquee/index.d.ts +0 -258
- package/Measurable/Measurable.d.ts +0 -26
- package/Media/Media.d.ts +0 -99
- package/Placeholder/index.d.ts +0 -53
- package/ProgressBar/ProgressBar.d.ts +0 -92
- package/RadioDecorator/RadioDecorator.d.ts +0 -35
- package/Repeater/Repeater.d.ts +0 -83
- package/Resizable/Resizable.d.ts +0 -31
- package/Routable/Routable.d.ts +0 -148
- package/Scrollable/Scrollable.d.ts +0 -0
- package/Scroller/Scroller.d.ts +0 -276
- package/Skinnable/Skinnable.d.ts +0 -94
- package/Slider/Slider.d.ts +0 -202
- package/SlotItem/SlotItem.d.ts +0 -118
- package/Slottable/Slottable.d.ts +0 -22
- package/Spinner/Spinner.d.ts +0 -95
- package/ToggleIcon/ToggleIcon.d.ts +0 -90
- package/ToggleItem/ToggleItem.d.ts +0 -134
- package/Toggleable/Toggleable.d.ts +0 -103
- package/Touchable/Touchable.d.ts +0 -175
- package/Transition/Transition.d.ts +0 -196
- package/ViewManager/ViewManager.d.ts +0 -191
- package/VirtualList/VirtualList.d.ts +0 -530
- package/index.d.ts +0 -0
- package/internal/IdProvider/IdProvider.d.ts +0 -0
- package/internal/Pure/Pure.d.ts +0 -0
- package/internal/localized-fonts/localized-fonts.d.ts +0 -53
- package/internal/selection/selection.d.ts +0 -0
- package/internal/validators/validators.d.ts +0 -0
- package/resolution/index.d.ts +0 -187
- package/useControlledState/useControlledState.d.ts +0 -0
- package/useScroll/useScroll.d.ts +0 -0
|
@@ -1,43 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
require("@testing-library/jest-dom");
|
|
4
|
-
|
|
5
4
|
var _react = require("@testing-library/react");
|
|
6
|
-
|
|
7
5
|
var _react2 = require("react");
|
|
8
|
-
|
|
9
6
|
var _ = _interopRequireDefault(require("../"));
|
|
10
|
-
|
|
11
7
|
var _testUtils = require("./test-utils");
|
|
12
|
-
|
|
13
8
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
14
|
-
|
|
15
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
16
|
-
|
|
17
10
|
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
11
|
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
|
-
|
|
21
12
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
22
|
-
|
|
23
13
|
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); } }
|
|
24
|
-
|
|
25
14
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
26
|
-
|
|
27
15
|
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
28
|
-
|
|
29
16
|
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
30
|
-
|
|
31
17
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
32
|
-
|
|
33
18
|
function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
34
|
-
|
|
35
19
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
36
|
-
|
|
37
20
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
38
|
-
|
|
39
21
|
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
40
|
-
|
|
41
22
|
describe('ViewManager', function () {
|
|
42
23
|
// Suite-wide setup
|
|
43
24
|
beforeEach(function () {
|
|
@@ -52,9 +33,7 @@ describe('ViewManager', function () {
|
|
|
52
33
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {})
|
|
53
34
|
}));
|
|
54
35
|
var expected = 'DIV';
|
|
55
|
-
|
|
56
36
|
var actual = _react.screen.getByTestId('component').tagName;
|
|
57
|
-
|
|
58
37
|
expect(actual).toBe(expected);
|
|
59
38
|
});
|
|
60
39
|
test('should render {component} as its child', function () {
|
|
@@ -64,9 +43,7 @@ describe('ViewManager', function () {
|
|
|
64
43
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {})
|
|
65
44
|
}));
|
|
66
45
|
var expected = 'SPAN';
|
|
67
|
-
|
|
68
46
|
var actual = _react.screen.getByTestId('component').tagName;
|
|
69
|
-
|
|
70
47
|
expect(actual).toBe(expected);
|
|
71
48
|
});
|
|
72
49
|
test('should render only 1 child view', function () {
|
|
@@ -84,9 +61,7 @@ describe('ViewManager', function () {
|
|
|
84
61
|
})]
|
|
85
62
|
}));
|
|
86
63
|
var expected = 1;
|
|
87
|
-
|
|
88
64
|
var actual = _react.screen.getAllByText(/View/).length;
|
|
89
|
-
|
|
90
65
|
expect(actual).toBe(expected);
|
|
91
66
|
});
|
|
92
67
|
test('should render the child at {index}', function () {
|
|
@@ -104,29 +79,26 @@ describe('ViewManager', function () {
|
|
|
104
79
|
children: "View 5"
|
|
105
80
|
})]
|
|
106
81
|
}));
|
|
107
|
-
|
|
108
82
|
var actual = _react.screen.getByText('View 4');
|
|
109
|
-
|
|
110
83
|
expect(actual).toBeInTheDocument();
|
|
111
84
|
});
|
|
112
85
|
test('should have 1 child immediately after setting new {index} without an {arranger}', function () {
|
|
113
86
|
var _render = (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsxs)(_["default"], {
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
87
|
+
"data-testid": "viewManager",
|
|
88
|
+
index: 3,
|
|
89
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
90
|
+
children: "View 1"
|
|
91
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
92
|
+
children: "View 2"
|
|
93
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
94
|
+
children: "View 3"
|
|
95
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
96
|
+
children: "View 4"
|
|
97
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
98
|
+
children: "View 5"
|
|
99
|
+
})]
|
|
100
|
+
})),
|
|
101
|
+
rerender = _render.rerender;
|
|
130
102
|
rerender( /*#__PURE__*/(0, _jsxRuntime.jsxs)(_["default"], {
|
|
131
103
|
"data-testid": "viewManager",
|
|
132
104
|
index: 4,
|
|
@@ -143,31 +115,28 @@ describe('ViewManager', function () {
|
|
|
143
115
|
})]
|
|
144
116
|
}));
|
|
145
117
|
var expected = 1;
|
|
146
|
-
|
|
147
118
|
var actual = _react.screen.getByTestId('viewManager').children.length;
|
|
148
|
-
|
|
149
119
|
expect(actual).toBe(expected);
|
|
150
120
|
});
|
|
151
121
|
test('should have 1 child immediately after setting new {index} with an {arranger} and {noAnimation} is true', function () {
|
|
152
122
|
var _render2 = (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsxs)(_["default"], {
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
123
|
+
arranger: _testUtils.MockArranger,
|
|
124
|
+
"data-testid": "viewManager",
|
|
125
|
+
index: 3,
|
|
126
|
+
noAnimation: true,
|
|
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", {
|
|
136
|
+
children: "View 5"
|
|
137
|
+
})]
|
|
138
|
+
})),
|
|
139
|
+
rerender = _render2.rerender;
|
|
171
140
|
rerender( /*#__PURE__*/(0, _jsxRuntime.jsxs)(_["default"], {
|
|
172
141
|
arranger: _testUtils.MockArranger,
|
|
173
142
|
"data-testid": "viewManager",
|
|
@@ -186,30 +155,27 @@ describe('ViewManager', function () {
|
|
|
186
155
|
})]
|
|
187
156
|
}));
|
|
188
157
|
var expected = 1;
|
|
189
|
-
|
|
190
158
|
var actual = _react.screen.getByTestId('viewManager').children.length;
|
|
191
|
-
|
|
192
159
|
expect(actual).toBe(expected);
|
|
193
160
|
});
|
|
194
161
|
test('should have 2 children immediately after setting new {index} with an {arranger}', function () {
|
|
195
162
|
var _render3 = (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsxs)(_["default"], {
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
163
|
+
arranger: _testUtils.MockArranger,
|
|
164
|
+
"data-testid": "viewManager",
|
|
165
|
+
index: 3,
|
|
166
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
167
|
+
children: "View 1"
|
|
168
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
169
|
+
children: "View 2"
|
|
170
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
171
|
+
children: "View 3"
|
|
172
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
173
|
+
children: "View 4"
|
|
174
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
175
|
+
children: "View 5"
|
|
176
|
+
})]
|
|
177
|
+
})),
|
|
178
|
+
rerender = _render3.rerender;
|
|
213
179
|
rerender( /*#__PURE__*/(0, _jsxRuntime.jsxs)(_["default"], {
|
|
214
180
|
arranger: _testUtils.MockArranger,
|
|
215
181
|
"data-testid": "viewManager",
|
|
@@ -227,25 +193,18 @@ describe('ViewManager', function () {
|
|
|
227
193
|
})]
|
|
228
194
|
}));
|
|
229
195
|
var expected = 2;
|
|
230
|
-
|
|
231
196
|
var actual = _react.screen.getByTestId('viewManager').children.length;
|
|
232
|
-
|
|
233
197
|
expect(actual).toBe(expected);
|
|
234
198
|
});
|
|
235
199
|
test('should allow child props to update', function () {
|
|
236
200
|
var content = 'updated';
|
|
237
|
-
|
|
238
201
|
var ViewManagerTest = /*#__PURE__*/function (_Component) {
|
|
239
202
|
_inherits(ViewManagerTest, _Component);
|
|
240
|
-
|
|
241
203
|
var _super = _createSuper(ViewManagerTest);
|
|
242
|
-
|
|
243
204
|
function ViewManagerTest() {
|
|
244
205
|
_classCallCheck(this, ViewManagerTest);
|
|
245
|
-
|
|
246
206
|
return _super.apply(this, arguments);
|
|
247
207
|
}
|
|
248
|
-
|
|
249
208
|
_createClass(ViewManagerTest, [{
|
|
250
209
|
key: "render",
|
|
251
210
|
value: function render() {
|
|
@@ -257,45 +216,38 @@ describe('ViewManager', function () {
|
|
|
257
216
|
});
|
|
258
217
|
}
|
|
259
218
|
}]);
|
|
260
|
-
|
|
261
219
|
return ViewManagerTest;
|
|
262
220
|
}(_react2.Component);
|
|
263
|
-
|
|
264
221
|
var _render4 = (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(ViewManagerTest, {
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
222
|
+
content: "original"
|
|
223
|
+
})),
|
|
224
|
+
rerender = _render4.rerender;
|
|
269
225
|
rerender( /*#__PURE__*/(0, _jsxRuntime.jsx)(ViewManagerTest, {
|
|
270
226
|
content: content
|
|
271
227
|
}));
|
|
272
228
|
var expected = content;
|
|
273
|
-
|
|
274
229
|
var actual = _react.screen.getByTestId('view').textContent;
|
|
275
|
-
|
|
276
230
|
expect(actual).toBe(expected);
|
|
277
231
|
});
|
|
278
232
|
test('should have 1 child {duration}ms after setting new {index}', function (done) {
|
|
279
233
|
var duration = 50;
|
|
280
|
-
|
|
281
234
|
var _render5 = (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsxs)(_["default"], {
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
235
|
+
"data-testid": "viewManager",
|
|
236
|
+
duration: duration,
|
|
237
|
+
index: 3,
|
|
238
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
239
|
+
children: "View 1"
|
|
240
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
241
|
+
children: "View 2"
|
|
242
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
243
|
+
children: "View 3"
|
|
244
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
245
|
+
children: "View 4"
|
|
246
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
247
|
+
children: "View 5"
|
|
248
|
+
})]
|
|
249
|
+
})),
|
|
250
|
+
rerender = _render5.rerender;
|
|
299
251
|
rerender( /*#__PURE__*/(0, _jsxRuntime.jsxs)(_["default"], {
|
|
300
252
|
"data-testid": "viewManager",
|
|
301
253
|
duration: duration,
|
|
@@ -316,9 +268,7 @@ describe('ViewManager', function () {
|
|
|
316
268
|
return jest.advanceTimersByTime(duration + 10);
|
|
317
269
|
});
|
|
318
270
|
var expected = 1;
|
|
319
|
-
|
|
320
271
|
var actual = _react.screen.getByTestId('viewManager').children.length;
|
|
321
|
-
|
|
322
272
|
expect(actual).toBe(expected);
|
|
323
273
|
done();
|
|
324
274
|
});
|
|
@@ -341,36 +291,34 @@ describe('ViewManager', function () {
|
|
|
341
291
|
})]
|
|
342
292
|
}));
|
|
343
293
|
var expected = 1;
|
|
344
|
-
|
|
345
294
|
var actual = _react.screen.getByTestId('viewManager').children.length;
|
|
346
|
-
|
|
347
295
|
expect(actual).toBe(expected);
|
|
348
|
-
});
|
|
296
|
+
});
|
|
349
297
|
|
|
298
|
+
// TODO cannot read props of child components
|
|
350
299
|
test.skip('should update the View reverseTransition prop.', function () {
|
|
351
300
|
var _render6 = (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsxs)(_["default"], {
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
301
|
+
duration: 0,
|
|
302
|
+
index: 0,
|
|
303
|
+
noAnimation: true,
|
|
304
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
305
|
+
className: "view",
|
|
306
|
+
children: "View 1"
|
|
307
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
308
|
+
className: "view",
|
|
309
|
+
children: "View 2"
|
|
310
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
311
|
+
className: "view",
|
|
312
|
+
children: "View 3"
|
|
313
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
314
|
+
className: "view",
|
|
315
|
+
children: "View 4"
|
|
316
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
317
|
+
className: "view",
|
|
318
|
+
children: "View 5"
|
|
319
|
+
})]
|
|
320
|
+
})),
|
|
321
|
+
rerender = _render6.rerender;
|
|
374
322
|
rerender( /*#__PURE__*/(0, _jsxRuntime.jsxs)(_["default"], {
|
|
375
323
|
duration: 0,
|
|
376
324
|
index: 0,
|
|
@@ -392,29 +340,31 @@ describe('ViewManager', function () {
|
|
|
392
340
|
className: "view",
|
|
393
341
|
children: "View 5"
|
|
394
342
|
})]
|
|
395
|
-
}));
|
|
343
|
+
}));
|
|
344
|
+
|
|
345
|
+
// const actual = subject.find('View').props().reverseTransition;
|
|
396
346
|
// expect(actual).toBeTruthy();
|
|
397
|
-
});
|
|
347
|
+
});
|
|
398
348
|
|
|
349
|
+
// TODO cannot read props of child components
|
|
399
350
|
test.skip('should update the View reverseTransition prop to true if it is updated with a smaller index prop.', function () {
|
|
400
351
|
var _render7 = (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsxs)(_["default"], {
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
352
|
+
arranger: _testUtils.MockArranger,
|
|
353
|
+
duration: 0,
|
|
354
|
+
index: 2,
|
|
355
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
356
|
+
children: "View 1"
|
|
357
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
358
|
+
children: "View 2"
|
|
359
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
360
|
+
children: "View 3"
|
|
361
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
362
|
+
children: "View 4"
|
|
363
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
364
|
+
children: "View 5"
|
|
365
|
+
})]
|
|
366
|
+
})),
|
|
367
|
+
rerender = _render7.rerender;
|
|
418
368
|
rerender( /*#__PURE__*/(0, _jsxRuntime.jsxs)(_["default"], {
|
|
419
369
|
arranger: _testUtils.MockArranger,
|
|
420
370
|
duration: 0,
|
|
@@ -430,25 +380,27 @@ describe('ViewManager', function () {
|
|
|
430
380
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
431
381
|
children: "View 5"
|
|
432
382
|
})]
|
|
433
|
-
}));
|
|
383
|
+
}));
|
|
384
|
+
|
|
385
|
+
// const actual = subject.find('View').at(0).props().reverseTransition;
|
|
434
386
|
// expect(actual).toBeTruthy();
|
|
435
|
-
});
|
|
387
|
+
});
|
|
436
388
|
|
|
389
|
+
// TODO cannot read props of child components
|
|
437
390
|
test.skip('should update the View reverseTransition prop to false even though it is updated with a smaller index prop.', function () {
|
|
438
391
|
var _render8 = (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsxs)(_["default"], {
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
392
|
+
arranger: _testUtils.MockArranger,
|
|
393
|
+
duration: 0,
|
|
394
|
+
index: 2,
|
|
395
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
396
|
+
children: "View 1"
|
|
397
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
398
|
+
children: "View 2"
|
|
399
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
400
|
+
children: "View 3"
|
|
401
|
+
})]
|
|
402
|
+
})),
|
|
403
|
+
rerender = _render8.rerender;
|
|
452
404
|
rerender( /*#__PURE__*/(0, _jsxRuntime.jsxs)(_["default"], {
|
|
453
405
|
arranger: _testUtils.MockArranger,
|
|
454
406
|
duration: 0,
|
|
@@ -461,20 +413,22 @@ describe('ViewManager', function () {
|
|
|
461
413
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
462
414
|
children: "View 3"
|
|
463
415
|
})]
|
|
464
|
-
}));
|
|
416
|
+
}));
|
|
417
|
+
|
|
418
|
+
// const actual = subject.find('View').at(0).props().reverseTransition;
|
|
465
419
|
// expect(actual).toBeFalsy();
|
|
466
420
|
});
|
|
421
|
+
|
|
467
422
|
test('should update the view when children are reordered', function () {
|
|
468
423
|
var _render9 = (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsxs)(_["default"], {
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
424
|
+
index: 1,
|
|
425
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
426
|
+
children: "View 1"
|
|
427
|
+
}, "view1"), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
428
|
+
children: "View 2"
|
|
429
|
+
}, "view2")]
|
|
430
|
+
})),
|
|
431
|
+
rerender = _render9.rerender;
|
|
478
432
|
expect(_react.screen.getByText('View 2')).toBeInTheDocument();
|
|
479
433
|
rerender( /*#__PURE__*/(0, _jsxRuntime.jsxs)(_["default"], {
|
|
480
434
|
index: 1,
|
|
@@ -488,13 +442,12 @@ describe('ViewManager', function () {
|
|
|
488
442
|
});
|
|
489
443
|
test('should update the view when children are replaced', function () {
|
|
490
444
|
var _render10 = (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_["default"], {
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
445
|
+
index: 0,
|
|
446
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
447
|
+
children: "View 1"
|
|
448
|
+
}, "view1")
|
|
449
|
+
})),
|
|
450
|
+
rerender = _render10.rerender;
|
|
498
451
|
expect(_react.screen.getByText('View 1')).toBeInTheDocument();
|
|
499
452
|
rerender( /*#__PURE__*/(0, _jsxRuntime.jsx)(_["default"], {
|
|
500
453
|
index: 0,
|
|
@@ -506,24 +459,22 @@ describe('ViewManager', function () {
|
|
|
506
459
|
});
|
|
507
460
|
test('should update the number of views when {start} updates', function () {
|
|
508
461
|
var _render11 = (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsxs)(_["default"], {
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
462
|
+
"data-testid": "viewManager",
|
|
463
|
+
end: 3,
|
|
464
|
+
index: 3,
|
|
465
|
+
start: 2,
|
|
466
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
467
|
+
children: "View 1"
|
|
468
|
+
}, "view1"), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
469
|
+
children: "View 2"
|
|
470
|
+
}, "view2"), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
471
|
+
children: "View 3"
|
|
472
|
+
}, "view3"), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
473
|
+
children: "View 4"
|
|
474
|
+
}, "view4")]
|
|
475
|
+
})),
|
|
476
|
+
rerender = _render11.rerender;
|
|
525
477
|
var children = _react.screen.getByTestId('viewManager').children;
|
|
526
|
-
|
|
527
478
|
expect(children).toHaveLength(2);
|
|
528
479
|
expect(children.item(0)).toHaveTextContent('View 3');
|
|
529
480
|
rerender( /*#__PURE__*/(0, _jsxRuntime.jsxs)(_["default"], {
|
|
@@ -546,24 +497,22 @@ describe('ViewManager', function () {
|
|
|
546
497
|
});
|
|
547
498
|
test('should update the active view when {start}, {end}, and {index} update', function () {
|
|
548
499
|
var _render12 = (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsxs)(_["default"], {
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
500
|
+
"data-testid": "viewManager",
|
|
501
|
+
end: 3,
|
|
502
|
+
index: 3,
|
|
503
|
+
start: 3,
|
|
504
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
505
|
+
children: "View 1"
|
|
506
|
+
}, "view1"), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
507
|
+
children: "View 2"
|
|
508
|
+
}, "view2"), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
509
|
+
children: "View 3"
|
|
510
|
+
}, "view3"), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
511
|
+
children: "View 4"
|
|
512
|
+
}, "view4")]
|
|
513
|
+
})),
|
|
514
|
+
rerender = _render12.rerender;
|
|
565
515
|
var children = _react.screen.getByTestId('viewManager').children;
|
|
566
|
-
|
|
567
516
|
var expected = 1;
|
|
568
517
|
expect(children).toHaveLength(expected);
|
|
569
518
|
expect(_react.screen.getByTestId('viewManager')).toHaveTextContent('View 4');
|
|
@@ -582,9 +531,7 @@ describe('ViewManager', function () {
|
|
|
582
531
|
children: "View 4"
|
|
583
532
|
}, "view4")]
|
|
584
533
|
}));
|
|
585
|
-
|
|
586
534
|
var newChildren = _react.screen.getByTestId('viewManager').children;
|
|
587
|
-
|
|
588
535
|
var newExpected = 1;
|
|
589
536
|
expect(newChildren).toHaveLength(newExpected);
|
|
590
537
|
expect(_react.screen.getByTestId('viewManager')).toHaveTextContent('View 3');
|
|
@@ -605,9 +552,7 @@ describe('ViewManager', function () {
|
|
|
605
552
|
children: "View 4"
|
|
606
553
|
}, "view4")]
|
|
607
554
|
}));
|
|
608
|
-
|
|
609
555
|
var children = _react.screen.getByTestId('viewManager').children;
|
|
610
|
-
|
|
611
556
|
var expected = 3;
|
|
612
557
|
expect(children).toHaveLength(expected);
|
|
613
558
|
});
|
|
@@ -626,27 +571,23 @@ describe('ViewManager', function () {
|
|
|
626
571
|
children: "View 4"
|
|
627
572
|
}, "view4")]
|
|
628
573
|
}));
|
|
629
|
-
|
|
630
574
|
var children = _react.screen.getAllByText(/View/);
|
|
631
|
-
|
|
632
575
|
var expected = 3;
|
|
633
576
|
expect(children).toHaveLength(expected);
|
|
634
577
|
});
|
|
635
578
|
test('should fire onEnter with type once a view has entered', function () {
|
|
636
579
|
var spy = jest.fn();
|
|
637
|
-
|
|
638
580
|
var _render13 = (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsxs)(_["default"], {
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
581
|
+
index: 0,
|
|
582
|
+
noAnimation: true,
|
|
583
|
+
onEnter: spy,
|
|
584
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
585
|
+
children: "View 1"
|
|
586
|
+
}, "view1"), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
587
|
+
children: "View 2"
|
|
588
|
+
}, "view2")]
|
|
589
|
+
})),
|
|
590
|
+
rerender = _render13.rerender;
|
|
650
591
|
spy.mockClear();
|
|
651
592
|
rerender( /*#__PURE__*/(0, _jsxRuntime.jsxs)(_["default"], {
|
|
652
593
|
index: 1,
|
|
@@ -668,19 +609,17 @@ describe('ViewManager', function () {
|
|
|
668
609
|
});
|
|
669
610
|
test('should fire onAppear with type once a view has appeared', /*#__PURE__*/_asyncToGenerator(function* () {
|
|
670
611
|
var spy = jest.fn();
|
|
671
|
-
|
|
672
612
|
var _render14 = (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsxs)(_["default"], {
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
613
|
+
index: 0,
|
|
614
|
+
noAnimation: true,
|
|
615
|
+
onAppear: spy,
|
|
616
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
617
|
+
children: "View 1"
|
|
618
|
+
}, "view1"), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
619
|
+
children: "View 2"
|
|
620
|
+
}, "view2")]
|
|
621
|
+
})),
|
|
622
|
+
rerender = _render14.rerender;
|
|
684
623
|
rerender( /*#__PURE__*/(0, _jsxRuntime.jsxs)(_["default"], {
|
|
685
624
|
index: 1,
|
|
686
625
|
onAppear: spy,
|
|
@@ -705,19 +644,17 @@ describe('ViewManager', function () {
|
|
|
705
644
|
}));
|
|
706
645
|
test('should fire onTransition once per transition', function () {
|
|
707
646
|
var spy = jest.fn();
|
|
708
|
-
|
|
709
647
|
var _render15 = (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsxs)(_["default"], {
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
648
|
+
index: 0,
|
|
649
|
+
noAnimation: true,
|
|
650
|
+
onTransition: spy,
|
|
651
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
652
|
+
children: "View 1"
|
|
653
|
+
}, "view1"), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
654
|
+
children: "View 2"
|
|
655
|
+
}, "view2")]
|
|
656
|
+
})),
|
|
657
|
+
rerender = _render15.rerender;
|
|
721
658
|
spy.mockClear();
|
|
722
659
|
rerender( /*#__PURE__*/(0, _jsxRuntime.jsxs)(_["default"], {
|
|
723
660
|
index: 1,
|
|
@@ -749,19 +686,17 @@ describe('ViewManager', function () {
|
|
|
749
686
|
});
|
|
750
687
|
test('should include the current index and previous index in onTransition event payload', function () {
|
|
751
688
|
var spy = jest.fn();
|
|
752
|
-
|
|
753
689
|
var _render16 = (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsxs)(_["default"], {
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
690
|
+
index: 0,
|
|
691
|
+
noAnimation: true,
|
|
692
|
+
onTransition: spy,
|
|
693
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
694
|
+
children: "View 1"
|
|
695
|
+
}, "view1"), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
696
|
+
children: "View 2"
|
|
697
|
+
}, "view2")]
|
|
698
|
+
})),
|
|
699
|
+
rerender = _render16.rerender;
|
|
765
700
|
spy.mockClear();
|
|
766
701
|
rerender( /*#__PURE__*/(0, _jsxRuntime.jsxs)(_["default"], {
|
|
767
702
|
index: 1,
|
|
@@ -796,19 +731,17 @@ describe('ViewManager', function () {
|
|
|
796
731
|
});
|
|
797
732
|
test('should fire onWillTransition once per transition', function () {
|
|
798
733
|
var spy = jest.fn();
|
|
799
|
-
|
|
800
734
|
var _render17 = (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsxs)(_["default"], {
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
735
|
+
index: 0,
|
|
736
|
+
noAnimation: true,
|
|
737
|
+
onWillTransition: spy,
|
|
738
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
739
|
+
children: "View 1"
|
|
740
|
+
}, "view1"), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
741
|
+
children: "View 2"
|
|
742
|
+
}, "view2")]
|
|
743
|
+
})),
|
|
744
|
+
rerender = _render17.rerender;
|
|
812
745
|
rerender( /*#__PURE__*/(0, _jsxRuntime.jsxs)(_["default"], {
|
|
813
746
|
index: 1,
|
|
814
747
|
onWillTransition: spy,
|
|
@@ -823,19 +756,17 @@ describe('ViewManager', function () {
|
|
|
823
756
|
});
|
|
824
757
|
test('should include the current index and previous index in onWillTransition event payload', function () {
|
|
825
758
|
var spy = jest.fn();
|
|
826
|
-
|
|
827
759
|
var _render18 = (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsxs)(_["default"], {
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
760
|
+
index: 0,
|
|
761
|
+
noAnimation: true,
|
|
762
|
+
onWillTransition: spy,
|
|
763
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
764
|
+
children: "View 1"
|
|
765
|
+
}, "view1"), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
766
|
+
children: "View 2"
|
|
767
|
+
}, "view2")]
|
|
768
|
+
})),
|
|
769
|
+
rerender = _render18.rerender;
|
|
839
770
|
rerender( /*#__PURE__*/(0, _jsxRuntime.jsxs)(_["default"], {
|
|
840
771
|
index: 1,
|
|
841
772
|
onWillTransition: spy,
|