@enact/ui 4.1.4 → 4.5.0-beta.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 +11 -11
- package/AnnounceDecorator/AnnounceDecorator.js +6 -4
- package/AnnounceDecorator/tests/useAnnounce-specs.js +7 -5
- package/AnnounceDecorator/useAnnounce.js +1 -1
- package/BodyText/BodyText.js +6 -4
- package/BodyText/tests/BodyText-specs.js +2 -2
- package/Button/Button.js +6 -4
- package/CHANGELOG.md +26 -4
- package/Cancelable/Cancelable.js +13 -12
- package/Cancelable/tests/Cancelable-specs.js +5 -3
- package/Changeable/Changeable.js +11 -11
- package/Changeable/tests/Changeable-specs.js +19 -9
- package/ComponentOverride/ComponentOverride.js +6 -4
- package/FloatingLayer/FloatingLayer.js +56 -36
- package/FloatingLayer/FloatingLayer.module.css +3 -0
- package/FloatingLayer/FloatingLayerContainer.js +2 -2
- package/FloatingLayer/FloatingLayerDecorator.js +6 -4
- package/FloatingLayer/Scrim.js +11 -9
- package/FloatingLayer/index.js +1 -1
- package/FloatingLayer/tests/FloatingLayer-specs.js +5 -2
- package/FloatingLayer/tests/useFloatingLayerDecorator-specs.js +2 -2
- package/FloatingLayer/useFloatingLayer.js +2 -2
- package/FloatingLayer/useFloatingLayerDecorator.js +1 -1
- package/ForwardRef/ForwardRef.js +3 -3
- package/GridListImageItem/GridListImageItem.js +6 -4
- package/Group/Group.js +7 -4
- package/Group/GroupItem.js +6 -4
- package/Group/tests/Group-specs.js +2 -2
- package/Heading/Heading.js +6 -4
- package/Icon/Icon.js +6 -4
- package/Icon/tests/Icon-specs.js +2 -2
- package/IconButton/IconButton.js +6 -4
- package/Image/Image.js +6 -4
- package/Image/tests/Image-specs.js +2 -2
- package/ImageItem/ImageItem.js +8 -5
- package/ImageItem/tests/ImageItem-specs.js +4 -4
- package/Item/Item.js +6 -4
- package/LabeledIcon/LabeledIcon.js +6 -4
- package/Layout/Cell.js +6 -4
- package/Layout/Layout.js +6 -4
- package/Layout/tests/Layout-specs.js +5 -5
- package/Marquee/MarqueeBase.js +6 -4
- package/Marquee/MarqueeController.js +11 -11
- package/Marquee/MarqueeDecorator.js +49 -15
- package/Marquee/index.d.ts +12 -0
- package/Marquee/index.js +2 -1
- package/Marquee/tests/Marquee-specs.js +22 -16
- package/Measurable/Measurable.js +4 -4
- package/Media/Media.js +11 -9
- package/Placeholder/PlaceholderControllerDecorator.js +11 -11
- package/Placeholder/PlaceholderDecorator.js +11 -11
- package/ProgressBar/ProgressBar.js +6 -4
- package/RadioDecorator/RadioControllerDecorator.js +11 -11
- package/RadioDecorator/RadioDecorator.js +11 -11
- package/Repeater/Repeater.js +6 -4
- package/Repeater/tests/Repeater-specs.js +4 -4
- package/Resizable/Resizable.js +12 -12
- package/Routable/Link.js +11 -9
- package/Routable/Routable.js +10 -6
- package/Routable/Route.js +1 -1
- package/Routable/Router.js +16 -13
- package/Routable/tests/Routable-specs.js +3 -3
- package/Routable/useLink.js +1 -1
- package/Routable/util.js +1 -1
- package/Scrollable/ScrollAnimator.js +2 -2
- package/Scrollable/ScrollThumb.js +3 -3
- package/Scrollable/Scrollable.js +15 -12
- package/Scrollable/ScrollableNative.js +15 -12
- package/Scrollable/Scrollbar.js +16 -10
- package/Scroller/Scroller.js +8 -7
- package/Scroller/ScrollerBasic.js +11 -9
- package/Scroller/UiScrollerBase.js +11 -9
- package/Skinnable/Skinnable.js +6 -4
- package/Skinnable/tests/Skinnable-specs.js +26 -15
- package/Skinnable/tests/useSkins-specs.js +2 -2
- package/Skinnable/useSkins.js +1 -1
- package/Slider/Knob.js +6 -4
- package/Slider/PositionDecorator.js +11 -11
- package/Slider/Slider.js +6 -4
- package/SlotItem/SlotItem.js +6 -4
- package/Slottable/Slottable.js +3 -3
- package/Slottable/useSlots.js +6 -4
- package/Spinner/Spinner.js +6 -4
- package/Spinner/tests/Spinner-specs.js +1 -1
- package/ToggleIcon/ToggleIcon.js +6 -4
- package/ToggleItem/ToggleItem.js +6 -4
- package/ToggleItem/tests/ToggleItem-specs.js +4 -4
- package/Toggleable/Toggle.js +4 -4
- package/Toggleable/Toggleable.js +5 -5
- package/Toggleable/tests/Toggleable-specs.js +54 -18
- package/Toggleable/useToggle.js +4 -2
- package/Touchable/ClickAllow.js +2 -2
- package/Touchable/Drag.js +9 -5
- package/Touchable/Flick.js +4 -4
- package/Touchable/Hold.js +4 -4
- package/Touchable/Touch.js +2 -2
- package/Touchable/Touchable.js +7 -4
- package/Touchable/config.js +3 -3
- package/Touchable/tests/Touchable-specs.js +20 -14
- package/Touchable/tests/useTouch-specs.js +5 -3
- package/Touchable/useTouch.js +4 -4
- package/Transition/Transition.js +13 -10
- package/Transition/tests/Transition-specs.js +7 -7
- package/ViewManager/Arranger.js +3 -3
- package/ViewManager/TransitionGroup.js +6 -6
- package/ViewManager/View.js +8 -8
- package/ViewManager/ViewManager.js +16 -14
- package/ViewManager/tests/View-specs.js +43 -11
- package/ViewManager/tests/ViewManager-specs.js +22 -13
- package/VirtualList/UiVirtualListBase.js +19 -18
- package/VirtualList/VirtualList.js +10 -9
- package/VirtualList/VirtualListBase.js +1 -1
- package/VirtualList/VirtualListBasic.js +14 -15
- package/VirtualList/tests/VirtualList-specs.js +56 -38
- package/internal/IdProvider/IdProvider.js +3 -3
- package/internal/IdProvider/Provider.js +2 -2
- package/internal/IdProvider/tests/useId-specs.js +2 -2
- package/internal/Pure/Pure.js +11 -11
- package/internal/localized-fonts/localized-fonts.js +1 -1
- package/internal/validators/validators.js +1 -1
- package/package.json +7 -7
- package/resolution/ResolutionDecorator.js +11 -11
- package/resolution/index.js +2 -2
- package/resolution/resolution.js +4 -2
- package/useControlledState/tests/useControlledState-specs.js +1 -1
- package/useControlledState/useControlledState.js +2 -2
- package/useScroll/ScrollAnimator.js +2 -2
- package/useScroll/Scrollbar.js +7 -4
- package/useScroll/ScrollbarTrack.js +6 -4
- package/useScroll/useScroll.js +9 -6
package/Transition/Transition.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports
|
|
6
|
+
exports["default"] = exports.TransitionBase = exports.Transition = void 0;
|
|
7
7
|
|
|
8
8
|
var _handle = require("@enact/core/handle");
|
|
9
9
|
|
|
@@ -23,35 +23,38 @@ var _TransitionModule = _interopRequireDefault(require("./Transition.module.css"
|
|
|
23
23
|
|
|
24
24
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
25
25
|
|
|
26
|
+
var _excluded = ["css", "childRef", "children", "innerStyle"],
|
|
27
|
+
_excluded2 = ["visible"];
|
|
28
|
+
|
|
26
29
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
27
30
|
|
|
28
31
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
29
32
|
|
|
30
33
|
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); } }
|
|
31
34
|
|
|
32
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
35
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
33
36
|
|
|
34
|
-
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 } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
37
|
+
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); }
|
|
35
38
|
|
|
36
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf
|
|
39
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
37
40
|
|
|
38
41
|
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); }; }
|
|
39
42
|
|
|
40
|
-
function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|
43
|
+
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); }
|
|
41
44
|
|
|
42
45
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
43
46
|
|
|
44
47
|
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; } }
|
|
45
48
|
|
|
46
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
49
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
47
50
|
|
|
48
51
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
49
52
|
|
|
50
53
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
51
54
|
|
|
52
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
|
55
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
53
56
|
|
|
54
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
|
57
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
55
58
|
|
|
56
59
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
57
60
|
|
|
@@ -306,7 +309,7 @@ var TransitionBase = (0, _kind["default"])({
|
|
|
306
309
|
childRef = _ref4.childRef,
|
|
307
310
|
children = _ref4.children,
|
|
308
311
|
innerStyle = _ref4.innerStyle,
|
|
309
|
-
rest = _objectWithoutProperties(_ref4,
|
|
312
|
+
rest = _objectWithoutProperties(_ref4, _excluded);
|
|
310
313
|
|
|
311
314
|
delete rest.clipHeight;
|
|
312
315
|
delete rest.clipWidth;
|
|
@@ -478,7 +481,7 @@ var Transition = /*#__PURE__*/function (_Component) {
|
|
|
478
481
|
value: function render() {
|
|
479
482
|
var _this$props2 = this.props,
|
|
480
483
|
visible = _this$props2.visible,
|
|
481
|
-
props = _objectWithoutProperties(_this$props2,
|
|
484
|
+
props = _objectWithoutProperties(_this$props2, _excluded2);
|
|
482
485
|
|
|
483
486
|
delete props.onHide;
|
|
484
487
|
delete props.onShow;
|
|
@@ -8,9 +8,9 @@ var _Transition = _interopRequireWildcard(require("../Transition"));
|
|
|
8
8
|
|
|
9
9
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
10
10
|
|
|
11
|
-
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var
|
|
11
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
12
12
|
|
|
13
|
-
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
13
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
14
14
|
|
|
15
15
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
16
16
|
|
|
@@ -20,13 +20,13 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
20
20
|
|
|
21
21
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
22
22
|
|
|
23
|
-
function _iterableToArrayLimit(arr, i) { var _i = arr
|
|
23
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
24
24
|
|
|
25
25
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
26
26
|
|
|
27
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
|
27
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
28
28
|
|
|
29
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
|
29
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
30
30
|
|
|
31
31
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
32
32
|
|
|
@@ -118,7 +118,7 @@ describe('Transition Specs', function () {
|
|
|
118
118
|
|
|
119
119
|
expect(actual).toHaveClass(expected);
|
|
120
120
|
});
|
|
121
|
-
test('should fire \'onShow\' event with type when \'visible\' prop bacomes true
|
|
121
|
+
test('should fire \'onShow\' event with type when \'visible\' prop bacomes true', function () {
|
|
122
122
|
var handleShow = jest.fn();
|
|
123
123
|
|
|
124
124
|
var ChildNode = function ChildNode(props) {
|
|
@@ -149,7 +149,7 @@ describe('Transition Specs', function () {
|
|
|
149
149
|
expect(handleShow).toBeCalledTimes(expected);
|
|
150
150
|
expect(actual).toMatchObject(expectedType);
|
|
151
151
|
});
|
|
152
|
-
test('should fire \'onHide\' event with type when \'visible\' prop bacomes false
|
|
152
|
+
test('should fire \'onHide\' event with type when \'visible\' prop bacomes false', function () {
|
|
153
153
|
var handleHide = jest.fn();
|
|
154
154
|
|
|
155
155
|
var ChildNode = function ChildNode(props) {
|
package/ViewManager/Arranger.js
CHANGED
|
@@ -3,15 +3,15 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.shape = exports.
|
|
6
|
+
exports.shape = exports.arrange = exports.SlideTopArranger = exports.SlideRightArranger = exports.SlideLeftArranger = exports.SlideBottomArranger = exports.SlideArranger = void 0;
|
|
7
7
|
|
|
8
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
9
|
|
|
10
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
11
11
|
|
|
12
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
|
12
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
13
13
|
|
|
14
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
|
14
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
15
15
|
|
|
16
16
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
17
17
|
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports
|
|
6
|
+
exports["default"] = exports.TransitionGroup = void 0;
|
|
7
7
|
|
|
8
8
|
var _propTypes = _interopRequireDefault(require("@enact/core/internal/prop-types"));
|
|
9
9
|
|
|
@@ -35,21 +35,21 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
|
|
|
35
35
|
|
|
36
36
|
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); } }
|
|
37
37
|
|
|
38
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
38
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
39
39
|
|
|
40
|
-
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 } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
40
|
+
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); }
|
|
41
41
|
|
|
42
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf
|
|
42
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
43
43
|
|
|
44
44
|
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); }; }
|
|
45
45
|
|
|
46
|
-
function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|
46
|
+
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); }
|
|
47
47
|
|
|
48
48
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
49
49
|
|
|
50
50
|
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; } }
|
|
51
51
|
|
|
52
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
52
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
53
53
|
|
|
54
54
|
/**
|
|
55
55
|
* Returns the index of a child in an array found by `key` matching
|
package/ViewManager/View.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.wrapWithView = exports
|
|
6
|
+
exports.wrapWithView = exports["default"] = exports.View = void 0;
|
|
7
7
|
|
|
8
8
|
var _util = require("@enact/core/util");
|
|
9
9
|
|
|
@@ -19,9 +19,9 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
19
19
|
|
|
20
20
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
21
21
|
|
|
22
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
|
22
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
23
23
|
|
|
24
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
|
24
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
25
25
|
|
|
26
26
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
27
27
|
|
|
@@ -29,21 +29,21 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
|
|
|
29
29
|
|
|
30
30
|
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); } }
|
|
31
31
|
|
|
32
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
32
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
33
33
|
|
|
34
|
-
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 } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
34
|
+
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); }
|
|
35
35
|
|
|
36
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf
|
|
36
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
37
37
|
|
|
38
38
|
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); }; }
|
|
39
39
|
|
|
40
|
-
function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|
40
|
+
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); }
|
|
41
41
|
|
|
42
42
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
43
43
|
|
|
44
44
|
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; } }
|
|
45
45
|
|
|
46
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
46
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
47
47
|
|
|
48
48
|
// If the View was "appearing", then entering will always be false and this will not result in a
|
|
49
49
|
// re-render. If the view should enter, state.enter will be true and this will toggle it to false
|
|
@@ -8,7 +8,7 @@ var _exportNames = {
|
|
|
8
8
|
ViewManagerBase: true,
|
|
9
9
|
ViewManagerDecorator: true
|
|
10
10
|
};
|
|
11
|
-
exports.ViewManagerDecorator = exports.ViewManagerBase = exports.ViewManager =
|
|
11
|
+
exports["default"] = exports.ViewManagerDecorator = exports.ViewManagerBase = exports.ViewManager = void 0;
|
|
12
12
|
|
|
13
13
|
var _propTypes = _interopRequireDefault(require("@enact/core/internal/prop-types"));
|
|
14
14
|
|
|
@@ -40,17 +40,19 @@ var _View = require("./View");
|
|
|
40
40
|
|
|
41
41
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
42
42
|
|
|
43
|
-
var
|
|
43
|
+
var _excluded = ["arranger", "childProps", "children", "duration", "index", "noAnimation", "enteringDelay", "enteringProp", "rtl"];
|
|
44
44
|
|
|
45
|
-
|
|
45
|
+
var _class;
|
|
46
46
|
|
|
47
|
-
function
|
|
47
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
48
|
+
|
|
49
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
48
50
|
|
|
49
51
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
50
52
|
|
|
51
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
|
53
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
52
54
|
|
|
53
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
|
55
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
54
56
|
|
|
55
57
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
56
58
|
|
|
@@ -62,21 +64,21 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
|
|
|
62
64
|
|
|
63
65
|
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); } }
|
|
64
66
|
|
|
65
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
67
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
66
68
|
|
|
67
|
-
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 } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
69
|
+
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); }
|
|
68
70
|
|
|
69
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf
|
|
71
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
70
72
|
|
|
71
73
|
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); }; }
|
|
72
74
|
|
|
73
|
-
function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|
75
|
+
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); }
|
|
74
76
|
|
|
75
77
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
76
78
|
|
|
77
79
|
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; } }
|
|
78
80
|
|
|
79
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
81
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
80
82
|
|
|
81
83
|
/**
|
|
82
84
|
* The base `ViewManager` component, without
|
|
@@ -87,7 +89,7 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
|
87
89
|
* @ui
|
|
88
90
|
* @public
|
|
89
91
|
*/
|
|
90
|
-
var ViewManagerBase = (
|
|
92
|
+
var ViewManagerBase = (_class = /*#__PURE__*/function (_Component) {
|
|
91
93
|
_inherits(ViewManagerBase, _Component);
|
|
92
94
|
|
|
93
95
|
var _super = _createSuper(ViewManagerBase);
|
|
@@ -128,7 +130,7 @@ var ViewManagerBase = (_temp = _class = /*#__PURE__*/function (_Component) {
|
|
|
128
130
|
enteringDelay = _this$props.enteringDelay,
|
|
129
131
|
enteringProp = _this$props.enteringProp,
|
|
130
132
|
rtl = _this$props.rtl,
|
|
131
|
-
rest = _objectWithoutProperties(_this$props,
|
|
133
|
+
rest = _objectWithoutProperties(_this$props, _excluded);
|
|
132
134
|
|
|
133
135
|
var _this$props2 = this.props,
|
|
134
136
|
_this$props2$end = _this$props2.end,
|
|
@@ -366,7 +368,7 @@ var ViewManagerBase = (_temp = _class = /*#__PURE__*/function (_Component) {
|
|
|
366
368
|
component: 'div',
|
|
367
369
|
duration: 300,
|
|
368
370
|
index: 0
|
|
369
|
-
},
|
|
371
|
+
}, _class);
|
|
370
372
|
/**
|
|
371
373
|
* Applies ViewManager behaviors.
|
|
372
374
|
*
|
|
@@ -66,7 +66,9 @@ describe('View', function () {
|
|
|
66
66
|
ref: ref,
|
|
67
67
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {})
|
|
68
68
|
}));
|
|
69
|
-
|
|
69
|
+
(0, _react.act)(function () {
|
|
70
|
+
return ref.current.componentWillStay(spy);
|
|
71
|
+
});
|
|
70
72
|
var expected = 1;
|
|
71
73
|
expect(spy).toHaveBeenCalledTimes(expected);
|
|
72
74
|
});
|
|
@@ -78,7 +80,9 @@ describe('View', function () {
|
|
|
78
80
|
ref: ref,
|
|
79
81
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {})
|
|
80
82
|
}));
|
|
81
|
-
|
|
83
|
+
(0, _react.act)(function () {
|
|
84
|
+
return ref.current.componentWillEnter(spy);
|
|
85
|
+
});
|
|
82
86
|
var expected = 1;
|
|
83
87
|
expect(spy).toHaveBeenCalledTimes(expected);
|
|
84
88
|
});
|
|
@@ -90,11 +94,14 @@ describe('View', function () {
|
|
|
90
94
|
ref: ref,
|
|
91
95
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {})
|
|
92
96
|
}));
|
|
93
|
-
|
|
97
|
+
(0, _react.act)(function () {
|
|
98
|
+
return ref.current.componentWillLeave(spy);
|
|
99
|
+
});
|
|
94
100
|
var expected = 1;
|
|
95
101
|
expect(spy).toHaveBeenCalledTimes(expected);
|
|
96
102
|
});
|
|
97
103
|
test('should reset entering if a rendered panel re-enters', function () {
|
|
104
|
+
jest.useFakeTimers();
|
|
98
105
|
var spy = jest.fn();
|
|
99
106
|
var ref = /*#__PURE__*/(0, _react2.createRef)();
|
|
100
107
|
(0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_View["default"], {
|
|
@@ -105,13 +112,17 @@ describe('View', function () {
|
|
|
105
112
|
"data-testid": "span"
|
|
106
113
|
})
|
|
107
114
|
}));
|
|
108
|
-
|
|
115
|
+
(0, _react.act)(function () {
|
|
116
|
+
return ref.current.componentDidAppear(spy);
|
|
117
|
+
});
|
|
109
118
|
var firstExpected = 'false';
|
|
110
119
|
|
|
111
120
|
var firstSpan = _react.screen.getByTestId('span');
|
|
112
121
|
|
|
113
122
|
expect(firstSpan).toHaveAttribute('data-entering', firstExpected);
|
|
114
|
-
|
|
123
|
+
(0, _react.act)(function () {
|
|
124
|
+
return ref.current.componentWillEnter(spy);
|
|
125
|
+
});
|
|
115
126
|
var secondExpected = 'true';
|
|
116
127
|
|
|
117
128
|
var secondSpan = _react.screen.getByTestId('span');
|
|
@@ -120,6 +131,12 @@ describe('View', function () {
|
|
|
120
131
|
});
|
|
121
132
|
});
|
|
122
133
|
describe('imperative API with arranger', function () {
|
|
134
|
+
beforeEach(function () {
|
|
135
|
+
jest.useFakeTimers();
|
|
136
|
+
});
|
|
137
|
+
afterEach(function () {
|
|
138
|
+
jest.useRealTimers();
|
|
139
|
+
});
|
|
123
140
|
test('should call callback for "stay"', function (done) {
|
|
124
141
|
var ref = /*#__PURE__*/(0, _react2.createRef)();
|
|
125
142
|
(0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_View["default"], {
|
|
@@ -133,7 +150,10 @@ describe('View', function () {
|
|
|
133
150
|
expect(spy).toHaveBeenCalledTimes(expected);
|
|
134
151
|
done();
|
|
135
152
|
});
|
|
136
|
-
|
|
153
|
+
(0, _react.act)(function () {
|
|
154
|
+
return ref.current.componentWillStay(spy);
|
|
155
|
+
});
|
|
156
|
+
jest.runAllTimers();
|
|
137
157
|
});
|
|
138
158
|
test('should call callback for "enter"', function (done) {
|
|
139
159
|
var ref = /*#__PURE__*/(0, _react2.createRef)();
|
|
@@ -148,7 +168,10 @@ describe('View', function () {
|
|
|
148
168
|
expect(spy).toHaveBeenCalledTimes(expected);
|
|
149
169
|
done();
|
|
150
170
|
});
|
|
151
|
-
|
|
171
|
+
(0, _react.act)(function () {
|
|
172
|
+
return ref.current.componentWillEnter(spy);
|
|
173
|
+
});
|
|
174
|
+
jest.runAllTimers();
|
|
152
175
|
});
|
|
153
176
|
test('should call callback for "leave"', function (done) {
|
|
154
177
|
var ref = /*#__PURE__*/(0, _react2.createRef)();
|
|
@@ -163,7 +186,10 @@ describe('View', function () {
|
|
|
163
186
|
expect(spy).toHaveBeenCalledTimes(expected);
|
|
164
187
|
done();
|
|
165
188
|
});
|
|
166
|
-
|
|
189
|
+
(0, _react.act)(function () {
|
|
190
|
+
return ref.current.componentWillLeave(spy);
|
|
191
|
+
});
|
|
192
|
+
jest.runAllTimers();
|
|
167
193
|
});
|
|
168
194
|
test('should call callback immediately when {noAnimation}', function () {
|
|
169
195
|
var spy = jest.fn();
|
|
@@ -175,7 +201,9 @@ describe('View', function () {
|
|
|
175
201
|
ref: ref,
|
|
176
202
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {})
|
|
177
203
|
}));
|
|
178
|
-
|
|
204
|
+
(0, _react.act)(function () {
|
|
205
|
+
return ref.current.componentWillEnter(spy);
|
|
206
|
+
});
|
|
179
207
|
var expected = 1;
|
|
180
208
|
expect(spy).toHaveBeenCalledTimes(expected);
|
|
181
209
|
});
|
|
@@ -188,7 +216,9 @@ describe('View', function () {
|
|
|
188
216
|
ref: ref,
|
|
189
217
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {})
|
|
190
218
|
}));
|
|
191
|
-
|
|
219
|
+
(0, _react.act)(function () {
|
|
220
|
+
return ref.current.componentWillAppear(spy);
|
|
221
|
+
});
|
|
192
222
|
var expected = 1;
|
|
193
223
|
expect(spy).toHaveBeenCalledTimes(expected);
|
|
194
224
|
});
|
|
@@ -215,7 +245,9 @@ describe('View', function () {
|
|
|
215
245
|
ref: ref,
|
|
216
246
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {})
|
|
217
247
|
}));
|
|
218
|
-
|
|
248
|
+
(0, _react.act)(function () {
|
|
249
|
+
return ref.current.componentWillEnter();
|
|
250
|
+
});
|
|
219
251
|
expect(arranger.enter).toBeCalledWith(arrangerStruct);
|
|
220
252
|
});
|
|
221
253
|
});
|
|
@@ -22,24 +22,30 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
|
|
|
22
22
|
|
|
23
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); } }
|
|
24
24
|
|
|
25
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
25
|
+
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
26
|
|
|
27
|
-
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 } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
27
|
+
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
28
|
|
|
29
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf
|
|
29
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
30
30
|
|
|
31
31
|
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
32
|
|
|
33
|
-
function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|
33
|
+
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
34
|
|
|
35
35
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
36
36
|
|
|
37
37
|
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
38
|
|
|
39
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
39
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
40
40
|
|
|
41
41
|
describe('ViewManager', function () {
|
|
42
42
|
// Suite-wide setup
|
|
43
|
+
beforeEach(function () {
|
|
44
|
+
jest.useFakeTimers();
|
|
45
|
+
});
|
|
46
|
+
afterEach(function () {
|
|
47
|
+
jest.useRealTimers();
|
|
48
|
+
});
|
|
43
49
|
test('should render {component} as its child - <div/> by default', function () {
|
|
44
50
|
(0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_["default"], {
|
|
45
51
|
"data-testid": "component",
|
|
@@ -142,7 +148,7 @@ describe('ViewManager', function () {
|
|
|
142
148
|
|
|
143
149
|
expect(actual).toBe(expected);
|
|
144
150
|
});
|
|
145
|
-
test('should have 1 child immediately after setting new {index} with an {arranger} and {noAnimation} is
|
|
151
|
+
test('should have 1 child immediately after setting new {index} with an {arranger} and {noAnimation} is true', function () {
|
|
146
152
|
var _render2 = (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsxs)(_["default"], {
|
|
147
153
|
arranger: _testUtils.MockArranger,
|
|
148
154
|
"data-testid": "viewManager",
|
|
@@ -306,14 +312,15 @@ describe('ViewManager', function () {
|
|
|
306
312
|
children: "View 5"
|
|
307
313
|
})]
|
|
308
314
|
}));
|
|
309
|
-
|
|
310
|
-
|
|
315
|
+
(0, _react.act)(function () {
|
|
316
|
+
return jest.advanceTimersByTime(duration + 10);
|
|
317
|
+
});
|
|
318
|
+
var expected = 1;
|
|
311
319
|
|
|
312
|
-
|
|
320
|
+
var actual = _react.screen.getByTestId('viewManager').children.length;
|
|
313
321
|
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
}, duration + 10);
|
|
322
|
+
expect(actual).toBe(expected);
|
|
323
|
+
done();
|
|
317
324
|
});
|
|
318
325
|
test('should have 1 child when noAnimation is true', function () {
|
|
319
326
|
(0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsxs)(_["default"], {
|
|
@@ -686,11 +693,13 @@ describe('ViewManager', function () {
|
|
|
686
693
|
}));
|
|
687
694
|
yield (0, _react.waitFor)(function () {
|
|
688
695
|
var expected = 1;
|
|
696
|
+
expect(spy).toHaveBeenCalledTimes(expected);
|
|
697
|
+
});
|
|
698
|
+
yield (0, _react.waitFor)(function () {
|
|
689
699
|
var expectedType = {
|
|
690
700
|
type: 'onAppear'
|
|
691
701
|
};
|
|
692
702
|
var actual = spy.mock.calls.length && spy.mock.calls[0][0];
|
|
693
|
-
expect(spy).toHaveBeenCalledTimes(expected);
|
|
694
703
|
expect(actual).toMatchObject(expectedType);
|
|
695
704
|
});
|
|
696
705
|
}));
|