@enact/core
Advanced tools
Comparing version 4.7.0 to 4.7.1
@@ -5,2 +5,10 @@ # Change Log | ||
## [4.7.1] - 2023-06-02 | ||
No significant changes. | ||
## [4.5.3] - 2023-04-06 | ||
No significant changes. | ||
## [4.7.0] - 2023-04-25 | ||
@@ -7,0 +15,0 @@ |
@@ -10,2 +10,4 @@ "use strict"; | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } | ||
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } | ||
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; } | ||
@@ -120,3 +122,4 @@ 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; } | ||
HandlesNotification.contextType = SomeContext; | ||
test('should increment child on click', function () { | ||
test('should increment child on click', /*#__PURE__*/_asyncToGenerator(function* () { | ||
var user = _userEvent["default"].setup(); | ||
(0, _react2.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(NotifiesTree, { | ||
@@ -128,8 +131,9 @@ "data-testid": "a-btn", | ||
})); | ||
_userEvent["default"].click(_react2.screen.getByTestId('a-btn')); | ||
yield user.click(_react2.screen.getByTestId('a-btn')); | ||
var expected = '1'; | ||
var child = _react2.screen.getByTestId('a'); | ||
expect(child).toHaveTextContent(expected); | ||
}); | ||
test('should increment both children on top click', function () { | ||
})); | ||
test('should increment both children on top click', /*#__PURE__*/_asyncToGenerator(function* () { | ||
var user = _userEvent["default"].setup(); | ||
(0, _react2.render)( /*#__PURE__*/(0, _jsxRuntime.jsxs)(NotifiesTree, { | ||
@@ -146,3 +150,3 @@ "data-testid": "a-btn", | ||
})); | ||
_userEvent["default"].click(_react2.screen.getByTestId('a-btn')); | ||
yield user.click(_react2.screen.getByTestId('a-btn')); | ||
var expected = '1'; | ||
@@ -153,4 +157,5 @@ var childA = _react2.screen.getByTestId('a'); | ||
expect(childB).toHaveTextContent(expected); | ||
}); | ||
test('should increment the deepest child when we click child button', function () { | ||
})); | ||
test('should increment the deepest child when we click child button', /*#__PURE__*/_asyncToGenerator(function* () { | ||
var user = _userEvent["default"].setup(); | ||
(0, _react2.render)( /*#__PURE__*/(0, _jsxRuntime.jsxs)(NotifiesTree, { | ||
@@ -167,3 +172,3 @@ "data-testid": "a-btn", | ||
})); | ||
_userEvent["default"].click(_react2.screen.getByTestId('b-btn')); | ||
yield user.click(_react2.screen.getByTestId('b-btn')); | ||
var expectedA = '0'; | ||
@@ -175,4 +180,5 @@ var expectedB = '1'; | ||
expect(childB).toHaveTextContent(expectedB); | ||
}); | ||
test('should support removing children without error', function () { | ||
})); | ||
test('should support removing children without error', /*#__PURE__*/_asyncToGenerator(function* () { | ||
var user = _userEvent["default"].setup(); | ||
var _render = (0, _react2.render)( /*#__PURE__*/(0, _jsxRuntime.jsxs)(NotifiesTree, { | ||
@@ -187,3 +193,3 @@ "data-testid": "a-btn", | ||
rerender = _render.rerender; | ||
_userEvent["default"].click(_react2.screen.getByTestId('a-btn')); | ||
yield user.click(_react2.screen.getByTestId('a-btn')); | ||
@@ -197,7 +203,7 @@ // changing children should be safe and not throw errors when notifying instances | ||
})); | ||
_userEvent["default"].click(_react2.screen.getByTestId('a-btn')); | ||
yield user.click(_react2.screen.getByTestId('a-btn')); | ||
var expectedC = '1'; | ||
var childC = _react2.screen.getByTestId('c'); | ||
expect(childC).toHaveTextContent(expectedC); | ||
}); | ||
})); | ||
}); |
@@ -18,2 +18,4 @@ "use strict"; | ||
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } | ||
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } | ||
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } | ||
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; } | ||
@@ -123,4 +125,5 @@ 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; } | ||
}); | ||
test('should support contextType in handlers', function () { | ||
test('should support contextType in handlers', /*#__PURE__*/_asyncToGenerator(function* () { | ||
var onClick = jest.fn(); | ||
var user = _userEvent["default"].setup(); | ||
(0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(Kind, { | ||
@@ -131,7 +134,7 @@ onClick: onClick, | ||
var kindDiv = _react.screen.getByTitle('Label'); | ||
_userEvent["default"].click(kindDiv); | ||
yield user.click(kindDiv); | ||
var expected = 'initial'; | ||
var actual = onClick.mock.calls[0][0]; | ||
expect(actual).toBe(expected); | ||
}); | ||
})); | ||
test('should support contextType in computed', function () { | ||
@@ -145,3 +148,4 @@ (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(Kind, { | ||
}); | ||
test('support using hooks within kind instances', function () { | ||
test('support using hooks within kind instances', /*#__PURE__*/_asyncToGenerator(function* () { | ||
var user = _userEvent["default"].setup(); | ||
var Comp = (0, _kind["default"])({ | ||
@@ -167,6 +171,6 @@ name: 'Comp', | ||
var button = _react.screen.getByTestId('button'); | ||
_userEvent["default"].click(button); | ||
yield user.click(button); | ||
var expected = '1'; | ||
expect(button).toHaveTextContent(expected); | ||
}); | ||
})); | ||
describe('inline', function () { | ||
@@ -173,0 +177,0 @@ test('should support a minimal kind', function () { |
{ | ||
"name": "@enact/core", | ||
"version": "4.7.0", | ||
"version": "4.7.1", | ||
"description": "Enact is an open source JavaScript framework containing everything you need to create a fast, scalable mobile or web application.", | ||
@@ -37,3 +37,3 @@ "repository": { | ||
"prop-types": "^15.8.1", | ||
"ramda": "^0.28.0", | ||
"ramda": "^0.29.0", | ||
"react": "^18.2.0", | ||
@@ -40,0 +40,0 @@ "react-dom": "^18.2.0", |
@@ -17,3 +17,3 @@ # @enact/core [![npm (scoped)](https://img.shields.io/npm/v/@enact/core.svg?style=flat-square)](https://www.npmjs.com/package/@enact/core) | ||
Tests are implemented in mocha and are run with the Karma runner. | ||
Unit tests are implemented in Testing Library and are run with Jest. To execute them: | ||
@@ -20,0 +20,0 @@ ``` |
248
util/Job.js
@@ -36,2 +36,12 @@ "use strict"; | ||
this.type = null; | ||
/** | ||
* Starts the job. | ||
* | ||
* @method | ||
* @param {...*} [args] Any args passed are forwarded to the callback | ||
* | ||
* @returns {undefined} | ||
* @memberof core/util.Job.prototype | ||
* @public | ||
*/ | ||
this.start = function () { | ||
@@ -43,2 +53,14 @@ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { | ||
}; | ||
/** | ||
* Starts the job in `timeout` milliseconds | ||
* | ||
* @method | ||
* @param {Number} timeout The number of milliseconds to wait before starting the job. | ||
* This supersedes the timeout set at construction. | ||
* @param {...*} [args] Any args passed are forwarded to the callback | ||
* | ||
* @returns {undefined} | ||
* @memberof core/util.Job.prototype | ||
* @public | ||
*/ | ||
this.startAfter = function (timeout) { | ||
@@ -54,2 +76,11 @@ for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) { | ||
}; | ||
/** | ||
* Stops the job. | ||
* | ||
* @method | ||
* | ||
* @returns {undefined} | ||
* @memberof core/util.Job.prototype | ||
* @public | ||
*/ | ||
this.stop = function () { | ||
@@ -67,2 +98,13 @@ if (_this.id) { | ||
}; | ||
/** | ||
* Executes the job immediately, then prevents any other calls to `throttle()` from running | ||
* until the `timeout` configured at construction passes. | ||
* | ||
* @method | ||
* @param {...*} args Any args passed are forwarded to the callback | ||
* | ||
* @returns {undefined} | ||
* @memberof core/util.Job.prototype | ||
* @public | ||
*/ | ||
this.throttle = function () { | ||
@@ -74,2 +116,15 @@ for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) { | ||
}; | ||
/** | ||
* Executes the job immediately, then prevents any other calls to `throttle()` from running for | ||
* `timeout` milliseconds. | ||
* | ||
* @method | ||
* @param {Number} timeout The number of milliseconds to wait before allowing the job to | ||
* be ran again. This supersedes the timeout set at construction. | ||
* @param {...*} [args] Any args passed are forwarded to the callback | ||
* | ||
* @returns {undefined} | ||
* @memberof core/util.Job.prototype | ||
* @public | ||
*/ | ||
this.throttleUntil = function (timeout) { | ||
@@ -85,2 +140,12 @@ if (!_this.id) { | ||
}; | ||
/** | ||
* Executes job when the CPU is idle. | ||
* | ||
* @method | ||
* @param {...*} [args] Any args passed are forwarded to the callback | ||
* | ||
* @returns {undefined} | ||
* @memberof core/util.Job.prototype | ||
* @public | ||
*/ | ||
this.idle = function () { | ||
@@ -92,2 +157,15 @@ for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) { | ||
}; | ||
/** | ||
* Executes job when the CPU is idle, or when the timeout is reached, whichever occurs first. | ||
* | ||
* @method | ||
* @param {Number} timeout The number of milliseconds to wait before executing the | ||
* job. This guarantees that the job is run, if a positive value | ||
* is specified. | ||
* @param {...*} [args] Any args passed are forwarded to the callback | ||
* | ||
* @returns {undefined} | ||
* @memberof core/util.Job.prototype | ||
* @public | ||
*/ | ||
this.idleUntil = function (timeout) { | ||
@@ -110,2 +188,12 @@ for (var _len6 = arguments.length, args = new Array(_len6 > 1 ? _len6 - 1 : 0), _key6 = 1; _key6 < _len6; _key6++) { | ||
}; | ||
/** | ||
* Executes job before the next repaint. | ||
* | ||
* @method | ||
* @param {...*} [args] Any args passed are forwarded to the callback | ||
* | ||
* @returns {undefined} | ||
* @memberof core/util.Job.prototype | ||
* @public | ||
*/ | ||
this.startRaf = function () { | ||
@@ -117,2 +205,13 @@ for (var _len7 = arguments.length, args = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) { | ||
}; | ||
/** | ||
* Executes job before the next repaint after a given amount of timeout. | ||
* | ||
* @method | ||
* @param {Number} timeout The number of milliseconds to wait before running `requestAnimationFrame`. | ||
* @param {...*} [args] Any args passed are forwarded to the callback | ||
* | ||
* @returns {undefined} | ||
* @memberof core/util.Job.prototype | ||
* @public | ||
*/ | ||
this.startRafAfter = function (timeout) { | ||
@@ -144,2 +243,22 @@ for (var _len8 = arguments.length, args = new Array(_len8 > 1 ? _len8 - 1 : 0), _key8 = 1; _key8 < _len8; _key8++) { | ||
}; | ||
/** | ||
* Starts the job when `promise` resolves. | ||
* | ||
* The job execution is tied to the resolution of the last `Promise` passed. Like other methods | ||
* on `Job`, calling `promise()` again with a new `Promise` will block execution of the job | ||
* until that new `Promise` resolves. Any previous `Promise`s will still resolve normally but | ||
* will not trigger job execution. | ||
* | ||
* Unlike other methods on `Job`, `promise()` returns a `Promise` which is the result of calling | ||
* `then()` on the passed `promise`. That `Promise` resolves with either the result of job | ||
* execution or `undefined` if `Promise` was superseded by a subsequent `Promise` passed as | ||
* described above. | ||
* | ||
* @method | ||
* @param {Promise} promise The promise that must resolve before the job is executed | ||
* | ||
* @returns {Promise} | ||
* @memberof core/util.Job.prototype | ||
* @public | ||
*/ | ||
this.promise = function (promise) { | ||
@@ -165,131 +284,2 @@ !(promise && typeof promise.then === 'function') ? process.env.NODE_ENV !== "production" ? (0, _invariant["default"])(false, 'promise expects a thenable') : (0, _invariant["default"])(false) : void 0; | ||
} | ||
/** | ||
* Starts the job. | ||
* | ||
* @method | ||
* @param {...*} [args] Any args passed are forwarded to the callback | ||
* | ||
* @returns {undefined} | ||
* @memberof core/util.Job.prototype | ||
* @public | ||
*/ | ||
/** | ||
* Starts the job in `timeout` milliseconds | ||
* | ||
* @method | ||
* @param {Number} timeout The number of milliseconds to wait before starting the job. | ||
* This supersedes the timeout set at construction. | ||
* @param {...*} [args] Any args passed are forwarded to the callback | ||
* | ||
* @returns {undefined} | ||
* @memberof core/util.Job.prototype | ||
* @public | ||
*/ | ||
/** | ||
* Stops the job. | ||
* | ||
* @method | ||
* | ||
* @returns {undefined} | ||
* @memberof core/util.Job.prototype | ||
* @public | ||
*/ | ||
/** | ||
* Executes the job immediately, then prevents any other calls to `throttle()` from running | ||
* until the `timeout` configured at construction passes. | ||
* | ||
* @method | ||
* @param {...*} args Any args passed are forwarded to the callback | ||
* | ||
* @returns {undefined} | ||
* @memberof core/util.Job.prototype | ||
* @public | ||
*/ | ||
/** | ||
* Executes the job immediately, then prevents any other calls to `throttle()` from running for | ||
* `timeout` milliseconds. | ||
* | ||
* @method | ||
* @param {Number} timeout The number of milliseconds to wait before allowing the job to | ||
* be ran again. This supersedes the timeout set at construction. | ||
* @param {...*} [args] Any args passed are forwarded to the callback | ||
* | ||
* @returns {undefined} | ||
* @memberof core/util.Job.prototype | ||
* @public | ||
*/ | ||
/** | ||
* Executes job when the CPU is idle. | ||
* | ||
* @method | ||
* @param {...*} [args] Any args passed are forwarded to the callback | ||
* | ||
* @returns {undefined} | ||
* @memberof core/util.Job.prototype | ||
* @public | ||
*/ | ||
/** | ||
* Executes job when the CPU is idle, or when the timeout is reached, whichever occurs first. | ||
* | ||
* @method | ||
* @param {Number} timeout The number of milliseconds to wait before executing the | ||
* job. This guarantees that the job is run, if a positive value | ||
* is specified. | ||
* @param {...*} [args] Any args passed are forwarded to the callback | ||
* | ||
* @returns {undefined} | ||
* @memberof core/util.Job.prototype | ||
* @public | ||
*/ | ||
/** | ||
* Executes job before the next repaint. | ||
* | ||
* @method | ||
* @param {...*} [args] Any args passed are forwarded to the callback | ||
* | ||
* @returns {undefined} | ||
* @memberof core/util.Job.prototype | ||
* @public | ||
*/ | ||
/** | ||
* Executes job before the next repaint after a given amount of timeout. | ||
* | ||
* @method | ||
* @param {Number} timeout The number of milliseconds to wait before running `requestAnimationFrame`. | ||
* @param {...*} [args] Any args passed are forwarded to the callback | ||
* | ||
* @returns {undefined} | ||
* @memberof core/util.Job.prototype | ||
* @public | ||
*/ | ||
/** | ||
* Starts the job when `promise` resolves. | ||
* | ||
* The job execution is tied to the resolution of the last `Promise` passed. Like other methods | ||
* on `Job`, calling `promise()` again with a new `Promise` will block execution of the job | ||
* until that new `Promise` resolves. Any previous `Promise`s will still resolve normally but | ||
* will not trigger job execution. | ||
* | ||
* Unlike other methods on `Job`, `promise()` returns a `Promise` which is the result of calling | ||
* `then()` on the passed `promise`. That `Promise` resolves with either the result of job | ||
* execution or `undefined` if `Promise` was superseded by a subsequent `Promise` passed as | ||
* described above. | ||
* | ||
* @method | ||
* @param {Promise} promise The promise that must resolve before the job is executed | ||
* | ||
* @returns {Promise} | ||
* @memberof core/util.Job.prototype | ||
* @public | ||
*/ | ||
}]); | ||
@@ -296,0 +286,0 @@ return Job; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
302861
7223
+ Addedramda@0.29.1(transitive)
- Removedramda@0.28.0(transitive)
Updatedramda@^0.29.0