@pingux/astro 2.85.0 → 2.86.0-alpha.0
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/lib/cjs/components/AccordionGridGroup/AccordionGridGroup.test.js +3 -1
- package/lib/cjs/components/AstroProvider/AstroProvider.js +13 -19
- package/lib/cjs/components/Box/Box.js +11 -11
- package/lib/cjs/components/Button/Button.js +4 -6
- package/lib/cjs/components/Button/Button.test.js +46 -10
- package/lib/cjs/components/CodeEditor/CodeEditor.test.js +20 -0
- package/lib/cjs/components/CodeView/CodeView.test.js +18 -6
- package/lib/cjs/components/ColorField/ColorField.js +4 -6
- package/lib/cjs/components/CopyText/CopyText.test.js +21 -23
- package/lib/cjs/components/DataTable/DataTable.test.js +39 -34
- package/lib/cjs/components/FieldHelperText/FieldHelperText.js +3 -1
- package/lib/cjs/components/HelpHint/HelpHint.test.js +25 -13
- package/lib/cjs/components/Image/Image.js +1 -2
- package/lib/cjs/components/ImageUploadField/ImageUploadField.test.js +6 -2
- package/lib/cjs/components/ListView/ListView.test.js +3 -1
- package/lib/cjs/components/Messages/Messages.test.js +1 -2
- package/lib/cjs/components/Messages/utils/tests/messagesReducer.test.js +1 -2
- package/lib/cjs/components/Messages/utils/tests/multiMessagesReducer.test.js +1 -2
- package/lib/cjs/components/MultivaluesField/MultivaluesField.test.js +75 -25
- package/lib/cjs/components/NavBar/NavBar.test.js +9 -3
- package/lib/cjs/components/NavSideBar/NavSideBar.test.js +15 -5
- package/lib/cjs/components/NumberField/NumberField.test.js +3 -1
- package/lib/cjs/components/PasswordField/PasswordField.js +2 -0
- package/lib/cjs/components/PasswordField/PasswordField.test.js +28 -22
- package/lib/cjs/components/PopoverContainer/PopoverContainer.js +2 -4
- package/lib/cjs/components/SelectFieldBase/SelectFieldBase.test.js +39 -18
- package/lib/cjs/components/Stepper/Line.js +4 -4
- package/lib/cjs/components/Stepper/Stepper.js +7 -5
- package/lib/cjs/components/Tab/Tab.js +2 -2
- package/lib/cjs/components/Tabs/Tabs.test.js +404 -273
- package/lib/cjs/components/TooltipTrigger/TooltipTrigger.test.js +19 -10
- package/lib/cjs/hooks/useAriaLabelWarning/useAriaLabelWarning.test.js +3 -3
- package/lib/cjs/hooks/useComponentToggle/useComponentToggle.test.js +4 -5
- package/lib/cjs/hooks/useDebounce/useDebounce.test.js +5 -5
- package/lib/cjs/hooks/useDeprecationWarning/useDeprecationWarning.test.js +8 -8
- package/lib/cjs/hooks/useDevelopmentWarning/useDevelopmentWarning.test.js +3 -3
- package/lib/cjs/hooks/useFallbackImage/useFallbackImage.test.js +4 -4
- package/lib/cjs/hooks/useField/useField.test.js +14 -14
- package/lib/cjs/hooks/useModalState/useModalState.test.js +16 -16
- package/lib/cjs/hooks/useNavBarPress/useNavBarPress.test.js +3 -3
- package/lib/cjs/hooks/useNavBarStyling/useNavBarStyling.test.js +3 -3
- package/lib/cjs/hooks/useOverlayPanelState/useOverlayPanelState.test.js +2 -2
- package/lib/cjs/hooks/usePropWarning/usePropWarning.test.js +6 -6
- package/lib/cjs/hooks/useStatusClasses/useStatusClasses.test.js +5 -5
- package/lib/cjs/hooks/useTShirtSize/useTShirtSize.test.js +6 -6
- package/lib/cjs/types/tabs.d.ts +1 -0
- package/lib/cjs/utils/testUtils/setupTests.js +3 -0
- package/lib/cjs/utils/testUtils/testWrapper.d.ts +1 -1
- package/lib/components/AccordionGridGroup/AccordionGridGroup.test.js +3 -1
- package/lib/components/AstroProvider/AstroProvider.js +13 -19
- package/lib/components/Box/Box.js +11 -11
- package/lib/components/Button/Button.js +4 -6
- package/lib/components/Button/Button.test.js +47 -11
- package/lib/components/CodeEditor/CodeEditor.test.js +20 -0
- package/lib/components/CodeView/CodeView.test.js +18 -6
- package/lib/components/ColorField/ColorField.js +4 -6
- package/lib/components/CopyText/CopyText.test.js +15 -16
- package/lib/components/DataTable/DataTable.test.js +19 -14
- package/lib/components/FieldHelperText/FieldHelperText.js +3 -1
- package/lib/components/HelpHint/HelpHint.test.js +26 -14
- package/lib/components/Image/Image.js +1 -2
- package/lib/components/ImageUploadField/ImageUploadField.test.js +7 -3
- package/lib/components/ListView/ListView.test.js +4 -2
- package/lib/components/Messages/Messages.test.js +1 -2
- package/lib/components/Messages/utils/tests/messagesReducer.test.js +1 -2
- package/lib/components/Messages/utils/tests/multiMessagesReducer.test.js +1 -2
- package/lib/components/MultivaluesField/MultivaluesField.test.js +76 -26
- package/lib/components/NavBar/NavBar.test.js +10 -4
- package/lib/components/NavSideBar/NavSideBar.test.js +16 -6
- package/lib/components/NumberField/NumberField.test.js +4 -2
- package/lib/components/PasswordField/PasswordField.js +2 -0
- package/lib/components/PasswordField/PasswordField.test.js +27 -21
- package/lib/components/PopoverContainer/PopoverContainer.js +2 -4
- package/lib/components/SelectFieldBase/SelectFieldBase.test.js +40 -17
- package/lib/components/Stepper/Line.js +3 -4
- package/lib/components/Stepper/Stepper.js +7 -5
- package/lib/components/Tab/Tab.js +2 -2
- package/lib/components/Tabs/Tabs.test.js +404 -273
- package/lib/components/TooltipTrigger/TooltipTrigger.test.js +20 -11
- package/lib/hooks/useAriaLabelWarning/useAriaLabelWarning.test.js +1 -1
- package/lib/hooks/useComponentToggle/useComponentToggle.test.js +1 -2
- package/lib/hooks/useDebounce/useDebounce.test.js +1 -1
- package/lib/hooks/useDeprecationWarning/useDeprecationWarning.test.js +1 -1
- package/lib/hooks/useDevelopmentWarning/useDevelopmentWarning.test.js +1 -1
- package/lib/hooks/useFallbackImage/useFallbackImage.test.js +1 -1
- package/lib/hooks/useField/useField.test.js +2 -2
- package/lib/hooks/useModalState/useModalState.test.js +1 -1
- package/lib/hooks/useNavBarPress/useNavBarPress.test.js +1 -1
- package/lib/hooks/useNavBarStyling/useNavBarStyling.test.js +1 -1
- package/lib/hooks/useOverlayPanelState/useOverlayPanelState.test.js +1 -1
- package/lib/hooks/usePropWarning/usePropWarning.test.js +1 -1
- package/lib/hooks/useStatusClasses/useStatusClasses.test.js +1 -1
- package/lib/hooks/useTShirtSize/useTShirtSize.test.js +1 -1
- package/lib/utils/testUtils/setupTests.js +3 -0
- package/package.json +10 -10
@@ -9,6 +9,7 @@ import _Symbol from "@babel/runtime-corejs3/core-js-stable/symbol";
|
|
9
9
|
import _Object$create from "@babel/runtime-corejs3/core-js-stable/object/create";
|
10
10
|
import _Object$getPrototypeOf from "@babel/runtime-corejs3/core-js-stable/object/get-prototype-of";
|
11
11
|
import _Object$setPrototypeOf from "@babel/runtime-corejs3/core-js-stable/object/set-prototype-of";
|
12
|
+
import _Promise from "@babel/runtime-corejs3/core-js-stable/promise";
|
12
13
|
import _reverseInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/reverse";
|
13
14
|
import _sliceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/slice";
|
14
15
|
import _typeof from "@babel/runtime-corejs3/helpers/esm/typeof";
|
@@ -17,12 +18,9 @@ import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
|
|
17
18
|
import _defineProperty from "@babel/runtime-corejs3/helpers/esm/defineProperty";
|
18
19
|
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = _Object$defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof _Symbol ? _Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return _Object$defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = _Object$create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = _Object$getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = _Object$create(IteratorPrototype); function defineIteratorMethods(prototype) { var _context17; _forEachInstanceProperty(_context17 = ["next", "throw", "return"]).call(_context17, function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], _forEachInstanceProperty(tryLocsList).call(tryLocsList, pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return _Object$setPrototypeOf ? _Object$setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = _Object$create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = _Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return _reverseInstanceProperty(keys).call(keys), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { var _context18; if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, _forEachInstanceProperty(_context18 = this.tryEntries).call(_context18, resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+_sliceInstanceProperty(name).call(name, 1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
19
20
|
import _Object$defineProperty from "@babel/runtime-corejs3/core-js-stable/object/define-property";
|
20
|
-
import _Promise from "@babel/runtime-corejs3/core-js-stable/promise";
|
21
|
-
import _setTimeout from "@babel/runtime-corejs3/core-js-stable/set-timeout";
|
22
21
|
function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
23
22
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context15, _context16; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context15 = ownKeys(Object(source), !0)).call(_context15, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context16 = ownKeys(Object(source))).call(_context16, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
|
24
23
|
import React from 'react';
|
25
|
-
import { waitFor } from '@testing-library/react';
|
26
24
|
import userEvent from '@testing-library/user-event';
|
27
25
|
import { Link, Text } from '../..';
|
28
26
|
import { act, fireEvent, render, screen } from '../../utils/testUtils/testWrapper';
|
@@ -54,6 +52,7 @@ describe('CopyText', function () {
|
|
54
52
|
var mockGetSelection = jest.fn();
|
55
53
|
mockGetSelection.mockReturnValue('');
|
56
54
|
window.getSelection = mockGetSelection;
|
55
|
+
jest.useFakeTimers();
|
57
56
|
});
|
58
57
|
afterEach(function () {
|
59
58
|
jest.resetAllMocks();
|
@@ -267,13 +266,10 @@ describe('CopyText', function () {
|
|
267
266
|
case 0:
|
268
267
|
getComponent();
|
269
268
|
button = screen.getByLabelText('copy to clipboard');
|
270
|
-
|
269
|
+
userEvent.click(button);
|
271
270
|
expect(screen.queryByRole('tooltip')).toBeInTheDocument();
|
272
|
-
|
273
|
-
|
274
|
-
expect(screen.queryByRole('tooltip')).toHaveTextContent('Copied!');
|
275
|
-
});
|
276
|
-
case 6:
|
271
|
+
expect(screen.queryByRole('tooltip')).toHaveTextContent('Copied!');
|
272
|
+
case 5:
|
277
273
|
case "end":
|
278
274
|
return _context11.stop();
|
279
275
|
}
|
@@ -284,19 +280,22 @@ describe('CopyText', function () {
|
|
284
280
|
return _regeneratorRuntime().wrap(function _callee12$(_context12) {
|
285
281
|
while (1) switch (_context12.prev = _context12.next) {
|
286
282
|
case 0:
|
287
|
-
jest.useRealTimers();
|
288
283
|
getComponent();
|
289
284
|
button = screen.getByLabelText('copy to clipboard');
|
285
|
+
fireEvent.mouseMove(button);
|
286
|
+
fireEvent.mouseEnter(button);
|
290
287
|
fireEvent.click(button);
|
291
288
|
expect(screen.queryByRole('tooltip')).toBeInTheDocument();
|
292
289
|
expect(screen.queryByRole('tooltip')).toHaveTextContent('Copied!');
|
293
|
-
|
294
|
-
|
295
|
-
|
290
|
+
act(function () {
|
291
|
+
return jest.advanceTimersByTime(2000);
|
292
|
+
});
|
293
|
+
_context12.next = 10;
|
294
|
+
return act(function () {
|
295
|
+
expect(screen.queryByRole('tooltip')).toHaveTextContent('Copy to clipboard');
|
296
|
+
}, {
|
297
|
+
timeout: 2000
|
296
298
|
});
|
297
|
-
case 8:
|
298
|
-
expect(screen.queryByRole('tooltip')).toHaveTextContent('Copy to clipboard');
|
299
|
-
jest.useFakeTimers();
|
300
299
|
case 10:
|
301
300
|
case "end":
|
302
301
|
return _context12.stop();
|
@@ -33,8 +33,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
33
33
|
import React from 'react';
|
34
34
|
import { useAsyncList } from 'react-stately';
|
35
35
|
import { useCollator } from '@react-aria/i18n';
|
36
|
-
import { act, fireEvent, render, screen, within } from '@testing-library/react';
|
37
|
-
import { act as actHooks, renderHook } from '@testing-library/react-hooks';
|
36
|
+
import { act, act as actDom, act as actHooks, fireEvent, render, renderHook, screen, within } from '@testing-library/react';
|
38
37
|
import { DataTableBody, DataTableCell, DataTableColumn, DataTableHeader, DataTableRow } from '../../index';
|
39
38
|
import { universalComponentTests } from '../../utils/testUtils/universalComponentTest';
|
40
39
|
import DataTable from './DataTable';
|
@@ -95,7 +94,7 @@ var getCell = function getCell(view, text) {
|
|
95
94
|
return el;
|
96
95
|
};
|
97
96
|
var focusCell = function focusCell(tree, text) {
|
98
|
-
return
|
97
|
+
return actDom(function () {
|
99
98
|
return getCell(tree, text).focus();
|
100
99
|
});
|
101
100
|
};
|
@@ -195,27 +194,35 @@ describe('Static DataTable', function () {
|
|
195
194
|
});
|
196
195
|
test('should move focus to the next cell in a row with ArrowRight', function () {
|
197
196
|
var view = staticDataTable();
|
198
|
-
|
197
|
+
act(function () {
|
198
|
+
focusCell(view, 'USA');
|
199
|
+
});
|
199
200
|
moveFocus('ArrowRight');
|
200
201
|
// eslint-disable-next-line jest-dom/prefer-focus
|
201
202
|
expect(document.activeElement).toBe(getCell(view, 320000000));
|
202
203
|
});
|
203
204
|
test('should move focus to the previous cell in a row with ArrowLeft', function () {
|
204
205
|
var view = staticDataTable();
|
205
|
-
|
206
|
+
act(function () {
|
207
|
+
focusCell(view, 'Asia');
|
208
|
+
});
|
206
209
|
moveFocus('ArrowLeft');
|
207
210
|
expect(getCell(view, 1398000000)).toHaveFocus();
|
208
211
|
});
|
209
212
|
test('should move focus to the next cell in a row with ArrowUp', function () {
|
210
213
|
var view = staticDataTable();
|
211
|
-
|
214
|
+
act(function () {
|
215
|
+
focusCell(view, 'China');
|
216
|
+
});
|
212
217
|
moveFocus('ArrowUp');
|
213
218
|
// eslint-disable-next-line jest-dom/prefer-focus
|
214
219
|
expect(document.activeElement).toBe(getCell(view, 'USA'));
|
215
220
|
});
|
216
221
|
test('should move focus to the previous cell in a row with ArrowDown', function () {
|
217
222
|
var view = staticDataTable();
|
218
|
-
|
223
|
+
act(function () {
|
224
|
+
focusCell(view, 'Asia');
|
225
|
+
});
|
219
226
|
moveFocus('ArrowDown');
|
220
227
|
expect(getCell(view, 'Europe')).toHaveFocus();
|
221
228
|
});
|
@@ -295,21 +302,19 @@ describe('Async DataTable', function () {
|
|
295
302
|
expect(asyncTable).toHaveAttribute('aria-label', 'Custom table with onLoadMore');
|
296
303
|
var body = screen.getAllByRole('rowgroup')[1];
|
297
304
|
var scrollView = body === null || body === void 0 || (_body$parentNode = body.parentNode) === null || _body$parentNode === void 0 ? void 0 : _body$parentNode.parentNode;
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
}
|
302
|
-
act(function () {
|
305
|
+
scrollView.scrollTop = 250;
|
306
|
+
fireEvent.scroll(scrollView);
|
307
|
+
actDom(function () {
|
303
308
|
jest.runAllTimers();
|
304
309
|
});
|
305
310
|
scrollView.scrollTop = 1500;
|
306
311
|
fireEvent.scroll(scrollView);
|
307
|
-
|
312
|
+
actDom(function () {
|
308
313
|
jest.runAllTimers();
|
309
314
|
});
|
310
315
|
scrollView.scrollTop = 2800;
|
311
316
|
fireEvent.scroll(scrollView);
|
312
|
-
|
317
|
+
actDom(function () {
|
313
318
|
jest.runAllTimers();
|
314
319
|
});
|
315
320
|
expect(onLoadMore).toHaveBeenCalledTimes(3);
|
@@ -14,6 +14,7 @@ function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (
|
|
14
14
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context, _context2; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context = ownKeys(Object(source), !0)).call(_context, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context2 = ownKeys(Object(source))).call(_context2, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
|
15
15
|
import React, { forwardRef } from 'react';
|
16
16
|
import { useStatusClasses } from '../../hooks';
|
17
|
+
import statuses from '../../utils/devUtils/constants/statuses';
|
17
18
|
import { statusDefaultProp } from '../../utils/docUtils/statusProp';
|
18
19
|
import Text from '../Text';
|
19
20
|
|
@@ -26,7 +27,8 @@ import Text from '../Text';
|
|
26
27
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
27
28
|
var FieldHelperText = /*#__PURE__*/forwardRef(function (props, ref) {
|
28
29
|
var className = props.className,
|
29
|
-
status = props.status,
|
30
|
+
_props$status = props.status,
|
31
|
+
status = _props$status === void 0 ? statuses.DEFAULT : _props$status,
|
30
32
|
id = props.id,
|
31
33
|
others = _objectWithoutProperties(props, _excluded);
|
32
34
|
var _useStatusClasses = useStatusClasses(className, _defineProperty({}, "is-".concat(status), true)),
|
@@ -14,7 +14,7 @@ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyri
|
|
14
14
|
import React from 'react';
|
15
15
|
import userEvent from '@testing-library/user-event';
|
16
16
|
import { HelpHint, Link } from '../../index';
|
17
|
-
import { fireEvent, render, screen, waitFor } from '../../utils/testUtils/testWrapper';
|
17
|
+
import { act, fireEvent, render, screen, waitFor } from '../../utils/testUtils/testWrapper';
|
18
18
|
import { universalComponentTests } from '../../utils/testUtils/universalComponentTest';
|
19
19
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
20
20
|
var testId = 'help-hint__button';
|
@@ -32,12 +32,11 @@ var getComponentWithLink = function getComponentWithLink() {
|
|
32
32
|
href: "https://uilibrary.ping-eng.com/"
|
33
33
|
}, "Learn More")));
|
34
34
|
};
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
}
|
35
|
+
beforeAll(function () {
|
36
|
+
jest.useFakeTimers();
|
37
|
+
});
|
38
|
+
afterEach(function () {
|
39
|
+
jest.clearAllMocks();
|
41
40
|
});
|
42
41
|
test('renders HelpHint component', function () {
|
43
42
|
getComponent();
|
@@ -214,13 +213,16 @@ test('popover closes after closeDelay when mouse leaves trigger', /*#__PURE__*/_
|
|
214
213
|
helpHintButton = screen.getByTestId(testId);
|
215
214
|
fireEvent.mouseEnter(helpHintButton);
|
216
215
|
fireEvent.mouseLeave(helpHintButton);
|
217
|
-
|
218
|
-
|
216
|
+
act(function () {
|
217
|
+
jest.advanceTimersByTime(11);
|
218
|
+
});
|
219
|
+
_context6.next = 8;
|
220
|
+
return act(function () {
|
219
221
|
expect(screen.queryByRole('presentation')).not.toBeInTheDocument();
|
220
222
|
}, {
|
221
223
|
timeout: closeDelay + 1
|
222
224
|
});
|
223
|
-
case
|
225
|
+
case 8:
|
224
226
|
case "end":
|
225
227
|
return _context6.stop();
|
226
228
|
}
|
@@ -236,15 +238,25 @@ test('popover automatically closes in 1000ms after mouse leaves trigger', /*#__P
|
|
236
238
|
helpHintButton = screen.getByTestId(testId);
|
237
239
|
fireEvent.mouseEnter(helpHintButton);
|
238
240
|
fireEvent.mouseLeave(helpHintButton);
|
239
|
-
|
240
|
-
|
241
|
+
act(function () {
|
242
|
+
jest.advanceTimersByTime(1001);
|
243
|
+
});
|
244
|
+
_context7.next = 8;
|
245
|
+
return act(function () {
|
241
246
|
expect(screen.queryByRole('presentation')).not.toBeInTheDocument();
|
242
247
|
}, {
|
243
248
|
timeout: oneSecond + 1
|
244
249
|
});
|
245
|
-
case
|
250
|
+
case 8:
|
246
251
|
case "end":
|
247
252
|
return _context7.stop();
|
248
253
|
}
|
249
254
|
}, _callee7);
|
250
|
-
})));
|
255
|
+
})));
|
256
|
+
|
257
|
+
// Needs to be added to each components test file
|
258
|
+
universalComponentTests({
|
259
|
+
renderComponent: function renderComponent(props) {
|
260
|
+
return ___EmotionJSX(HelpHint, _extends({}, defaultProps, props));
|
261
|
+
}
|
262
|
+
});
|
@@ -4,6 +4,7 @@ import _slicedToArray from "@babel/runtime-corejs3/helpers/esm/slicedToArray";
|
|
4
4
|
import _objectWithoutProperties from "@babel/runtime-corejs3/helpers/esm/objectWithoutProperties";
|
5
5
|
var _templateObject;
|
6
6
|
var _excluded = ["className", "fallbackImage", "fallbackTimeout", "isDisabled", "src", "alt", "sx", "fallbackAlt"];
|
7
|
+
/* istanbul ignore file */
|
7
8
|
import React, { forwardRef, useImperativeHandle, useMemo, useRef, useState } from 'react';
|
8
9
|
import { keyframes } from '@emotion/react';
|
9
10
|
import { useHover } from '@react-aria/interactions';
|
@@ -53,8 +54,6 @@ var Image = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
53
54
|
return setImgAttribute(alt, fallbackAlt);
|
54
55
|
}, [alt, isLoading, shouldShowFallback]);
|
55
56
|
var imgRef = useLocalOrForwardRef(ref);
|
56
|
-
|
57
|
-
/* istanbul ignore next */
|
58
57
|
useImperativeHandle(ref, function () {
|
59
58
|
return imgRef.current;
|
60
59
|
});
|
@@ -15,7 +15,7 @@ import _sliceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instan
|
|
15
15
|
import React from 'react';
|
16
16
|
import { fireEvent } from '@testing-library/react';
|
17
17
|
import userEvent from '@testing-library/user-event';
|
18
|
-
import { render, screen } from '../../utils/testUtils/testWrapper';
|
18
|
+
import { act, render, screen } from '../../utils/testUtils/testWrapper';
|
19
19
|
import { universalComponentTests } from '../../utils/testUtils/universalComponentTest';
|
20
20
|
import ImageUploadField from './ImageUploadField';
|
21
21
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
@@ -76,11 +76,15 @@ test('should render image upload component by default', function () {
|
|
76
76
|
test('should render div with icon when focused', function () {
|
77
77
|
getComponent();
|
78
78
|
var imageUploadButton = screen.getByTestId(testButtonId);
|
79
|
-
|
79
|
+
act(function () {
|
80
|
+
imageUploadButton.focus();
|
81
|
+
});
|
80
82
|
var hoveredPreview = screen.getByTestId('image-upload-hovered-preview');
|
81
83
|
expect(hoveredPreview).toBeInstanceOf(HTMLDivElement);
|
82
84
|
expect(hoveredPreview).toBeInTheDocument();
|
83
|
-
|
85
|
+
act(function () {
|
86
|
+
imageUploadButton.blur();
|
87
|
+
});
|
84
88
|
expect(hoveredPreview).not.toBeInTheDocument();
|
85
89
|
});
|
86
90
|
test('should upload a file', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
@@ -27,7 +27,7 @@ import { Item } from 'react-stately';
|
|
27
27
|
import userEvent from '@testing-library/user-event';
|
28
28
|
import _ from 'lodash';
|
29
29
|
import loadingStates from '../../utils/devUtils/constants/loadingStates';
|
30
|
-
import { fireEvent, render, screen } from '../../utils/testUtils/testWrapper';
|
30
|
+
import { act, fireEvent, render, screen } from '../../utils/testUtils/testWrapper';
|
31
31
|
import { universalComponentTests } from '../../utils/testUtils/universalComponentTest';
|
32
32
|
import Button from '../Button';
|
33
33
|
import CheckboxField from '../CheckboxField';
|
@@ -403,7 +403,9 @@ test('list view not receive focus when click on checkbox', function () {
|
|
403
403
|
var listItem = screen.getAllByRole('gridcell');
|
404
404
|
var checkbox = screen.getAllByTestId('TestID');
|
405
405
|
expect(listItem[0]).not.toHaveClass('is-focused');
|
406
|
-
|
406
|
+
act(function () {
|
407
|
+
checkbox[0].click();
|
408
|
+
});
|
407
409
|
expect(listItem[0]).not.toHaveClass('is-focused');
|
408
410
|
});
|
409
411
|
test('list view reset hover on item when scroll', function () {
|
@@ -2,12 +2,11 @@ import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
|
|
2
2
|
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
|
3
3
|
import _Object$keys from "@babel/runtime-corejs3/core-js-stable/object/keys";
|
4
4
|
import React from 'react';
|
5
|
-
import { act } from 'react-dom/test-utils';
|
6
5
|
import { Item } from 'react-stately';
|
7
6
|
import AccountIcon from '@pingux/mdi-react/AccountIcon';
|
8
7
|
import userEvent from '@testing-library/user-event';
|
9
8
|
import statuses from '../../utils/devUtils/constants/statuses';
|
10
|
-
import { render, screen } from '../../utils/testUtils/testWrapper';
|
9
|
+
import { act, render, screen } from '../../utils/testUtils/testWrapper';
|
11
10
|
import { universalComponentTests } from '../../utils/testUtils/universalComponentTest';
|
12
11
|
import { ARIA_STATUSES } from './Message';
|
13
12
|
import Messages, { messagesReducerStory, multiMessagesReducerStory } from '.';
|
@@ -1,8 +1,7 @@
|
|
1
1
|
import _slicedToArray from "@babel/runtime-corejs3/helpers/esm/slicedToArray";
|
2
2
|
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
|
3
3
|
import React, { useEffect, useReducer } from 'react';
|
4
|
-
import { act } from '
|
5
|
-
import { render, screen } from '../../../../utils/testUtils/testWrapper';
|
4
|
+
import { act, render, screen } from '../../../../utils/testUtils/testWrapper';
|
6
5
|
import messagesReducer, { addMessage, clearMessages, hideMessage, removeMessage, showMessage } from '../messagesReducer';
|
7
6
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
8
7
|
var testId = 'test-messages';
|
@@ -1,8 +1,7 @@
|
|
1
1
|
import _slicedToArray from "@babel/runtime-corejs3/helpers/esm/slicedToArray";
|
2
2
|
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
|
3
3
|
import React, { useEffect, useReducer } from 'react';
|
4
|
-
import { act } from '
|
5
|
-
import { render, screen } from '../../../../utils/testUtils/testWrapper';
|
4
|
+
import { act, render, screen } from '../../../../utils/testUtils/testWrapper';
|
6
5
|
import multiMessagesReducer, { addMessage, clearMessages, hideMessage, removeMessage, showMessage } from '../multiMessagesReducer';
|
7
6
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
8
7
|
var testId = 'test-messages';
|
@@ -16,7 +16,7 @@ import React from 'react';
|
|
16
16
|
import userEvent from '@testing-library/user-event';
|
17
17
|
import { Item, MultivaluesField, OverlayProvider, Section } from '../../index';
|
18
18
|
import statuses from '../../utils/devUtils/constants/statuses';
|
19
|
-
import { fireEvent, getDefaultNormalizer, render, screen, within } from '../../utils/testUtils/testWrapper';
|
19
|
+
import { act, fireEvent, getDefaultNormalizer, render, screen, within } from '../../utils/testUtils/testWrapper';
|
20
20
|
import { universalComponentTests } from '../../utils/testUtils/universalComponentTest';
|
21
21
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
22
22
|
var items = [{
|
@@ -153,10 +153,14 @@ test('closes listbox on blur and fires "onBlur"', function () {
|
|
153
153
|
onBlur: onBlur
|
154
154
|
});
|
155
155
|
var input = screen.getByRole('combobox');
|
156
|
-
|
156
|
+
act(function () {
|
157
|
+
userEvent.tab();
|
158
|
+
});
|
157
159
|
expect(input).toHaveFocus();
|
158
160
|
expect(screen.queryByRole('listbox')).toBeInTheDocument();
|
159
|
-
|
161
|
+
act(function () {
|
162
|
+
input.blur();
|
163
|
+
});
|
160
164
|
expect(screen.queryByRole('listbox')).not.toBeInTheDocument();
|
161
165
|
expect(onBlur).toBeCalled();
|
162
166
|
});
|
@@ -170,7 +174,9 @@ test('opening and closing listbox fires "onOpenChange"', function () {
|
|
170
174
|
expect(input).toHaveFocus();
|
171
175
|
expect(screen.queryByRole('listbox')).toBeInTheDocument();
|
172
176
|
expect(onOpenChange).toHaveBeenCalledWith(true);
|
173
|
-
|
177
|
+
act(function () {
|
178
|
+
input.blur();
|
179
|
+
});
|
174
180
|
expect(screen.queryByRole('listbox')).not.toBeInTheDocument();
|
175
181
|
expect(onOpenChange).toHaveBeenCalledWith(false);
|
176
182
|
});
|
@@ -183,10 +189,14 @@ test('multiple selection is enabled, option disappears after selection', functio
|
|
183
189
|
expect(listbox).toHaveAttribute('aria-multiselectable', 'true');
|
184
190
|
var options = within(listbox).getAllByRole('option');
|
185
191
|
var firstOption = options[0];
|
186
|
-
|
192
|
+
act(function () {
|
193
|
+
firstOption.click();
|
194
|
+
});
|
187
195
|
expect(firstOption).not.toBeInTheDocument();
|
188
196
|
var secondOption = options[1];
|
189
|
-
|
197
|
+
act(function () {
|
198
|
+
secondOption.click();
|
199
|
+
});
|
190
200
|
expect(secondOption).not.toBeInTheDocument();
|
191
201
|
});
|
192
202
|
test('updates aria attributes on option focus', function () {
|
@@ -223,7 +233,9 @@ test('clicking an option renders badge with option name', function () {
|
|
223
233
|
expect(input).toHaveFocus();
|
224
234
|
var options = screen.getAllByRole('option');
|
225
235
|
var firstOption = options[0];
|
226
|
-
|
236
|
+
act(function () {
|
237
|
+
firstOption.click();
|
238
|
+
});
|
227
239
|
expect(firstOption).not.toBeInTheDocument();
|
228
240
|
var badge = screen.getByText(items[0].name);
|
229
241
|
expect(badge).toBeInTheDocument();
|
@@ -237,7 +249,9 @@ test('after clicking an option, and then clicking the text input, the listbox re
|
|
237
249
|
expect(input).toHaveFocus();
|
238
250
|
var options = screen.getAllByRole('option');
|
239
251
|
var firstOption = options[0];
|
240
|
-
|
252
|
+
act(function () {
|
253
|
+
firstOption.click();
|
254
|
+
});
|
241
255
|
expect(firstOption).not.toBeInTheDocument();
|
242
256
|
expect(screen.queryByRole('listbox')).toBeInTheDocument();
|
243
257
|
userEvent.click(input);
|
@@ -262,7 +276,9 @@ test('after clicking an option, and then typing a custom input, the listbox rema
|
|
262
276
|
expect(input).toHaveFocus();
|
263
277
|
options = screen.getAllByRole('option');
|
264
278
|
firstOption = options[0];
|
265
|
-
|
279
|
+
act(function () {
|
280
|
+
firstOption.click();
|
281
|
+
});
|
266
282
|
expect(firstOption).not.toBeInTheDocument();
|
267
283
|
_context.next = 10;
|
268
284
|
return userEvent.clear(input);
|
@@ -288,15 +304,23 @@ test('clicking on delete button deletes selection, and re-adds option to list',
|
|
288
304
|
expect(input).toHaveFocus();
|
289
305
|
var options = screen.getAllByRole('option');
|
290
306
|
var firstOption = options[0];
|
291
|
-
|
307
|
+
act(function () {
|
308
|
+
firstOption.click();
|
309
|
+
});
|
292
310
|
expect(firstOption).not.toBeInTheDocument();
|
293
311
|
var badge = screen.getByText(items[0].name);
|
294
312
|
expect(badge).toBeInTheDocument();
|
295
313
|
var deleteButton = badge.nextSibling;
|
296
|
-
|
314
|
+
act(function () {
|
315
|
+
deleteButton.click();
|
316
|
+
});
|
297
317
|
expect(badge).not.toBeInTheDocument();
|
298
|
-
|
299
|
-
|
318
|
+
act(function () {
|
319
|
+
input.blur();
|
320
|
+
});
|
321
|
+
act(function () {
|
322
|
+
input.focus();
|
323
|
+
});
|
300
324
|
var updatedOptions = screen.getAllByRole('option');
|
301
325
|
expect(updatedOptions[0]).toBeInTheDocument();
|
302
326
|
expect(updatedOptions[0]).toHaveTextContent(items[0].name);
|
@@ -312,10 +336,14 @@ test('clicking an option fires "onSelectionChange"', function () {
|
|
312
336
|
var listbox = screen.getByRole('listbox');
|
313
337
|
var options = within(listbox).getAllByRole('option');
|
314
338
|
var firstOption = options[0];
|
315
|
-
|
339
|
+
act(function () {
|
340
|
+
firstOption.click();
|
341
|
+
});
|
316
342
|
expect(firstOption).not.toBeInTheDocument();
|
317
343
|
var secondOption = options[1];
|
318
|
-
|
344
|
+
act(function () {
|
345
|
+
secondOption.click();
|
346
|
+
});
|
319
347
|
expect(secondOption).not.toBeInTheDocument();
|
320
348
|
expect(onSelectionChange).toBeCalledTimes(2);
|
321
349
|
expect(onSelectionChange.mock.calls[0][0].has(items[0].name)).toBeTruthy();
|
@@ -479,7 +507,9 @@ test('in non-restrictive mode the value that was already selected using the list
|
|
479
507
|
var listbox = screen.getByRole('listbox');
|
480
508
|
var options = within(listbox).getAllByRole('option');
|
481
509
|
var firstOption = options[0];
|
482
|
-
|
510
|
+
act(function () {
|
511
|
+
firstOption.click();
|
512
|
+
});
|
483
513
|
expect(onSelectionChange.mock.calls[0][0].has(items[0].name)).toBeTruthy();
|
484
514
|
onSelectionChange.mockClear();
|
485
515
|
userEvent.type(input, items[0].name);
|
@@ -656,7 +686,9 @@ test('deleting a single badge via keyboard moves focus to the input', function (
|
|
656
686
|
userEvent.tab();
|
657
687
|
var options = screen.getAllByRole('option');
|
658
688
|
var firstOption = options[0];
|
659
|
-
|
689
|
+
act(function () {
|
690
|
+
firstOption.click();
|
691
|
+
});
|
660
692
|
var badge = screen.getByText(items[0].name);
|
661
693
|
expect(badge).toBeInTheDocument();
|
662
694
|
userEvent.tab({
|
@@ -679,8 +711,12 @@ test('deleting the last badge via keyboard moves focus to the previous badge', f
|
|
679
711
|
var options = screen.getAllByRole('option');
|
680
712
|
var firstOption = options[0];
|
681
713
|
var secondOption = options[1];
|
682
|
-
|
683
|
-
|
714
|
+
act(function () {
|
715
|
+
firstOption.click();
|
716
|
+
});
|
717
|
+
act(function () {
|
718
|
+
secondOption.click();
|
719
|
+
});
|
684
720
|
var badge1 = screen.getByText(items[0].name);
|
685
721
|
var badge2 = screen.getByText(items[1].name);
|
686
722
|
expect(badge1).toBeInTheDocument();
|
@@ -784,15 +820,23 @@ test('in condensed mode selects and deselects ', function () {
|
|
784
820
|
var buttons = screen.getAllByRole('button');
|
785
821
|
var button = buttons[1];
|
786
822
|
expect(button).toHaveTextContent('Select All');
|
787
|
-
|
823
|
+
act(function () {
|
824
|
+
button.click();
|
825
|
+
});
|
788
826
|
expect(button).toHaveTextContent('Deselect All');
|
789
827
|
expect(screen.getByText('All Selected')).toBeInTheDocument();
|
790
|
-
|
828
|
+
act(function () {
|
829
|
+
firstOption.click();
|
830
|
+
});
|
791
831
|
expect(button).toHaveTextContent('Select All');
|
792
832
|
expect(screen.getByText('2 Selected')).toBeInTheDocument();
|
793
|
-
|
833
|
+
act(function () {
|
834
|
+
button.click();
|
835
|
+
});
|
794
836
|
expect(button).toHaveTextContent('Deselect All');
|
795
|
-
|
837
|
+
act(function () {
|
838
|
+
button.click();
|
839
|
+
});
|
796
840
|
expect(button).toHaveTextContent('Select All');
|
797
841
|
});
|
798
842
|
test('in condensed mode "onSelectionChange" is called', function () {
|
@@ -821,7 +865,9 @@ test('opening and closing listbox fires "onOpenChange" in condensed mode', funct
|
|
821
865
|
expect(input).toHaveFocus();
|
822
866
|
expect(screen.queryByRole('listbox')).toBeInTheDocument();
|
823
867
|
expect(onOpenChange).toHaveBeenCalledWith(true);
|
824
|
-
|
868
|
+
act(function () {
|
869
|
+
input.blur();
|
870
|
+
});
|
825
871
|
expect(screen.queryByRole('listbox')).not.toBeInTheDocument();
|
826
872
|
expect(onOpenChange).toHaveBeenCalledWith(false);
|
827
873
|
});
|
@@ -884,7 +930,9 @@ test('closes listbox on blur and fires "onBlur"', function () {
|
|
884
930
|
userEvent.tab();
|
885
931
|
expect(input).toHaveFocus();
|
886
932
|
expect(screen.queryByRole('listbox')).toBeInTheDocument();
|
887
|
-
|
933
|
+
act(function () {
|
934
|
+
input.blur();
|
935
|
+
});
|
888
936
|
expect(screen.queryByRole('listbox')).not.toBeInTheDocument();
|
889
937
|
expect(onBlur).toBeCalled();
|
890
938
|
});
|
@@ -925,7 +973,9 @@ test('popover closes on input blur', function () {
|
|
925
973
|
var checkboxes = within(listbox).getAllByRole('img');
|
926
974
|
expect(checkboxes.length).toBe(3);
|
927
975
|
var secondOption = options[1];
|
928
|
-
|
976
|
+
act(function () {
|
977
|
+
secondOption.click();
|
978
|
+
});
|
929
979
|
var value = 'Aardvark';
|
930
980
|
userEvent.type(input, value);
|
931
981
|
userEvent.click(document.body);
|