@pingux/astro 2.85.0-alpha.16 → 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
@@ -16,6 +16,8 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime-corejs3/hel
|
|
16
16
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/objectWithoutProperties"));
|
17
17
|
var _extends2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/extends"));
|
18
18
|
var _map = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/map"));
|
19
|
+
var _find = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/find"));
|
20
|
+
var _filter = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/filter"));
|
19
21
|
var _forEach = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/for-each"));
|
20
22
|
var _from = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/array/from"));
|
21
23
|
var _setTimeout2 = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/set-timeout"));
|
@@ -30,7 +32,7 @@ var _Tabs = _interopRequireDefault(require("./Tabs"));
|
|
30
32
|
var _excluded = ["name", "children"]; // Emotion Cache added as test fails otherwise, root cause of this failure is unknown.
|
31
33
|
// Failure occured with ThemeUI refactor.
|
32
34
|
// https://github.com/emotion-js/emotion/issues/1105#issuecomment-557726922
|
33
|
-
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 _context4; _forEachInstanceProperty2(_context4 = ["next", "throw", "return"]).call(_context4, 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" }], _forEachInstanceProperty2(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 _context5; if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, _forEachInstanceProperty2(_context5 = this.tryEntries).call(_context5, 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; }
|
35
|
+
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 _context13; _forEachInstanceProperty2(_context13 = ["next", "throw", "return"]).call(_context13, 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" }], _forEachInstanceProperty2(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 _context14; if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, _forEachInstanceProperty2(_context14 = this.tryEntries).call(_context14, 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; }
|
34
36
|
var emotionCache = (0, _cache["default"])({
|
35
37
|
key: 'tabs-test'
|
36
38
|
});
|
@@ -39,15 +41,18 @@ var testId = 'testId';
|
|
39
41
|
var defaultTabs = [{
|
40
42
|
name: 'Tab 1',
|
41
43
|
children: 'Tab 1 body',
|
42
|
-
props: {}
|
44
|
+
props: {},
|
45
|
+
index: 0
|
43
46
|
}, {
|
44
47
|
name: 'Tab 2',
|
45
48
|
children: 'Tab 2 body',
|
46
|
-
props: {}
|
49
|
+
props: {},
|
50
|
+
index: 1
|
47
51
|
}, {
|
48
52
|
name: 'Tab 3',
|
49
53
|
children: 'Tab 3 body',
|
50
|
-
props: {}
|
54
|
+
props: {},
|
55
|
+
index: 2
|
51
56
|
}];
|
52
57
|
var tabsWithList = [{
|
53
58
|
name: 'Tab 1',
|
@@ -79,9 +84,9 @@ var getComponent = function getComponent() {
|
|
79
84
|
tabs = _ref$tabs === void 0 ? defaultTabs : _ref$tabs,
|
80
85
|
_ref$renderFn = _ref.renderFn,
|
81
86
|
renderFn = _ref$renderFn === void 0 ? _testWrapper.render : _ref$renderFn;
|
82
|
-
return renderFn(
|
83
|
-
|
84
|
-
|
87
|
+
return renderFn(
|
88
|
+
// <CacheProvider value={emotionCache}>
|
89
|
+
(0, _react2.jsx)(_Tabs["default"], (0, _extends2["default"])({}, defaultProps, props), (0, _map["default"])(tabs).call(tabs, function (_ref2) {
|
85
90
|
var name = _ref2.name,
|
86
91
|
children = _ref2.children,
|
87
92
|
tabProps = _ref2.props;
|
@@ -89,8 +94,11 @@ var getComponent = function getComponent() {
|
|
89
94
|
key: name,
|
90
95
|
title: name
|
91
96
|
}, tabProps), children);
|
92
|
-
}))
|
97
|
+
}))
|
98
|
+
// </CacheProvider>
|
99
|
+
);
|
93
100
|
};
|
101
|
+
|
94
102
|
var getComponentWithDynamicItems = function getComponentWithDynamicItems(props) {
|
95
103
|
return (0, _testWrapper.render)((0, _react2.jsx)(_react2.CacheProvider, {
|
96
104
|
value: emotionCache
|
@@ -117,15 +125,45 @@ var getTabs = function getTabs() {
|
|
117
125
|
tab2: tab2
|
118
126
|
};
|
119
127
|
};
|
120
|
-
var testTabPanel = function
|
121
|
-
|
122
|
-
var
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
};
|
128
|
+
var testTabPanel = /*#__PURE__*/function () {
|
129
|
+
var _ref4 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(expectedTabIndex) {
|
130
|
+
var selectedTab, filteredList;
|
131
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
132
|
+
while (1) switch (_context.prev = _context.next) {
|
133
|
+
case 0:
|
134
|
+
selectedTab = (0, _find["default"])(defaultTabs).call(defaultTabs, function (_tab) {
|
135
|
+
return _tab.index === expectedTabIndex;
|
136
|
+
});
|
137
|
+
filteredList = (0, _filter["default"])(defaultTabs).call(defaultTabs, function (_tab) {
|
138
|
+
return _tab.index !== expectedTabIndex;
|
139
|
+
});
|
140
|
+
if (!(selectedTab && typeof selectedTab.children === 'string')) {
|
141
|
+
_context.next = 8;
|
142
|
+
break;
|
143
|
+
}
|
144
|
+
_context.t0 = expect;
|
145
|
+
_context.next = 6;
|
146
|
+
return _testWrapper.screen.findByText(selectedTab.children);
|
147
|
+
case 6:
|
148
|
+
_context.t1 = _context.sent;
|
149
|
+
(0, _context.t0)(_context.t1).toBeInTheDocument();
|
150
|
+
case 8:
|
151
|
+
if (filteredList[0] && typeof filteredList[0].children === 'string') {
|
152
|
+
expect(_testWrapper.screen.queryByText(filteredList[0].children)).not.toBeInTheDocument();
|
153
|
+
}
|
154
|
+
if (filteredList[1] && typeof filteredList[1].children === 'string') {
|
155
|
+
expect(_testWrapper.screen.queryByText(filteredList[1].children)).not.toBeInTheDocument();
|
156
|
+
}
|
157
|
+
case 10:
|
158
|
+
case "end":
|
159
|
+
return _context.stop();
|
160
|
+
}
|
161
|
+
}, _callee);
|
162
|
+
}));
|
163
|
+
return function testTabPanel(_x) {
|
164
|
+
return _ref4.apply(this, arguments);
|
165
|
+
};
|
166
|
+
}();
|
129
167
|
var testSingleTab = function testSingleTab(tabs, tab, thisTest) {
|
130
168
|
var testParams = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
|
131
169
|
(0, _forEach["default"])(tabs).call(tabs, function (t) {
|
@@ -138,8 +176,12 @@ var testSingleTab = function testSingleTab(tabs, tab, thisTest) {
|
|
138
176
|
}
|
139
177
|
});
|
140
178
|
};
|
179
|
+
beforeEach(function () {
|
180
|
+
jest.useFakeTimers();
|
181
|
+
});
|
141
182
|
afterEach(function () {
|
142
|
-
jest.restoreAllMocks();
|
183
|
+
// jest.restoreAllMocks();
|
184
|
+
jest.resetAllMocks();
|
143
185
|
});
|
144
186
|
|
145
187
|
// Needs to be added to each components test file
|
@@ -165,191 +207,259 @@ test('default tabs', function () {
|
|
165
207
|
expect(tabLine).toBeInTheDocument();
|
166
208
|
expect(tabPanel).toBeInTheDocument();
|
167
209
|
});
|
168
|
-
test('interacting with tabs via click', function () {
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
code: 'ArrowRight'
|
200
|
-
});
|
201
|
-
testSingleTab(tabs, tab1, 'toHaveFocus');
|
202
|
-
testTabPanel(0);
|
203
|
-
_testWrapper.fireEvent.keyDown(tab1, {
|
204
|
-
key: 'Enter',
|
205
|
-
code: 'Enter'
|
206
|
-
});
|
207
|
-
testSingleTab(tabs, tab1, 'toHaveFocus');
|
208
|
-
testTabPanel(1);
|
209
|
-
});
|
210
|
-
test('interacting with tabs via focus -- horizontal', function () {
|
211
|
-
getComponent({
|
212
|
-
keyboardActivation: 'automatic'
|
213
|
-
});
|
214
|
-
var _getTabs3 = getTabs(),
|
215
|
-
tabs = _getTabs3.tabs,
|
216
|
-
tab0 = _getTabs3.tab0,
|
217
|
-
tab1 = _getTabs3.tab1;
|
218
|
-
(0, _forEach["default"])(tabs).call(tabs, function (tab) {
|
219
|
-
return expect(tab).not.toHaveFocus();
|
220
|
-
});
|
221
|
-
_userEvent["default"].tab();
|
222
|
-
testSingleTab(tabs, tab0, 'toHaveFocus');
|
223
|
-
testTabPanel(0);
|
224
|
-
_testWrapper.fireEvent.keyDown(tab0, {
|
225
|
-
key: 'ArrowRight',
|
226
|
-
code: 'ArrowRight'
|
227
|
-
});
|
228
|
-
testSingleTab(tabs, tab1, 'toHaveFocus');
|
229
|
-
testTabPanel(1);
|
230
|
-
_testWrapper.fireEvent.keyDown(tab0, {
|
231
|
-
key: 'ArrowLeft',
|
232
|
-
code: 'ArrowLeft'
|
233
|
-
});
|
234
|
-
testSingleTab(tabs, tab0, 'toHaveFocus');
|
235
|
-
testTabPanel(0);
|
236
|
-
});
|
237
|
-
test('interacting with tabs via focus -- vertical', function () {
|
238
|
-
getComponent({
|
239
|
-
orientation: 'vertical',
|
240
|
-
keyboardActivation: 'automatic'
|
241
|
-
});
|
242
|
-
var _getTabs4 = getTabs(),
|
243
|
-
tabs = _getTabs4.tabs,
|
244
|
-
tab0 = _getTabs4.tab0,
|
245
|
-
tab1 = _getTabs4.tab1;
|
246
|
-
(0, _forEach["default"])(tabs).call(tabs, function (tab) {
|
247
|
-
return expect(tab).not.toHaveFocus();
|
248
|
-
});
|
249
|
-
_userEvent["default"].tab();
|
250
|
-
testSingleTab(tabs, tab0, 'toHaveFocus');
|
251
|
-
testTabPanel(0);
|
252
|
-
_testWrapper.fireEvent.keyDown(tab0, {
|
253
|
-
key: 'ArrowDown',
|
254
|
-
code: 'ArrowDown'
|
255
|
-
});
|
256
|
-
testSingleTab(tabs, tab1, 'toHaveFocus');
|
257
|
-
testTabPanel(1);
|
258
|
-
_testWrapper.fireEvent.keyDown(tab0, {
|
259
|
-
key: 'ArrowUp',
|
260
|
-
code: 'ArrowUp'
|
261
|
-
});
|
262
|
-
testSingleTab(tabs, tab0, 'toHaveFocus');
|
263
|
-
testTabPanel(0);
|
264
|
-
});
|
265
|
-
test('disabled all tabs', function () {
|
266
|
-
getComponent({
|
267
|
-
isDisabled: true
|
268
|
-
});
|
269
|
-
var _getTabs5 = getTabs(),
|
270
|
-
tab0 = _getTabs5.tab0,
|
271
|
-
tab1 = _getTabs5.tab1;
|
272
|
-
var tabLine = _testWrapper.screen.queryByRole('presentation');
|
273
|
-
|
274
|
-
// Tabs cannot be DOM disabled so must check visuals
|
275
|
-
(0, _forEach["default"])(defaultTabs).call(defaultTabs, function (tab) {
|
276
|
-
if (tab.name) {
|
277
|
-
var tabText = _testWrapper.screen.getByText(tab.name);
|
278
|
-
var parentElement = tabText.parentElement;
|
279
|
-
expect(parentElement).toHaveClass('is-disabled');
|
210
|
+
test('interacting with tabs via click', /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
211
|
+
var _getTabs, tabs, tab0, tab1;
|
212
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
213
|
+
while (1) switch (_context2.prev = _context2.next) {
|
214
|
+
case 0:
|
215
|
+
getComponent();
|
216
|
+
_getTabs = getTabs(), tabs = _getTabs.tabs, tab0 = _getTabs.tab0, tab1 = _getTabs.tab1; // Expect the first tab to be default selected
|
217
|
+
_context2.t0 = testSingleTab;
|
218
|
+
_context2.t1 = tabs;
|
219
|
+
_context2.t2 = tab0;
|
220
|
+
_context2.next = 7;
|
221
|
+
return _testWrapper.screen.findByRole('presentation');
|
222
|
+
case 7:
|
223
|
+
_context2.t3 = _context2.sent;
|
224
|
+
_context2.t4 = [_context2.t3];
|
225
|
+
(0, _context2.t0)(_context2.t1, _context2.t2, 'toContainElement', _context2.t4);
|
226
|
+
_context2.next = 12;
|
227
|
+
return testTabPanel(0);
|
228
|
+
case 12:
|
229
|
+
_userEvent["default"].click(tab1);
|
230
|
+
testSingleTab(tabs, tab1, 'toContainElement', [_testWrapper.screen.getByRole('presentation')]);
|
231
|
+
_context2.next = 16;
|
232
|
+
return testTabPanel(1);
|
233
|
+
case 16:
|
234
|
+
_userEvent["default"].click(tab0);
|
235
|
+
testSingleTab(tabs, tab0, 'toContainElement', [_testWrapper.screen.getByRole('presentation')]);
|
236
|
+
_context2.next = 20;
|
237
|
+
return testTabPanel(0);
|
238
|
+
case 20:
|
239
|
+
case "end":
|
240
|
+
return _context2.stop();
|
280
241
|
}
|
281
|
-
});
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
242
|
+
}, _callee2);
|
243
|
+
})));
|
244
|
+
test('interacting with tabs with manual activation', /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
245
|
+
var _getTabs2, tabs, tab0, tab1;
|
246
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
247
|
+
while (1) switch (_context3.prev = _context3.next) {
|
248
|
+
case 0:
|
249
|
+
getComponent();
|
250
|
+
_getTabs2 = getTabs(), tabs = _getTabs2.tabs, tab0 = _getTabs2.tab0, tab1 = _getTabs2.tab1;
|
251
|
+
(0, _forEach["default"])(tabs).call(tabs, function (tab) {
|
252
|
+
return expect(tab).not.toHaveFocus();
|
253
|
+
});
|
254
|
+
_userEvent["default"].tab();
|
255
|
+
testSingleTab(tabs, tab0, 'toHaveFocus');
|
256
|
+
_context3.next = 7;
|
257
|
+
return testTabPanel(0);
|
258
|
+
case 7:
|
259
|
+
_testWrapper.fireEvent.keyDown(tab0, {
|
260
|
+
key: 'ArrowRight',
|
261
|
+
code: 'ArrowRight'
|
262
|
+
});
|
263
|
+
testSingleTab(tabs, tab1, 'toHaveFocus');
|
264
|
+
_context3.next = 11;
|
265
|
+
return testTabPanel(0);
|
266
|
+
case 11:
|
267
|
+
_testWrapper.fireEvent.keyDown(tab1, {
|
268
|
+
key: 'Enter',
|
269
|
+
code: 'Enter'
|
270
|
+
});
|
271
|
+
testSingleTab(tabs, tab1, 'toHaveFocus');
|
272
|
+
_context3.next = 15;
|
273
|
+
return testTabPanel(1);
|
274
|
+
case 15:
|
275
|
+
case "end":
|
276
|
+
return _context3.stop();
|
277
|
+
}
|
278
|
+
}, _callee3);
|
279
|
+
})));
|
280
|
+
test('interacting with tabs via focus -- horizontal', /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
281
|
+
var _getTabs3, tabs, tab0, tab1;
|
282
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
283
|
+
while (1) switch (_context4.prev = _context4.next) {
|
284
|
+
case 0:
|
285
|
+
getComponent({
|
286
|
+
keyboardActivation: 'automatic'
|
287
|
+
});
|
288
|
+
_getTabs3 = getTabs(), tabs = _getTabs3.tabs, tab0 = _getTabs3.tab0, tab1 = _getTabs3.tab1;
|
289
|
+
(0, _forEach["default"])(tabs).call(tabs, function (tab) {
|
290
|
+
return expect(tab).not.toHaveFocus();
|
291
|
+
});
|
292
|
+
_userEvent["default"].tab();
|
293
|
+
testSingleTab(tabs, tab0, 'toHaveFocus');
|
294
|
+
_context4.next = 7;
|
295
|
+
return testTabPanel(0);
|
296
|
+
case 7:
|
297
|
+
_testWrapper.fireEvent.keyDown(tab0, {
|
298
|
+
key: 'ArrowRight',
|
299
|
+
code: 'ArrowRight'
|
300
|
+
});
|
301
|
+
testSingleTab(tabs, tab1, 'toHaveFocus');
|
302
|
+
_context4.next = 11;
|
303
|
+
return testTabPanel(1);
|
304
|
+
case 11:
|
305
|
+
_testWrapper.fireEvent.keyDown(tab0, {
|
306
|
+
key: 'ArrowLeft',
|
307
|
+
code: 'ArrowLeft'
|
308
|
+
});
|
309
|
+
testSingleTab(tabs, tab0, 'toHaveFocus');
|
310
|
+
_context4.next = 15;
|
311
|
+
return testTabPanel(0);
|
312
|
+
case 15:
|
313
|
+
case "end":
|
314
|
+
return _context4.stop();
|
315
|
+
}
|
316
|
+
}, _callee4);
|
317
|
+
})));
|
318
|
+
test('interacting with tabs via focus -- vertical', /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
319
|
+
var _getTabs4, tabs, tab0, tab1;
|
320
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
321
|
+
while (1) switch (_context5.prev = _context5.next) {
|
322
|
+
case 0:
|
323
|
+
getComponent({
|
324
|
+
orientation: 'vertical',
|
325
|
+
keyboardActivation: 'automatic'
|
326
|
+
});
|
327
|
+
_getTabs4 = getTabs(), tabs = _getTabs4.tabs, tab0 = _getTabs4.tab0, tab1 = _getTabs4.tab1;
|
328
|
+
(0, _forEach["default"])(tabs).call(tabs, function (tab) {
|
329
|
+
return expect(tab).not.toHaveFocus();
|
330
|
+
});
|
331
|
+
_userEvent["default"].tab();
|
332
|
+
testSingleTab(tabs, tab0, 'toHaveFocus');
|
333
|
+
_context5.next = 7;
|
334
|
+
return testTabPanel(0);
|
335
|
+
case 7:
|
336
|
+
_testWrapper.fireEvent.keyDown(tab0, {
|
337
|
+
key: 'ArrowDown',
|
338
|
+
code: 'ArrowDown'
|
339
|
+
});
|
340
|
+
testSingleTab(tabs, tab1, 'toHaveFocus');
|
341
|
+
_context5.next = 11;
|
342
|
+
return testTabPanel(1);
|
343
|
+
case 11:
|
344
|
+
_testWrapper.fireEvent.keyDown(tab0, {
|
345
|
+
key: 'ArrowUp',
|
346
|
+
code: 'ArrowUp'
|
347
|
+
});
|
348
|
+
testSingleTab(tabs, tab0, 'toHaveFocus');
|
349
|
+
_context5.next = 15;
|
350
|
+
return testTabPanel(0);
|
351
|
+
case 15:
|
352
|
+
case "end":
|
353
|
+
return _context5.stop();
|
354
|
+
}
|
355
|
+
}, _callee5);
|
356
|
+
})));
|
357
|
+
test('disabled all tabs', /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
|
358
|
+
var _getTabs5, tab0, tab1, tabLine;
|
359
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
360
|
+
while (1) switch (_context6.prev = _context6.next) {
|
361
|
+
case 0:
|
362
|
+
getComponent({
|
363
|
+
isDisabled: true
|
364
|
+
});
|
365
|
+
_getTabs5 = getTabs(), tab0 = _getTabs5.tab0, tab1 = _getTabs5.tab1;
|
366
|
+
tabLine = _testWrapper.screen.queryByRole('presentation'); // Tabs cannot be DOM disabled so must check visuals
|
367
|
+
(0, _forEach["default"])(defaultTabs).call(defaultTabs, function (tab) {
|
368
|
+
if (tab.name) {
|
369
|
+
var tabText = _testWrapper.screen.getByText(tab.name);
|
370
|
+
var parentElement = tabText.parentElement;
|
371
|
+
expect(parentElement).toHaveClass('is-disabled');
|
372
|
+
}
|
373
|
+
});
|
374
|
+
expect(tabLine).not.toBeInTheDocument();
|
340
375
|
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
});
|
376
|
+
// Ensure that clicking a tab does nothing
|
377
|
+
_userEvent["default"].click(tab1);
|
378
|
+
expect(tab0).not.toContainElement(_testWrapper.screen.queryByRole('presentation'));
|
379
|
+
expect(tab1).not.toContainElement(_testWrapper.screen.queryByRole('presentation'));
|
380
|
+
_context6.next = 10;
|
381
|
+
return testTabPanel(0);
|
382
|
+
case 10:
|
383
|
+
case "end":
|
384
|
+
return _context6.stop();
|
385
|
+
}
|
386
|
+
}, _callee6);
|
387
|
+
})));
|
388
|
+
test('disabled tab is not accessible on click or focus', /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
|
389
|
+
var _getTabs6, tabs, tab0, tab1, tab2;
|
390
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
391
|
+
while (1) switch (_context7.prev = _context7.next) {
|
392
|
+
case 0:
|
393
|
+
getComponent({
|
394
|
+
disabledKeys: [defaultTabs[1].name],
|
395
|
+
keyboardActivation: 'automatic'
|
396
|
+
});
|
397
|
+
_context7.next = 3;
|
398
|
+
return testTabPanel(0);
|
399
|
+
case 3:
|
400
|
+
_getTabs6 = getTabs(), tabs = _getTabs6.tabs, tab0 = _getTabs6.tab0, tab1 = _getTabs6.tab1, tab2 = _getTabs6.tab2; // Ensure that clicking a disabled tab does nothing
|
401
|
+
_userEvent["default"].click(tab1);
|
402
|
+
_context7.next = 7;
|
403
|
+
return testTabPanel(0);
|
404
|
+
case 7:
|
405
|
+
// Ensure that disabled tab is not accessible via focus
|
406
|
+
_userEvent["default"].tab();
|
407
|
+
testSingleTab(tabs, tab0, 'toHaveFocus');
|
408
|
+
_testWrapper.fireEvent.keyDown(tab0, {
|
409
|
+
key: 'ArrowRight',
|
410
|
+
code: 'ArrowRight'
|
411
|
+
});
|
412
|
+
testSingleTab(tabs, tab2, 'toHaveFocus');
|
413
|
+
_context7.next = 13;
|
414
|
+
return testTabPanel(2);
|
415
|
+
case 13:
|
416
|
+
case "end":
|
417
|
+
return _context7.stop();
|
418
|
+
}
|
419
|
+
}, _callee7);
|
420
|
+
})));
|
421
|
+
test('controlled tabs', /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
|
422
|
+
var selectedKey, onSelectionChange, _getComponent, rerender, _getTabs7, tabs, tab0, tab1, tab2;
|
423
|
+
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
424
|
+
while (1) switch (_context8.prev = _context8.next) {
|
425
|
+
case 0:
|
426
|
+
selectedKey = defaultTabs[1].name;
|
427
|
+
onSelectionChange = jest.fn();
|
428
|
+
_getComponent = getComponent({
|
429
|
+
selectedKey: selectedKey,
|
430
|
+
onSelectionChange: onSelectionChange
|
431
|
+
}), rerender = _getComponent.rerender;
|
432
|
+
_getTabs7 = getTabs(), tabs = _getTabs7.tabs, tab0 = _getTabs7.tab0, tab1 = _getTabs7.tab1, tab2 = _getTabs7.tab2; // Expect the second tab to be selected
|
433
|
+
expect(onSelectionChange).not.toHaveBeenCalled();
|
434
|
+
testSingleTab(tabs, tab1, 'toContainElement', [_testWrapper.screen.queryByRole('presentation')]);
|
435
|
+
_context8.next = 8;
|
436
|
+
return testTabPanel(1);
|
437
|
+
case 8:
|
438
|
+
// Ensure the event handler is fired, but selected tab does not change
|
439
|
+
_userEvent["default"].click(tab2);
|
440
|
+
expect(onSelectionChange).toHaveBeenCalledWith(defaultTabs[2].name);
|
441
|
+
testSingleTab(tabs, tab1, 'toContainElement', [_testWrapper.screen.queryByRole('presentation')]);
|
442
|
+
_context8.next = 13;
|
443
|
+
return testTabPanel(1);
|
444
|
+
case 13:
|
445
|
+
// Ensure the tab DOES change when selectedKey is updated
|
446
|
+
_userEvent["default"].click(tab0);
|
447
|
+
expect(onSelectionChange).toHaveBeenCalledWith(defaultTabs[0].name);
|
448
|
+
getComponent({
|
449
|
+
selectedKey: defaultTabs[0].name,
|
450
|
+
onSelectionChange: onSelectionChange
|
451
|
+
}, {
|
452
|
+
renderFn: rerender
|
453
|
+
});
|
454
|
+
testSingleTab(tabs, tab0, 'toContainElement', [_testWrapper.screen.queryByRole('presentation')]);
|
455
|
+
_context8.next = 19;
|
456
|
+
return testTabPanel(0);
|
457
|
+
case 19:
|
458
|
+
case "end":
|
459
|
+
return _context8.stop();
|
460
|
+
}
|
461
|
+
}, _callee8);
|
462
|
+
})));
|
353
463
|
test('tab line props', function () {
|
354
464
|
var newTabs = (0, _from["default"])(defaultTabs);
|
355
465
|
newTabs[0].props = {
|
@@ -399,37 +509,44 @@ test('tab with icon', function () {
|
|
399
509
|
// Expect the tab to have the given icon element
|
400
510
|
testSingleTab(tabs, tab0, 'toContainElement', [icon]);
|
401
511
|
});
|
402
|
-
test('tooltip renders on tab\'s hover in `tooltip` mode', /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regeneratorRuntime().mark(function
|
403
|
-
var
|
404
|
-
return _regeneratorRuntime().wrap(function
|
405
|
-
while (1) switch (
|
512
|
+
test('tooltip renders on tab\'s hover in `tooltip` mode', /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
|
513
|
+
var test;
|
514
|
+
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
515
|
+
while (1) switch (_context9.prev = _context9.next) {
|
406
516
|
case 0:
|
407
517
|
getComponent({
|
408
518
|
mode: 'tooltip'
|
409
519
|
});
|
410
520
|
expect(_testWrapper.screen.queryByRole('tooltip')).not.toBeInTheDocument();
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
521
|
+
|
522
|
+
// const { tab1 } = getTabs();
|
523
|
+
// fireEvent.mouseMove(tab1);
|
524
|
+
// fireEvent.mouseEnter(tab1);
|
525
|
+
// await userEvent.hover(tab1);
|
526
|
+
test = _testWrapper.screen.getAllByTestId('test-me')[1];
|
527
|
+
_testWrapper.fireEvent.mouseMove(test);
|
528
|
+
_testWrapper.fireEvent.mouseEnter(test);
|
529
|
+
_context9.next = 7;
|
530
|
+
return _userEvent["default"].hover(test);
|
531
|
+
case 7:
|
532
|
+
jest.advanceTimersByTime(100);
|
533
|
+
expect(_testWrapper.screen.queryByRole('tooltip')).not.toBeInTheDocument();
|
534
|
+
case 9:
|
418
535
|
case "end":
|
419
|
-
return
|
536
|
+
return _context9.stop();
|
420
537
|
}
|
421
|
-
},
|
538
|
+
}, _callee9);
|
422
539
|
})));
|
423
|
-
test('tooltip does not render on tab\'s hover in `tooltipIsDisabled` mode', /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regeneratorRuntime().mark(function
|
424
|
-
var
|
425
|
-
return _regeneratorRuntime().wrap(function
|
426
|
-
while (1) switch (
|
540
|
+
test('tooltip does not render on tab\'s hover in `tooltipIsDisabled` mode', /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
|
541
|
+
var _getTabs10, tab0;
|
542
|
+
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
543
|
+
while (1) switch (_context10.prev = _context10.next) {
|
427
544
|
case 0:
|
428
545
|
getComponent({
|
429
546
|
mode: 'tooltipIsDisabled'
|
430
547
|
});
|
431
548
|
expect(_testWrapper.screen.queryByRole('tooltip')).not.toBeInTheDocument();
|
432
|
-
|
549
|
+
_getTabs10 = getTabs(), tab0 = _getTabs10.tab0;
|
433
550
|
_testWrapper.fireEvent.mouseMove(tab0);
|
434
551
|
_testWrapper.fireEvent.mouseEnter(tab0);
|
435
552
|
(0, _setTimeout2["default"])(function () {
|
@@ -437,9 +554,9 @@ test('tooltip does not render on tab\'s hover in `tooltipIsDisabled` mode', /*#_
|
|
437
554
|
}, 0);
|
438
555
|
case 6:
|
439
556
|
case "end":
|
440
|
-
return
|
557
|
+
return _context10.stop();
|
441
558
|
}
|
442
|
-
},
|
559
|
+
}, _callee10);
|
443
560
|
})));
|
444
561
|
test('tabs without selected keys show null tab panel content', function () {
|
445
562
|
getComponent({
|
@@ -449,8 +566,8 @@ test('tabs without selected keys show null tab panel content', function () {
|
|
449
566
|
});
|
450
567
|
test('hover tab style', function () {
|
451
568
|
getComponent();
|
452
|
-
var
|
453
|
-
tab0 =
|
569
|
+
var _getTabs11 = getTabs(),
|
570
|
+
tab0 = _getTabs11.tab0;
|
454
571
|
expect(tab0).not.toHaveClass('is-hovered');
|
455
572
|
_userEvent["default"].hover(tab0);
|
456
573
|
expect(tab0).toHaveClass('is-hovered');
|
@@ -489,20 +606,24 @@ test('will render slots.afterTab if provided', function () {
|
|
489
606
|
});
|
490
607
|
expect(_testWrapper.screen.getByText(testText)).toBeInTheDocument();
|
491
608
|
});
|
492
|
-
test('will render tab with list if provided', /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regeneratorRuntime().mark(function
|
493
|
-
var
|
494
|
-
return _regeneratorRuntime().wrap(function
|
495
|
-
while (1) switch (
|
609
|
+
test('will render tab with list if provided', /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {
|
610
|
+
var _getTabs12, menuBtn, menuItems, firstListItemContent;
|
611
|
+
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
612
|
+
while (1) switch (_context11.prev = _context11.next) {
|
496
613
|
case 0:
|
497
614
|
getComponentWithDynamicItems({
|
498
615
|
items: tabsWithList,
|
499
616
|
mode: 'list'
|
500
617
|
});
|
501
|
-
|
502
|
-
|
618
|
+
_context11.next = 3;
|
619
|
+
return testTabPanel(0);
|
620
|
+
case 3:
|
621
|
+
_getTabs12 = getTabs(), menuBtn = _getTabs12.tab1.parentElement;
|
503
622
|
if (menuBtn) _userEvent["default"].click(menuBtn);
|
504
623
|
expect(_testWrapper.screen.queryByRole('menu')).toBeInTheDocument();
|
505
|
-
|
624
|
+
_context11.next = 8;
|
625
|
+
return testTabPanel(0);
|
626
|
+
case 8:
|
506
627
|
menuItems = _testWrapper.screen.queryAllByRole('menuitemradio');
|
507
628
|
if (tabsWithList[1].list) {
|
508
629
|
expect(menuItems).toHaveLength(tabsWithList[1].list.length);
|
@@ -514,49 +635,59 @@ test('will render tab with list if provided', /*#__PURE__*/(0, _asyncToGenerator
|
|
514
635
|
expect(_testWrapper.screen.queryByRole('tabpanel')).toHaveTextContent(firstListItemContent);
|
515
636
|
}
|
516
637
|
expect(_testWrapper.screen.queryByRole('menu')).not.toBeInTheDocument();
|
517
|
-
case
|
638
|
+
case 14:
|
518
639
|
case "end":
|
519
|
-
return
|
640
|
+
return _context11.stop();
|
520
641
|
}
|
521
|
-
},
|
642
|
+
}, _callee11);
|
522
643
|
})));
|
523
|
-
test('tab list is accessible via keyboard', function () {
|
524
|
-
|
525
|
-
|
526
|
-
|
527
|
-
|
528
|
-
|
529
|
-
|
530
|
-
|
531
|
-
|
532
|
-
|
533
|
-
|
534
|
-
|
535
|
-
|
536
|
-
|
537
|
-
|
538
|
-
|
539
|
-
|
540
|
-
|
541
|
-
|
542
|
-
|
543
|
-
|
544
|
-
|
545
|
-
|
546
|
-
|
547
|
-
|
548
|
-
|
549
|
-
|
550
|
-
|
551
|
-
|
552
|
-
|
553
|
-
|
554
|
-
|
555
|
-
|
556
|
-
|
557
|
-
|
558
|
-
|
559
|
-
|
560
|
-
|
561
|
-
|
562
|
-
|
644
|
+
test('tab list is accessible via keyboard', /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12() {
|
645
|
+
var _getTabs13, tabs, tab0, tab1, menuItems, firstListItemContent;
|
646
|
+
return _regeneratorRuntime().wrap(function _callee12$(_context12) {
|
647
|
+
while (1) switch (_context12.prev = _context12.next) {
|
648
|
+
case 0:
|
649
|
+
getComponentWithDynamicItems({
|
650
|
+
items: tabsWithList,
|
651
|
+
mode: 'list'
|
652
|
+
});
|
653
|
+
_getTabs13 = getTabs(), tabs = _getTabs13.tabs, tab0 = _getTabs13.tab0, tab1 = _getTabs13.tab1;
|
654
|
+
(0, _forEach["default"])(tabs).call(tabs, function (tab) {
|
655
|
+
return expect(tab).not.toHaveFocus();
|
656
|
+
});
|
657
|
+
_userEvent["default"].tab();
|
658
|
+
_context12.next = 6;
|
659
|
+
return testTabPanel(0);
|
660
|
+
case 6:
|
661
|
+
_testWrapper.fireEvent.keyDown(tab0, {
|
662
|
+
key: 'ArrowRight',
|
663
|
+
code: 'ArrowRight'
|
664
|
+
});
|
665
|
+
expect(tab1).toHaveFocus();
|
666
|
+
_testWrapper.fireEvent.keyDown(tab1, {
|
667
|
+
key: 'Enter',
|
668
|
+
code: 'Enter'
|
669
|
+
});
|
670
|
+
expect(_testWrapper.screen.queryByRole('menu')).toBeInTheDocument();
|
671
|
+
_context12.next = 12;
|
672
|
+
return testTabPanel(0);
|
673
|
+
case 12:
|
674
|
+
menuItems = _testWrapper.screen.queryAllByRole('menuitemradio');
|
675
|
+
if (tabsWithList[1].list) {
|
676
|
+
expect(menuItems).toHaveLength(tabsWithList[1].list.length);
|
677
|
+
}
|
678
|
+
expect(menuItems[0]).toHaveFocus();
|
679
|
+
_testWrapper.fireEvent.keyDown(menuItems[0], {
|
680
|
+
key: 'Enter',
|
681
|
+
code: 'Enter'
|
682
|
+
});
|
683
|
+
if (tabsWithList[1].list) {
|
684
|
+
firstListItemContent = tabsWithList[1].list[0].children;
|
685
|
+
expect(_testWrapper.screen.queryByRole('tabpanel')).toHaveTextContent(firstListItemContent);
|
686
|
+
}
|
687
|
+
expect(_testWrapper.screen.queryByRole('menu')).not.toBeInTheDocument();
|
688
|
+
case 18:
|
689
|
+
case "end":
|
690
|
+
return _context12.stop();
|
691
|
+
}
|
692
|
+
}, _callee12);
|
693
|
+
})));
|