@enact/core 4.1.2 → 4.5.0-alpha.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.
@@ -2,7 +2,11 @@
2
2
 
3
3
  var _react = require("react");
4
4
 
5
- var _enzyme = require("enzyme");
5
+ require("@testing-library/jest-dom");
6
+
7
+ var _react2 = require("@testing-library/react");
8
+
9
+ var _userEvent = _interopRequireDefault(require("@testing-library/user-event"));
6
10
 
7
11
  var _Registry = _interopRequireDefault(require("../Registry"));
8
12
 
@@ -10,9 +14,9 @@ var _jsxRuntime = require("react/jsx-runtime");
10
14
 
11
15
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
12
16
 
13
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
17
+ 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; }
14
18
 
15
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
19
+ 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; }
16
20
 
17
21
  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; }
18
22
 
@@ -20,15 +24,15 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
20
24
 
21
25
  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); } }
22
26
 
23
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
27
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
24
28
 
25
- 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); }
29
+ 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); }
26
30
 
27
31
  function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
28
32
 
29
33
  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); }; }
30
34
 
31
- function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
35
+ 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); }
32
36
 
33
37
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
34
38
 
@@ -144,75 +148,97 @@ describe('Registry', function () {
144
148
 
145
149
  HandlesNotification.contextType = SomeContext;
146
150
  test('should increment child on click', function () {
147
- var RegistryApp = (0, _enzyme.mount)( /*#__PURE__*/(0, _jsxRuntime.jsx)(NotifiesTree, {
148
- id: "a-btn",
151
+ (0, _react2.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(NotifiesTree, {
152
+ "data-testid": "a-btn",
149
153
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(HandlesNotification, {
150
- id: "a"
154
+ "data-testid": "a"
151
155
  })
152
156
  }));
153
- RegistryApp.find('button#a-btn').simulate('click');
157
+
158
+ _userEvent["default"].click(_react2.screen.getByTestId('a-btn'));
159
+
154
160
  var expected = '1';
155
- var actual = RegistryApp.find('div#a').text();
156
- expect(expected).toBe(actual);
161
+
162
+ var child = _react2.screen.getByTestId('a');
163
+
164
+ expect(child).toHaveTextContent(expected);
157
165
  });
158
166
  test('should increment both children on top click', function () {
159
- var RegistryApp = (0, _enzyme.mount)( /*#__PURE__*/(0, _jsxRuntime.jsxs)(NotifiesTree, {
160
- id: "a-btn",
167
+ (0, _react2.render)( /*#__PURE__*/(0, _jsxRuntime.jsxs)(NotifiesTree, {
168
+ "data-testid": "a-btn",
161
169
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(HandlesNotification, {
162
- id: "a"
170
+ "data-testid": "a"
163
171
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(NotifiesTree, {
164
- id: "b-btn",
172
+ "data-testid": "b-btn",
165
173
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(HandlesNotification, {
166
- id: "b"
174
+ "data-testid": "b"
167
175
  })
168
176
  })]
169
177
  }));
170
- RegistryApp.find('button#a-btn').simulate('click');
178
+
179
+ _userEvent["default"].click(_react2.screen.getByTestId('a-btn'));
180
+
171
181
  var expected = '1';
172
- var actualA = RegistryApp.find('div#a').text();
173
- var actualB = RegistryApp.find('div#b').text();
174
- expect(expected).toBe(actualA);
175
- expect(expected).toBe(actualB);
182
+
183
+ var childA = _react2.screen.getByTestId('a');
184
+
185
+ var childB = _react2.screen.getByTestId('b');
186
+
187
+ expect(childA).toHaveTextContent(expected);
188
+ expect(childB).toHaveTextContent(expected);
176
189
  });
177
190
  test('should increment the deepest child when we click child button', function () {
178
- var RegistryApp = (0, _enzyme.mount)( /*#__PURE__*/(0, _jsxRuntime.jsxs)(NotifiesTree, {
179
- id: "a-btn",
191
+ (0, _react2.render)( /*#__PURE__*/(0, _jsxRuntime.jsxs)(NotifiesTree, {
192
+ "data-testid": "a-btn",
180
193
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(HandlesNotification, {
181
- id: "a"
194
+ "data-testid": "a"
182
195
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(NotifiesTree, {
183
- id: "b-btn",
196
+ "data-testid": "b-btn",
184
197
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(HandlesNotification, {
185
- id: "b"
198
+ "data-testid": "b"
186
199
  })
187
200
  })]
188
201
  }));
189
- RegistryApp.find('button#b-btn').simulate('click');
202
+
203
+ _userEvent["default"].click(_react2.screen.getByTestId('b-btn'));
204
+
190
205
  var expectedA = '0';
191
206
  var expectedB = '1';
192
- var actualA = RegistryApp.find('div#a').text();
193
- var actualB = RegistryApp.find('div#b').text();
194
- expect(expectedA).toBe(actualA);
195
- expect(expectedB).toBe(actualB);
207
+
208
+ var childA = _react2.screen.getByTestId('a');
209
+
210
+ var childB = _react2.screen.getByTestId('b');
211
+
212
+ expect(childA).toHaveTextContent(expectedA);
213
+ expect(childB).toHaveTextContent(expectedB);
196
214
  });
197
215
  test('should support removing children without error', function () {
198
- var RegistryApp = (0, _enzyme.mount)( /*#__PURE__*/(0, _jsxRuntime.jsxs)(NotifiesTree, {
199
- id: "a-btn",
216
+ var _render = (0, _react2.render)( /*#__PURE__*/(0, _jsxRuntime.jsxs)(NotifiesTree, {
217
+ "data-testid": "a-btn",
200
218
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(HandlesNotification, {
201
- id: "a"
219
+ "data-testid": "a"
202
220
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(HandlesNotification, {
203
- id: "b"
221
+ "data-testid": "b"
204
222
  })]
205
- }));
206
- RegistryApp.find('button#a-btn').simulate('click'); // changing children should be safe and not throw errors when notifying instances
223
+ })),
224
+ rerender = _render.rerender;
225
+
226
+ _userEvent["default"].click(_react2.screen.getByTestId('a-btn')); // changing children should be safe and not throw errors when notifying instances
207
227
 
208
- RegistryApp.setProps({
228
+
229
+ rerender( /*#__PURE__*/(0, _jsxRuntime.jsx)(NotifiesTree, {
230
+ "data-testid": "a-btn",
209
231
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(HandlesNotification, {
210
- id: "c"
232
+ "data-testid": "c"
211
233
  })
212
- });
213
- RegistryApp.find('button#a-btn').simulate('click');
234
+ }));
235
+
236
+ _userEvent["default"].click(_react2.screen.getByTestId('a-btn'));
237
+
214
238
  var expectedC = '1';
215
- var actualC = RegistryApp.find('div#c').text();
216
- expect(expectedC).toBe(actualC);
239
+
240
+ var childC = _react2.screen.getByTestId('c');
241
+
242
+ expect(childC).toHaveTextContent(expectedC);
217
243
  });
218
244
  });
@@ -2,9 +2,9 @@
2
2
 
3
3
  var keymap = _interopRequireWildcard(require("../"));
4
4
 
5
- function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
5
+ 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); }
6
6
 
7
- 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; }
7
+ 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; }
8
8
 
9
9
  describe('keymap', function () {
10
10
  test('should support adding single keyCodes for a name', function () {
package/kind/computed.js CHANGED
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.computed = exports["default"] = void 0;
6
+ exports["default"] = exports.computed = void 0;
7
7
 
8
8
  /**
9
9
  * Accepts an object of computed property configurations and a property object, passes the property
package/kind/kind.js CHANGED
@@ -21,15 +21,15 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
21
21
 
22
22
  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); } }
23
23
 
24
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
24
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
25
25
 
26
- 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); }
26
+ 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); }
27
27
 
28
28
  function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
29
29
 
30
30
  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); }; }
31
31
 
32
- function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
32
+ 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); }
33
33
 
34
34
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
35
35
 
@@ -37,9 +37,9 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
37
37
 
38
38
  function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
39
39
 
40
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
40
+ 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; }
41
41
 
42
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
42
+ 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; }
43
43
 
44
44
  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; }
45
45
 
@@ -188,9 +188,9 @@ var kind = function kind(config) {
188
188
  return renderKind(merged, ctx);
189
189
  };
190
190
  } else {
191
- var _class, _temp;
191
+ var _class;
192
192
 
193
- Component = (_temp = _class = /*#__PURE__*/function (_ReactComponent) {
193
+ Component = (_class = /*#__PURE__*/function (_ReactComponent) {
194
194
  _inherits(Component, _ReactComponent);
195
195
 
196
196
  var _super = _createSuper(Component);
@@ -217,7 +217,7 @@ var kind = function kind(config) {
217
217
  }]);
218
218
 
219
219
  return Component;
220
- }(_react.Component), _class.contextType = contextType, _temp);
220
+ }(_react.Component), _class.contextType = contextType, _class);
221
221
  }
222
222
 
223
223
  if (name) Component.displayName = name;
@@ -1,15 +1,21 @@
1
1
  "use strict";
2
2
 
3
- var _react = require("react");
3
+ require("@testing-library/jest-dom");
4
+
5
+ var _react = require("@testing-library/react");
6
+
7
+ var _userEvent = _interopRequireDefault(require("@testing-library/user-event"));
4
8
 
5
9
  var _propTypes = _interopRequireDefault(require("prop-types"));
6
10
 
7
- var _enzyme = require("enzyme");
11
+ var _react2 = require("react");
8
12
 
9
13
  var _kind = _interopRequireDefault(require("../kind"));
10
14
 
11
15
  var _jsxRuntime = require("react/jsx-runtime");
12
16
 
17
+ var _excluded = ["contextValue", "label", "value"];
18
+
13
19
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
14
20
 
15
21
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
@@ -20,13 +26,13 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
20
26
 
21
27
  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
28
 
23
- function _iterableToArrayLimit(arr, i) { var _i = arr && (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; }
29
+ 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
30
 
25
31
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
26
32
 
27
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
33
+ 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
34
 
29
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
35
+ 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
36
 
31
37
  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
38
 
@@ -35,7 +41,7 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
35
41
  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; }
36
42
 
37
43
  describe('kind', function () {
38
- var TestContext = /*#__PURE__*/(0, _react.createContext)({
44
+ var TestContext = /*#__PURE__*/(0, _react2.createContext)({
39
45
  value: 'initial'
40
46
  });
41
47
  var Kind = (0, _kind["default"])({
@@ -69,12 +75,12 @@ describe('kind', function () {
69
75
  var contextValue = _ref2.contextValue,
70
76
  label = _ref2.label,
71
77
  value = _ref2.value,
72
- rest = _objectWithoutProperties(_ref2, ["contextValue", "label", "value"]);
78
+ rest = _objectWithoutProperties(_ref2, _excluded);
73
79
 
74
80
  delete rest.prop;
75
81
  return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", _objectSpread(_objectSpread({}, rest), {}, {
76
- title: label,
77
82
  "data-context": contextValue,
83
+ title: label,
78
84
  children: value
79
85
  }));
80
86
  }
@@ -88,12 +94,16 @@ describe('kind', function () {
88
94
  var Minimal = (0, _kind["default"])({
89
95
  name: 'Minimal',
90
96
  render: function render() {
91
- return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {});
97
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
98
+ "data-testid": "minimal"
99
+ });
92
100
  }
93
101
  });
94
- var subject = (0, _enzyme.mount)( /*#__PURE__*/(0, _jsxRuntime.jsx)(Minimal, {}));
95
- var actual = subject.find('div');
96
- expect(actual).toBeDefined();
102
+ (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(Minimal, {}));
103
+
104
+ var minimalDiv = _react.screen.queryByTestId('minimal');
105
+
106
+ expect(minimalDiv).toBeInTheDocument();
97
107
  });
98
108
  test('should default {label} property', function () {
99
109
  var subject = /*#__PURE__*/(0, _jsxRuntime.jsx)(Kind, {
@@ -107,47 +117,57 @@ describe('kind', function () {
107
117
  // Explicitly testing for undefined
108
118
  // eslint-disable-next-line no-undefined
109
119
  var subject = /*#__PURE__*/(0, _jsxRuntime.jsx)(Kind, {
110
- prop: 1,
111
- label: undefined
120
+ label: undefined,
121
+ prop: 1
112
122
  });
113
123
  var expected = 'Label';
114
124
  var actual = subject.props.label;
115
125
  expect(actual).toBe(expected);
116
126
  });
117
127
  test('should add className defined in styles', function () {
118
- var subject = (0, _enzyme.mount)( /*#__PURE__*/(0, _jsxRuntime.jsx)(Kind, {
128
+ (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(Kind, {
119
129
  prop: 1
120
130
  }));
121
131
  var expected = 'kind';
122
- var actual = subject.find('div').prop('className');
123
- expect(actual).toBe(expected);
132
+
133
+ var kindDiv = _react.screen.getByTitle('Label');
134
+
135
+ expect(kindDiv).toHaveClass(expected);
124
136
  });
125
137
  test('should compute {value} property', function () {
126
- var subject = (0, _enzyme.mount)( /*#__PURE__*/(0, _jsxRuntime.jsx)(Kind, {
138
+ (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(Kind, {
127
139
  prop: 1
128
140
  }));
129
- var expected = 2;
130
- var actual = subject.find('div').prop('children');
131
- expect(actual).toBe(expected);
141
+ var expected = '2';
142
+
143
+ var kindDiv = _react.screen.getByTitle('Label');
144
+
145
+ expect(kindDiv).toHaveTextContent(expected);
132
146
  });
133
147
  test('should support contextType in handlers', function () {
134
148
  var onClick = jest.fn();
135
- var subject = (0, _enzyme.mount)( /*#__PURE__*/(0, _jsxRuntime.jsx)(Kind, {
136
- prop: 1,
137
- onClick: onClick
149
+ (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(Kind, {
150
+ onClick: onClick,
151
+ prop: 1
138
152
  }));
139
- subject.find('div').invoke('onClick')();
153
+
154
+ var kindDiv = _react.screen.getByTitle('Label');
155
+
156
+ _userEvent["default"].click(kindDiv);
157
+
140
158
  var expected = 'initial';
141
159
  var actual = onClick.mock.calls[0][0];
142
160
  expect(actual).toBe(expected);
143
161
  });
144
162
  test('should support contextType in computed', function () {
145
- var subject = (0, _enzyme.mount)( /*#__PURE__*/(0, _jsxRuntime.jsx)(Kind, {
163
+ (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(Kind, {
146
164
  prop: 1
147
165
  }));
148
166
  var expected = 'contextinitial';
149
- var actual = subject.find('div').prop('data-context');
150
- expect(actual).toBe(expected);
167
+
168
+ var kindDiv = _react.screen.getByTitle('Label');
169
+
170
+ expect(kindDiv).toHaveAttribute('data-context', expected);
151
171
  });
152
172
  test('support using hooks within kind instances', function () {
153
173
  var Comp = (0, _kind["default"])({
@@ -155,12 +175,13 @@ describe('kind', function () {
155
175
  functional: true,
156
176
  render: function render() {
157
177
  // eslint-disable-next-line react-hooks/rules-of-hooks
158
- var _useState = (0, _react.useState)(0),
178
+ var _useState = (0, _react2.useState)(0),
159
179
  _useState2 = _slicedToArray(_useState, 2),
160
180
  state = _useState2[0],
161
181
  setState = _useState2[1];
162
182
 
163
183
  return /*#__PURE__*/(0, _jsxRuntime.jsx)("button", {
184
+ "data-testid": "button",
164
185
  onClick: function onClick() {
165
186
  return setState(state + 1);
166
187
  },
@@ -168,11 +189,14 @@ describe('kind', function () {
168
189
  });
169
190
  }
170
191
  });
171
- var subject = (0, _enzyme.mount)( /*#__PURE__*/(0, _jsxRuntime.jsx)(Comp, {}));
172
- subject.find('button').invoke('onClick')();
173
- var expected = 1;
174
- var actual = subject.find('button').prop('children');
175
- expect(actual).toBe(expected);
192
+ (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(Comp, {}));
193
+
194
+ var button = _react.screen.getByTestId('button');
195
+
196
+ _userEvent["default"].click(button);
197
+
198
+ var expected = '1';
199
+ expect(button).toHaveTextContent(expected);
176
200
  });
177
201
  describe('inline', function () {
178
202
  test('should support a minimal kind', function () {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@enact/core",
3
- "version": "4.1.2",
3
+ "version": "4.5.0-alpha.1",
4
4
  "description": "Enact is an open source JavaScript framework containing everything you need to create a fast, scalable mobile or web application.",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -25,13 +25,13 @@
25
25
  }
26
26
  },
27
27
  "dependencies": {
28
- "classnames": "^2.2.5",
29
- "invariant": "^2.2.2",
30
- "prop-types": "^15.7.2",
31
- "ramda": "^0.24.1",
32
- "react": "^17.0.1",
33
- "react-dom": "^17.0.1",
34
- "react-is": "^17.0.1",
28
+ "classnames": "^2.3.1",
29
+ "invariant": "^2.2.4",
30
+ "prop-types": "^15.8.1",
31
+ "ramda": "^0.28.0",
32
+ "react": "^18.0.0",
33
+ "react-dom": "^18.0.0",
34
+ "react-is": "^18.0.0",
35
35
  "warning": "^4.0.3"
36
36
  }
37
37
  }
@@ -21,9 +21,9 @@ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToAr
21
21
 
22
22
  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; }
23
23
 
24
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
24
+ 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; }
25
25
 
26
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
26
+ 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; }
27
27
 
28
28
  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; }
29
29
 
@@ -16,9 +16,11 @@ and is executed in order once the window is available.
16
16
  *
17
17
  * _Important Notes_
18
18
  * * The callback should not alter the initial HTML state. If it does, it will invalidate the
19
- pre-render state and interfere with React rehydration.
19
+ *
20
+ * pre-render state and interfere with React rehydration.
20
21
  * * The callback should be limited to module-scoped actions and not component instance actions. If
21
- the action is tied to a component, it should be invoked from within the component's lifecycle
22
+ *
23
+ * the action is tied to a component, it should be invoked from within the component's lifecycle
22
24
  methods.
23
25
  */
24
26
  export function onWindowReady(callback: Function): void;
@@ -3,10 +3,10 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
+ exports["default"] = void 0;
6
7
  exports.isWindowReady = isWindowReady;
7
8
  exports.onWindowReady = onWindowReady;
8
9
  exports.windowReady = windowReady;
9
- exports["default"] = void 0;
10
10
 
11
11
  var _invariant = _interopRequireDefault(require("invariant"));
12
12
 
@@ -79,7 +79,7 @@ function onWindowReady(callback) {
79
79
 
80
80
 
81
81
  function windowReady() {
82
- !isWindowReady() ? process.env.NODE_ENV !== "production" ? (0, _invariant["default"])(false, 'windowReady cannot be run until the window is available') : invariant(false) : void 0;
82
+ !isWindowReady() ? process.env.NODE_ENV !== "production" ? (0, _invariant["default"])(false, 'windowReady cannot be run until the window is available') : (0, _invariant["default"])(false) : void 0;
83
83
  windowCallbacks.forEach(function (f) {
84
84
  return f();
85
85
  });
@@ -1,8 +1,10 @@
1
1
  "use strict";
2
2
 
3
- var _enzyme = require("enzyme");
3
+ require("@testing-library/jest-dom");
4
4
 
5
- var _react = require("react");
5
+ var _react = require("@testing-library/react");
6
+
7
+ var _react2 = require("react");
6
8
 
7
9
  var _useChainRefs = _interopRequireDefault(require("../useChainRefs"));
8
10
 
@@ -33,14 +35,14 @@ describe('useChainRefs', function () {
33
35
 
34
36
  test('should call a single functional ref', function () {
35
37
  var ref = jest.fn();
36
- (0, _enzyme.mount)( /*#__PURE__*/(0, _jsxRuntime.jsx)(Component, {
38
+ (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(Component, {
37
39
  refs: [ref]
38
40
  }));
39
41
  expect(ref).toHaveBeenCalledTimes(1);
40
42
  });
41
43
  test('should call a single object ref', function () {
42
- var ref = /*#__PURE__*/(0, _react.createRef)();
43
- (0, _enzyme.mount)( /*#__PURE__*/(0, _jsxRuntime.jsx)(Component, {
44
+ var ref = /*#__PURE__*/(0, _react2.createRef)();
45
+ (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(Component, {
44
46
  refs: [ref]
45
47
  }));
46
48
  var expected = 'DIV';
@@ -50,7 +52,7 @@ describe('useChainRefs', function () {
50
52
  test('should ignore invalid refs', function () {
51
53
  var invalid = {};
52
54
  var ref = jest.fn();
53
- (0, _enzyme.mount)( /*#__PURE__*/(0, _jsxRuntime.jsx)(Component, {
55
+ (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(Component, {
54
56
  refs: [invalid, ref]
55
57
  }));
56
58
  expect(ref).toHaveBeenCalledTimes(1);
@@ -3,9 +3,9 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.useChainRefs = useChainRefs;
7
6
  exports.chainRefs = chainRefs;
8
7
  exports["default"] = void 0;
8
+ exports.useChainRefs = useChainRefs;
9
9
 
10
10
  var _react = require("react");
11
11