@pingux/astro 2.17.0 → 2.18.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 +13 -15
- package/lib/cjs/components/ArrayField/ArrayField.stories.js +1 -3
- package/lib/cjs/components/Calendar/Calendar.test.js +13 -15
- package/lib/cjs/components/CodeView/CodeView.test.js +45 -53
- package/lib/cjs/components/ComboBoxField/ComboBoxField.stories.js +35 -37
- package/lib/cjs/components/ComboBoxField/ComboBoxField.test.js +122 -132
- package/lib/cjs/components/CopyText/CopyText.test.js +191 -223
- package/lib/cjs/components/DataTable/DataTable.stories.js +75 -79
- package/lib/cjs/components/DataTable/DataTable.test.js +569 -629
- package/lib/cjs/components/DatePicker/DateField.js +1 -1
- package/lib/cjs/components/DatePicker/DatePicker.test.js +81 -87
- package/lib/cjs/components/EnvironmentBreadcrumb/EnvironmentBreadcrumb.js +2 -2
- package/lib/cjs/components/EnvironmentBreadcrumb/EnvironmentBreadcrumb.test.js +19 -16
- package/lib/cjs/components/EnvironmentBreadcrumb/EnvironmentBreadcrumbAxe.test.js +7 -0
- package/lib/cjs/components/HelpHint/HelpHint.js +5 -2
- package/lib/cjs/components/HelpHint/HelpHint.stories.js +3 -2
- package/lib/cjs/components/HelpHint/HelpHint.styles.js +5 -1
- package/lib/cjs/components/HelpHint/HelpHint.test.js +145 -146
- package/lib/cjs/components/ImageUploadField/ImageUploadField.stories.js +73 -77
- package/lib/cjs/components/ImageUploadField/ImageUploadField.test.js +150 -162
- package/lib/cjs/components/LinkSelectField/LinkSelectField.stories.js +26 -28
- package/lib/cjs/components/LinkSelectField/LinkSelectField.test.js +13 -15
- package/lib/cjs/components/ListBox/ListBox.js +1 -1
- package/lib/cjs/components/ListBox/ListBox.test.js +13 -15
- package/lib/cjs/components/ListBox/Option.js +1 -1
- package/lib/cjs/components/ListView/ListView.stories.js +124 -95
- package/lib/cjs/components/ListView/ListView.test.js +119 -133
- package/lib/cjs/components/ListViewItem/ListViewItem.mdx +1 -0
- package/lib/cjs/components/ListViewItem/ListViewItem.stories.js +36 -2
- package/lib/cjs/components/ListViewItem/ListViewItem.styles.js +1 -1
- package/lib/cjs/components/ListViewItem/controls/ListViewItemMenu.test.js +23 -25
- package/lib/cjs/components/ListViewItem/controls/chart/ListViewItemChart.js +102 -0
- package/lib/cjs/components/ListViewItem/controls/chart/ListViewItemChart.mdx +11 -0
- package/lib/cjs/components/ListViewItem/controls/chart/ListViewItemChart.stories.js +50 -0
- package/lib/cjs/components/ListViewItem/controls/chart/ListViewItemChart.styles.js +112 -0
- package/lib/cjs/components/ListViewItem/controls/chart/ListViewItemChart.test.js +76 -0
- package/lib/cjs/components/ListViewItem/controls/chart/ListViewItemChartAttributes.js +127 -0
- package/lib/cjs/components/ListViewItem/controls/chart/chartData.js +45 -0
- package/lib/cjs/components/MultivaluesField/MultivaluesField.test.js +61 -72
- package/lib/cjs/components/PasswordField/PasswordField.test.js +44 -50
- package/lib/cjs/components/RadioGroupField/RadioGroupField.test.js +24 -26
- package/lib/cjs/components/ScrollBox/ScrollBox.js +2 -2
- package/lib/cjs/components/SelectField/SelectField.stories.js +26 -28
- package/lib/cjs/components/SelectFieldBase/SelectFieldBase.test.js +13 -15
- package/lib/cjs/components/Stepper/Stepper.test.js +53 -55
- package/lib/cjs/components/Tabs/Tabs.js +1 -1
- package/lib/cjs/components/Tabs/Tabs.test.js +37 -41
- package/lib/cjs/components/TextArea/TextArea.styles.js +7 -1
- package/lib/cjs/components/TooltipTrigger/TooltipTrigger.test.js +45 -29
- package/lib/cjs/experimental/PanelHeader/controls/PanelHeaderMenu.test.js +23 -25
- package/lib/cjs/hooks/useComponentToggle/useComponentToggle.test.js +22 -26
- package/lib/cjs/hooks/useCopyToClipboard/useCopyToClipboard.js +42 -44
- package/lib/cjs/hooks/useCopyToClipboard/useCopyToClipboard.test.js +12 -14
- package/lib/cjs/hooks/useField/useField.js +1 -1
- package/lib/cjs/hooks/useImageUploadState/useImageUploadState.js +5 -5
- package/lib/cjs/hooks/useLabelHeight/useLabelHeight.js +2 -2
- package/lib/cjs/hooks/useOverlappingMenuHoverState/useOverlappingMenuHoverState.test.js +98 -112
- package/lib/cjs/index.d.ts +1 -0
- package/lib/cjs/index.js +8 -0
- package/lib/cjs/styles/variants/variants.js +2 -0
- package/lib/cjs/types/index.d.ts +1 -0
- package/lib/cjs/types/index.js +17 -6
- package/lib/cjs/types/item.d.ts +29 -0
- package/lib/cjs/types/item.js +6 -0
- package/lib/cjs/utils/testUtils/testAxe.js +25 -28
- package/lib/components/AccordionGridGroup/AccordionGridGroup.test.js +13 -15
- package/lib/components/ArrayField/ArrayField.stories.js +1 -3
- package/lib/components/Box/Box.js +6 -6
- package/lib/components/Calendar/Calendar.test.js +13 -15
- package/lib/components/CodeView/CodeView.test.js +45 -53
- package/lib/components/ComboBoxField/ComboBoxField.stories.js +35 -37
- package/lib/components/ComboBoxField/ComboBoxField.test.js +122 -132
- package/lib/components/CopyText/CopyText.test.js +191 -223
- package/lib/components/DataTable/DataTable.stories.js +75 -79
- package/lib/components/DataTable/DataTable.test.js +569 -629
- package/lib/components/DatePicker/DateField.js +1 -1
- package/lib/components/DatePicker/DatePicker.test.js +81 -87
- package/lib/components/EnvironmentBreadcrumb/EnvironmentBreadcrumb.js +2 -2
- package/lib/components/EnvironmentBreadcrumb/EnvironmentBreadcrumb.test.js +15 -18
- package/lib/components/EnvironmentBreadcrumb/EnvironmentBreadcrumbAxe.test.js +4 -0
- package/lib/components/HelpHint/HelpHint.js +5 -2
- package/lib/components/HelpHint/HelpHint.stories.js +3 -2
- package/lib/components/HelpHint/HelpHint.styles.js +5 -1
- package/lib/components/HelpHint/HelpHint.test.js +145 -146
- package/lib/components/ImageUploadField/ImageUploadField.stories.js +73 -77
- package/lib/components/ImageUploadField/ImageUploadField.test.js +150 -162
- package/lib/components/LinkSelectField/LinkSelectField.stories.js +26 -28
- package/lib/components/LinkSelectField/LinkSelectField.test.js +13 -15
- package/lib/components/ListBox/ListBox.js +1 -1
- package/lib/components/ListBox/ListBox.test.js +13 -15
- package/lib/components/ListBox/Option.js +1 -1
- package/lib/components/ListView/ListView.stories.js +118 -94
- package/lib/components/ListView/ListView.test.js +119 -133
- package/lib/components/ListViewItem/ListViewItem.mdx +1 -0
- package/lib/components/ListViewItem/ListViewItem.stories.js +30 -2
- package/lib/components/ListViewItem/ListViewItem.styles.js +1 -1
- package/lib/components/ListViewItem/controls/ListViewItemMenu.test.js +23 -25
- package/lib/components/ListViewItem/controls/chart/ListViewItemChart.js +88 -0
- package/lib/components/ListViewItem/controls/chart/ListViewItemChart.mdx +11 -0
- package/lib/components/ListViewItem/controls/chart/ListViewItemChart.stories.js +35 -0
- package/lib/components/ListViewItem/controls/chart/ListViewItemChart.styles.js +104 -0
- package/lib/components/ListViewItem/controls/chart/ListViewItemChart.test.js +73 -0
- package/lib/components/ListViewItem/controls/chart/ListViewItemChartAttributes.js +118 -0
- package/lib/components/ListViewItem/controls/chart/chartData.js +37 -0
- package/lib/components/MultivaluesField/MultivaluesField.test.js +61 -72
- package/lib/components/PasswordField/PasswordField.test.js +44 -50
- package/lib/components/RadioGroupField/RadioGroupField.test.js +24 -26
- package/lib/components/ScrollBox/ScrollBox.js +2 -2
- package/lib/components/SelectField/SelectField.stories.js +26 -28
- package/lib/components/SelectFieldBase/SelectFieldBase.test.js +13 -15
- package/lib/components/Stepper/Stepper.test.js +53 -55
- package/lib/components/Tabs/Tabs.js +1 -1
- package/lib/components/Tabs/Tabs.test.js +37 -41
- package/lib/components/TextArea/TextArea.styles.js +7 -1
- package/lib/components/TooltipTrigger/TooltipTrigger.test.js +45 -29
- package/lib/experimental/PanelHeader/controls/PanelHeaderMenu.test.js +23 -25
- package/lib/hooks/useComponentToggle/useComponentToggle.test.js +22 -26
- package/lib/hooks/useCopyToClipboard/useCopyToClipboard.js +42 -44
- package/lib/hooks/useCopyToClipboard/useCopyToClipboard.test.js +12 -14
- package/lib/hooks/useField/useField.js +1 -1
- package/lib/hooks/useImageUploadState/useImageUploadState.js +5 -5
- package/lib/hooks/useLabelHeight/useLabelHeight.js +2 -2
- package/lib/hooks/useOverlappingMenuHoverState/useOverlappingMenuHoverState.test.js +98 -112
- package/lib/index.js +1 -0
- package/lib/styles/variants/variants.js +2 -0
- package/lib/types/index.js +1 -0
- package/lib/types/item.js +1 -0
- package/lib/utils/testUtils/testAxe.js +25 -28
- package/package.json +5 -4
@@ -17,7 +17,7 @@ import _typeof from "@babel/runtime-corejs3/helpers/esm/typeof";
|
|
17
17
|
import _asyncToGenerator from "@babel/runtime-corejs3/helpers/esm/asyncToGenerator";
|
18
18
|
import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
|
19
19
|
import _defineProperty from "@babel/runtime-corejs3/helpers/esm/defineProperty";
|
20
|
-
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 _context19; _forEachInstanceProperty(_context19 = ["next", "throw", "return"]).call(_context19, 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 _context20; 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(_context20 = this.tryEntries).call(_context20, 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; }
|
20
|
+
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 _context19; _forEachInstanceProperty(_context19 = ["next", "throw", "return"]).call(_context19, 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 _context20; 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(_context20 = this.tryEntries).call(_context20, 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; }
|
21
21
|
function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
22
22
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context17, _context18; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context17 = ownKeys(Object(source), !0)).call(_context17, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context18 = ownKeys(Object(source))).call(_context18, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
|
23
23
|
import React from 'react';
|
@@ -90,239 +90,211 @@ describe('CopyText', function () {
|
|
90
90
|
test('click on text copies data to the clipboard', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
91
91
|
var button;
|
92
92
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
93
|
-
while (1) {
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
return
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
case 6:
|
116
|
-
case "end":
|
117
|
-
return _context2.stop();
|
118
|
-
}
|
93
|
+
while (1) switch (_context2.prev = _context2.next) {
|
94
|
+
case 0:
|
95
|
+
getComponent();
|
96
|
+
button = screen.getByText(textValue);
|
97
|
+
_context2.next = 4;
|
98
|
+
return act( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
99
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
100
|
+
while (1) switch (_context.prev = _context.next) {
|
101
|
+
case 0:
|
102
|
+
return _context.abrupt("return", userEvent.click(button));
|
103
|
+
case 1:
|
104
|
+
case "end":
|
105
|
+
return _context.stop();
|
106
|
+
}
|
107
|
+
}, _callee);
|
108
|
+
})));
|
109
|
+
case 4:
|
110
|
+
expect(navigator.clipboard.writeText).toBeCalledTimes(1);
|
111
|
+
expect(navigator.clipboard.writeText).toHaveBeenCalledWith(textValue);
|
112
|
+
case 6:
|
113
|
+
case "end":
|
114
|
+
return _context2.stop();
|
119
115
|
}
|
120
116
|
}, _callee2);
|
121
117
|
})));
|
122
118
|
test('click on copy button copies data to the clipboard', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
123
119
|
var button;
|
124
120
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
125
|
-
while (1) {
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
return
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
case 6:
|
148
|
-
case "end":
|
149
|
-
return _context4.stop();
|
150
|
-
}
|
121
|
+
while (1) switch (_context4.prev = _context4.next) {
|
122
|
+
case 0:
|
123
|
+
getComponent();
|
124
|
+
button = screen.getByLabelText('copy to clipboard');
|
125
|
+
_context4.next = 4;
|
126
|
+
return act( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
127
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
128
|
+
while (1) switch (_context3.prev = _context3.next) {
|
129
|
+
case 0:
|
130
|
+
return _context3.abrupt("return", userEvent.click(button));
|
131
|
+
case 1:
|
132
|
+
case "end":
|
133
|
+
return _context3.stop();
|
134
|
+
}
|
135
|
+
}, _callee3);
|
136
|
+
})));
|
137
|
+
case 4:
|
138
|
+
expect(navigator.clipboard.writeText).toBeCalledTimes(1);
|
139
|
+
expect(navigator.clipboard.writeText).toHaveBeenCalledWith(textValue);
|
140
|
+
case 6:
|
141
|
+
case "end":
|
142
|
+
return _context4.stop();
|
151
143
|
}
|
152
144
|
}, _callee4);
|
153
145
|
})));
|
154
146
|
test('if textToCopy is provided it\'s copied to clipboard instead of children text data', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
|
155
147
|
var textToCopy, button;
|
156
148
|
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
157
|
-
while (1) {
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
return
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
case 7:
|
183
|
-
case "end":
|
184
|
-
return _context6.stop();
|
185
|
-
}
|
149
|
+
while (1) switch (_context6.prev = _context6.next) {
|
150
|
+
case 0:
|
151
|
+
textToCopy = 'This text is copied';
|
152
|
+
getComponent({
|
153
|
+
textToCopy: textToCopy
|
154
|
+
});
|
155
|
+
button = screen.getByLabelText('copy to clipboard');
|
156
|
+
_context6.next = 5;
|
157
|
+
return act( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
158
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
159
|
+
while (1) switch (_context5.prev = _context5.next) {
|
160
|
+
case 0:
|
161
|
+
return _context5.abrupt("return", userEvent.click(button));
|
162
|
+
case 1:
|
163
|
+
case "end":
|
164
|
+
return _context5.stop();
|
165
|
+
}
|
166
|
+
}, _callee5);
|
167
|
+
})));
|
168
|
+
case 5:
|
169
|
+
expect(navigator.clipboard.writeText).toBeCalledTimes(1);
|
170
|
+
expect(navigator.clipboard.writeText).toHaveBeenCalledWith(textToCopy);
|
171
|
+
case 7:
|
172
|
+
case "end":
|
173
|
+
return _context6.stop();
|
186
174
|
}
|
187
175
|
}, _callee6);
|
188
176
|
})));
|
189
177
|
test('copying works in insecure origin', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
|
190
178
|
var button;
|
191
179
|
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
192
|
-
while (1) {
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
return
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
case 7:
|
216
|
-
case "end":
|
217
|
-
return _context8.stop();
|
218
|
-
}
|
180
|
+
while (1) switch (_context8.prev = _context8.next) {
|
181
|
+
case 0:
|
182
|
+
global.navigator.clipboard = undefined;
|
183
|
+
getComponent();
|
184
|
+
button = screen.getByLabelText('copy to clipboard');
|
185
|
+
_context8.next = 5;
|
186
|
+
return act( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
|
187
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
188
|
+
while (1) switch (_context7.prev = _context7.next) {
|
189
|
+
case 0:
|
190
|
+
return _context7.abrupt("return", userEvent.click(button));
|
191
|
+
case 1:
|
192
|
+
case "end":
|
193
|
+
return _context7.stop();
|
194
|
+
}
|
195
|
+
}, _callee7);
|
196
|
+
})));
|
197
|
+
case 5:
|
198
|
+
expect(document.execCommand).toBeCalledTimes(1);
|
199
|
+
expect(document.execCommand).toHaveBeenCalledWith('copy');
|
200
|
+
case 7:
|
201
|
+
case "end":
|
202
|
+
return _context8.stop();
|
219
203
|
}
|
220
204
|
}, _callee8);
|
221
205
|
})));
|
222
206
|
test('if copying is failed, a warning shows in the console', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
|
223
207
|
var spy, button;
|
224
208
|
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
225
|
-
while (1) {
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
}; // eslint-disable-line no-console
|
209
|
+
while (1) switch (_context10.prev = _context10.next) {
|
210
|
+
case 0:
|
211
|
+
global.navigator.clipboard = undefined;
|
212
|
+
global.document.execCommand.mockReturnValue(false);
|
213
|
+
global.console.error = function () {
|
214
|
+
return jest.mock();
|
215
|
+
}; // eslint-disable-line no-console
|
233
216
|
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
case "end":
|
258
|
-
return _context10.stop();
|
259
|
-
}
|
217
|
+
getComponent();
|
218
|
+
spy = jest.spyOn(console, 'error');
|
219
|
+
expect(spy).not.toHaveBeenCalled();
|
220
|
+
button = screen.getByLabelText('copy to clipboard');
|
221
|
+
_context10.next = 9;
|
222
|
+
return act( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
|
223
|
+
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
224
|
+
while (1) switch (_context9.prev = _context9.next) {
|
225
|
+
case 0:
|
226
|
+
return _context9.abrupt("return", userEvent.click(button));
|
227
|
+
case 1:
|
228
|
+
case "end":
|
229
|
+
return _context9.stop();
|
230
|
+
}
|
231
|
+
}, _callee9);
|
232
|
+
})));
|
233
|
+
case 9:
|
234
|
+
expect(document.execCommand).toBeCalledTimes(1);
|
235
|
+
expect(document.execCommand).toHaveBeenCalledWith('copy');
|
236
|
+
expect(spy).toHaveBeenCalledWith(expect.stringMatching('Failed to copy:'), expect.any(Error));
|
237
|
+
case 12:
|
238
|
+
case "end":
|
239
|
+
return _context10.stop();
|
260
240
|
}
|
261
241
|
}, _callee10);
|
262
242
|
})));
|
263
243
|
test('after button click, the tooltip renders with the text "Copied!"', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12() {
|
264
244
|
var button;
|
265
245
|
return _regeneratorRuntime().wrap(function _callee12$(_context12) {
|
266
|
-
while (1) {
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
return
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
case 6:
|
289
|
-
case "end":
|
290
|
-
return _context12.stop();
|
291
|
-
}
|
246
|
+
while (1) switch (_context12.prev = _context12.next) {
|
247
|
+
case 0:
|
248
|
+
getComponent();
|
249
|
+
button = screen.getByLabelText('copy to clipboard');
|
250
|
+
_context12.next = 4;
|
251
|
+
return act( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {
|
252
|
+
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
253
|
+
while (1) switch (_context11.prev = _context11.next) {
|
254
|
+
case 0:
|
255
|
+
return _context11.abrupt("return", userEvent.click(button));
|
256
|
+
case 1:
|
257
|
+
case "end":
|
258
|
+
return _context11.stop();
|
259
|
+
}
|
260
|
+
}, _callee11);
|
261
|
+
})));
|
262
|
+
case 4:
|
263
|
+
expect(screen.queryByRole('tooltip')).toBeInTheDocument();
|
264
|
+
expect(screen.queryByRole('tooltip')).toHaveTextContent('Copied!');
|
265
|
+
case 6:
|
266
|
+
case "end":
|
267
|
+
return _context12.stop();
|
292
268
|
}
|
293
269
|
}, _callee12);
|
294
270
|
})));
|
295
271
|
test('tooltip renders with the text "Copied!" hides after delay', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14() {
|
296
272
|
var button;
|
297
273
|
return _regeneratorRuntime().wrap(function _callee14$(_context14) {
|
298
|
-
while (1) {
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
return
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
case 8:
|
323
|
-
case "end":
|
324
|
-
return _context14.stop();
|
325
|
-
}
|
274
|
+
while (1) switch (_context14.prev = _context14.next) {
|
275
|
+
case 0:
|
276
|
+
getComponent();
|
277
|
+
button = screen.getByLabelText('copy to clipboard');
|
278
|
+
_context14.next = 4;
|
279
|
+
return act( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13() {
|
280
|
+
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
281
|
+
while (1) switch (_context13.prev = _context13.next) {
|
282
|
+
case 0:
|
283
|
+
return _context13.abrupt("return", userEvent.click(button));
|
284
|
+
case 1:
|
285
|
+
case "end":
|
286
|
+
return _context13.stop();
|
287
|
+
}
|
288
|
+
}, _callee13);
|
289
|
+
})));
|
290
|
+
case 4:
|
291
|
+
expect(screen.queryByRole('tooltip')).toBeInTheDocument();
|
292
|
+
expect(screen.queryByRole('tooltip')).toHaveTextContent('Copied!');
|
293
|
+
_context14.next = 8;
|
294
|
+
return waitForElementToBeRemoved(screen.queryByRole('tooltip'));
|
295
|
+
case 8:
|
296
|
+
case "end":
|
297
|
+
return _context14.stop();
|
326
298
|
}
|
327
299
|
}, _callee14);
|
328
300
|
})));
|
@@ -368,32 +340,28 @@ describe('CopyText', function () {
|
|
368
340
|
test('click on copy button copies data to the clipboard', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16() {
|
369
341
|
var button;
|
370
342
|
return _regeneratorRuntime().wrap(function _callee16$(_context16) {
|
371
|
-
while (1) {
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
return
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
case 6:
|
394
|
-
case "end":
|
395
|
-
return _context16.stop();
|
396
|
-
}
|
343
|
+
while (1) switch (_context16.prev = _context16.next) {
|
344
|
+
case 0:
|
345
|
+
getComponent();
|
346
|
+
button = screen.getByLabelText('copy to clipboard');
|
347
|
+
_context16.next = 4;
|
348
|
+
return act( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15() {
|
349
|
+
return _regeneratorRuntime().wrap(function _callee15$(_context15) {
|
350
|
+
while (1) switch (_context15.prev = _context15.next) {
|
351
|
+
case 0:
|
352
|
+
return _context15.abrupt("return", userEvent.click(button));
|
353
|
+
case 1:
|
354
|
+
case "end":
|
355
|
+
return _context15.stop();
|
356
|
+
}
|
357
|
+
}, _callee15);
|
358
|
+
})));
|
359
|
+
case 4:
|
360
|
+
expect(navigator.clipboard.writeText).toBeCalledTimes(1);
|
361
|
+
expect(navigator.clipboard.writeText).toHaveBeenCalledWith(linkValue);
|
362
|
+
case 6:
|
363
|
+
case "end":
|
364
|
+
return _context16.stop();
|
397
365
|
}
|
398
366
|
}, _callee16);
|
399
367
|
})));
|