@enact/core 4.5.0-alpha.1 → 4.5.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/internal/ApiDecorator/ApiDecorator.js +2 -2
- package/internal/ApiDecorator/tests/ApiDecorator-specs.js +2 -2
- package/internal/Registry/tests/Registry-specs.js +2 -2
- package/kind/kind.js +2 -2
- package/package.json +1 -1
- package/useClass/useClass.js +2 -2
- package/util/tests/Job-specs.js +50 -24
- package/util/tests/util-specs.js +10 -10
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
The following is a curated list of changes in the Enact core module, newest changes on the top.
|
|
4
4
|
|
|
5
|
+
## [4.5.0-rc.1] - 2022-06-23
|
|
6
|
+
|
|
7
|
+
No significant changes.
|
|
8
|
+
|
|
9
|
+
## [4.5.0-beta.1] - 2022-05-31
|
|
10
|
+
|
|
11
|
+
No significant changes.
|
|
12
|
+
|
|
13
|
+
## [4.5.0-alpha.2] - 2022-05-09
|
|
14
|
+
|
|
15
|
+
No significant changes.
|
|
16
|
+
|
|
5
17
|
## [4.5.0-alpha.1] - 2022-04-15
|
|
6
18
|
|
|
7
19
|
No significant changes.
|
|
@@ -29,7 +29,7 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
|
|
|
29
29
|
|
|
30
30
|
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); }
|
|
31
31
|
|
|
32
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf
|
|
32
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
33
33
|
|
|
34
34
|
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); }; }
|
|
35
35
|
|
|
@@ -39,7 +39,7 @@ function _assertThisInitialized(self) { if (self === void 0) { throw new Referen
|
|
|
39
39
|
|
|
40
40
|
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; } }
|
|
41
41
|
|
|
42
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
42
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
43
43
|
|
|
44
44
|
// Gets a property from `provider`
|
|
45
45
|
var get = function get(provider, name) {
|
|
@@ -18,7 +18,7 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
|
|
|
18
18
|
|
|
19
19
|
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); }
|
|
20
20
|
|
|
21
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf
|
|
21
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
22
22
|
|
|
23
23
|
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); }; }
|
|
24
24
|
|
|
@@ -28,7 +28,7 @@ function _assertThisInitialized(self) { if (self === void 0) { throw new Referen
|
|
|
28
28
|
|
|
29
29
|
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; } }
|
|
30
30
|
|
|
31
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
31
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
32
32
|
|
|
33
33
|
describe('ApiDecorator', function () {
|
|
34
34
|
var _class;
|
|
@@ -28,7 +28,7 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
|
|
|
28
28
|
|
|
29
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); }
|
|
30
30
|
|
|
31
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf
|
|
31
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
32
32
|
|
|
33
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); }; }
|
|
34
34
|
|
|
@@ -38,7 +38,7 @@ function _assertThisInitialized(self) { if (self === void 0) { throw new Referen
|
|
|
38
38
|
|
|
39
39
|
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; } }
|
|
40
40
|
|
|
41
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
41
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
42
42
|
|
|
43
43
|
var SomeContext = /*#__PURE__*/(0, _react.createContext)();
|
|
44
44
|
describe('Registry', function () {
|
package/kind/kind.js
CHANGED
|
@@ -25,7 +25,7 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
|
|
|
25
25
|
|
|
26
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
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf
|
|
28
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : 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
|
|
|
@@ -35,7 +35,7 @@ function _assertThisInitialized(self) { if (self === void 0) { throw new Referen
|
|
|
35
35
|
|
|
36
36
|
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; } }
|
|
37
37
|
|
|
38
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
38
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
39
39
|
|
|
40
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
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@enact/core",
|
|
3
|
-
"version": "4.5.0-
|
|
3
|
+
"version": "4.5.0-rc.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": {
|
package/useClass/useClass.js
CHANGED
|
@@ -8,11 +8,11 @@ exports.useClass = useClass;
|
|
|
8
8
|
|
|
9
9
|
var _react = require("react");
|
|
10
10
|
|
|
11
|
-
function _construct(Parent, args, Class) { if (_isNativeReflectConstruct()) { _construct = Reflect.construct; } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); }
|
|
11
|
+
function _construct(Parent, args, Class) { if (_isNativeReflectConstruct()) { _construct = Reflect.construct.bind(); } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); }
|
|
12
12
|
|
|
13
13
|
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; } }
|
|
14
14
|
|
|
15
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf
|
|
15
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
* Creates one instance of the class, `Ctor` with the provided `args`, for the life of the
|
package/util/tests/Job-specs.js
CHANGED
|
@@ -1,14 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _react = require("@testing-library/react");
|
|
4
|
+
|
|
3
5
|
var _Job = _interopRequireDefault(require("../Job"));
|
|
4
6
|
|
|
5
7
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
6
8
|
|
|
7
9
|
describe('Job', function () {
|
|
10
|
+
beforeEach(function () {
|
|
11
|
+
jest.useFakeTimers();
|
|
12
|
+
});
|
|
13
|
+
afterEach(function () {
|
|
14
|
+
jest.useRealTimers();
|
|
15
|
+
});
|
|
8
16
|
describe('#start', function () {
|
|
9
17
|
test('should start job', function (done) {
|
|
10
18
|
var j = new _Job["default"](done, 10);
|
|
11
19
|
j.start();
|
|
20
|
+
jest.runAllTimers();
|
|
12
21
|
});
|
|
13
22
|
test('should pass args to fn', function (done) {
|
|
14
23
|
var value = 'argument';
|
|
@@ -23,6 +32,7 @@ describe('Job', function () {
|
|
|
23
32
|
|
|
24
33
|
var j = new _Job["default"](fn, 10);
|
|
25
34
|
j.start(value);
|
|
35
|
+
jest.runAllTimers();
|
|
26
36
|
});
|
|
27
37
|
});
|
|
28
38
|
describe('#stop', function () {
|
|
@@ -34,9 +44,10 @@ describe('Job', function () {
|
|
|
34
44
|
}, 10);
|
|
35
45
|
j.start();
|
|
36
46
|
j.stop();
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}
|
|
47
|
+
(0, _react.act)(function () {
|
|
48
|
+
return jest.advanceTimersByTime(30);
|
|
49
|
+
});
|
|
50
|
+
if (!ran) done();
|
|
40
51
|
});
|
|
41
52
|
});
|
|
42
53
|
describe('#throttle', function () {
|
|
@@ -46,22 +57,27 @@ describe('Job', function () {
|
|
|
46
57
|
number++;
|
|
47
58
|
}, 20);
|
|
48
59
|
j.throttle();
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
60
|
+
(0, _react.act)(function () {
|
|
61
|
+
return jest.advanceTimersByTime(5);
|
|
62
|
+
});
|
|
63
|
+
j.throttle();
|
|
64
|
+
(0, _react.act)(function () {
|
|
65
|
+
return jest.advanceTimersByTime(10);
|
|
66
|
+
});
|
|
67
|
+
j.throttle();
|
|
68
|
+
(0, _react.act)(function () {
|
|
69
|
+
return jest.advanceTimersByTime(10);
|
|
70
|
+
});
|
|
71
|
+
j.throttle();
|
|
72
|
+
(0, _react.act)(function () {
|
|
73
|
+
return jest.advanceTimersByTime(5);
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
if (number === 2) {
|
|
77
|
+
done();
|
|
78
|
+
} else {
|
|
79
|
+
done(new Error('too many or too few calls' + number));
|
|
80
|
+
}
|
|
65
81
|
});
|
|
66
82
|
test('should pass args to fn', function (done) {
|
|
67
83
|
var value = 'argument';
|
|
@@ -98,6 +114,7 @@ describe('Job', function () {
|
|
|
98
114
|
test('should start job', function (done) {
|
|
99
115
|
var j = new _Job["default"](done, 10);
|
|
100
116
|
j.idle();
|
|
117
|
+
jest.runAllTimers();
|
|
101
118
|
});
|
|
102
119
|
test('should pass args to fn', function (done) {
|
|
103
120
|
var value = 'argument';
|
|
@@ -112,6 +129,7 @@ describe('Job', function () {
|
|
|
112
129
|
|
|
113
130
|
var j = new _Job["default"](fn, 10);
|
|
114
131
|
j.idle(value);
|
|
132
|
+
jest.runAllTimers();
|
|
115
133
|
});
|
|
116
134
|
test('should clear an existing job id before starting job', function (done) {
|
|
117
135
|
var fn = function fn(arg) {
|
|
@@ -125,6 +143,7 @@ describe('Job', function () {
|
|
|
125
143
|
var j = new _Job["default"](fn);
|
|
126
144
|
j.idle('first');
|
|
127
145
|
j.idle('second');
|
|
146
|
+
jest.runAllTimers();
|
|
128
147
|
});
|
|
129
148
|
});
|
|
130
149
|
describe('#promise', function () {
|
|
@@ -165,7 +184,10 @@ describe('Job', function () {
|
|
|
165
184
|
done(new Error('Job ran for rejected promise'));
|
|
166
185
|
});
|
|
167
186
|
j.promise(Promise.reject(true))["catch"](function () {});
|
|
168
|
-
|
|
187
|
+
(0, _react.act)(function () {
|
|
188
|
+
return jest.advanceTimersByTime(10);
|
|
189
|
+
});
|
|
190
|
+
done();
|
|
169
191
|
});
|
|
170
192
|
test('should not start job when stopped before promise resolves', function (done) {
|
|
171
193
|
var j = new _Job["default"](function () {
|
|
@@ -174,10 +196,14 @@ describe('Job', function () {
|
|
|
174
196
|
j.promise(new Promise(function (resolve) {
|
|
175
197
|
return setTimeout(resolve, 20);
|
|
176
198
|
}));
|
|
177
|
-
|
|
178
|
-
return
|
|
179
|
-
}
|
|
180
|
-
|
|
199
|
+
(0, _react.act)(function () {
|
|
200
|
+
return jest.advanceTimersByTime(10);
|
|
201
|
+
});
|
|
202
|
+
j.stop();
|
|
203
|
+
(0, _react.act)(function () {
|
|
204
|
+
return jest.advanceTimersByTime(20);
|
|
205
|
+
});
|
|
206
|
+
done();
|
|
181
207
|
});
|
|
182
208
|
test('should not start job when another is started', function (done) {
|
|
183
209
|
var j = new _Job["default"](function (value) {
|
package/util/tests/util-specs.js
CHANGED
|
@@ -8,28 +8,28 @@ describe('util', function () {
|
|
|
8
8
|
describe('isRenderable', function () {
|
|
9
9
|
test('should return {true} for function', function () {
|
|
10
10
|
var expected = true;
|
|
11
|
-
var
|
|
12
|
-
expect(
|
|
11
|
+
var view = (0, _util.isRenderable)(function () {});
|
|
12
|
+
expect(view).toEqual(expected);
|
|
13
13
|
});
|
|
14
14
|
test('should return {true} for string', function () {
|
|
15
15
|
var expected = true;
|
|
16
|
-
var
|
|
17
|
-
expect(
|
|
16
|
+
var view = (0, _util.isRenderable)('div');
|
|
17
|
+
expect(view).toEqual(expected);
|
|
18
18
|
});
|
|
19
19
|
test('should return {true} for React.forwardRef', function () {
|
|
20
20
|
var expected = true;
|
|
21
|
-
var
|
|
22
|
-
expect(
|
|
21
|
+
var view = (0, _util.isRenderable)( /*#__PURE__*/(0, _react.forwardRef)(function () {}));
|
|
22
|
+
expect(view).toEqual(expected);
|
|
23
23
|
});
|
|
24
24
|
test('should return {true} for React.memo', function () {
|
|
25
25
|
var expected = true;
|
|
26
|
-
var
|
|
27
|
-
expect(
|
|
26
|
+
var view = (0, _util.isRenderable)( /*#__PURE__*/(0, _react.memo)(function () {}));
|
|
27
|
+
expect(view).toEqual(expected);
|
|
28
28
|
});
|
|
29
29
|
test('should return {true} for React.lazy', function () {
|
|
30
30
|
var expected = true;
|
|
31
|
-
var
|
|
32
|
-
expect(
|
|
31
|
+
var view = (0, _util.isRenderable)( /*#__PURE__*/(0, _react.lazy)(function () {}));
|
|
32
|
+
expect(view).toEqual(expected);
|
|
33
33
|
});
|
|
34
34
|
});
|
|
35
35
|
describe('memoize', function () {
|