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