@pingux/astro 2.117.0 → 2.118.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/ComboBoxField/ComboBoxField.js +0 -1
- package/lib/cjs/components/ComboBoxField/ComboBoxField.stories.js +24 -16
- package/lib/cjs/components/ComboBoxField/ComboBoxField.test.js +74 -32
- package/lib/components/ComboBoxField/ComboBoxField.js +0 -1
- package/lib/components/ComboBoxField/ComboBoxField.stories.js +24 -16
- package/lib/components/ComboBoxField/ComboBoxField.test.js +74 -32
- package/package.json +1 -1
@@ -107,31 +107,40 @@ var withSection = [{
|
|
107
107
|
name: 'Animals',
|
108
108
|
key: 'Animals',
|
109
109
|
children: [{
|
110
|
-
name: 'Raccoon'
|
110
|
+
name: 'Raccoon',
|
111
|
+
key: 'raccoon'
|
111
112
|
}, {
|
112
|
-
name: 'Kangaroo'
|
113
|
+
name: 'Kangaroo',
|
114
|
+
key: 'kangaroo'
|
113
115
|
}, {
|
114
|
-
name: 'Opossum'
|
116
|
+
name: 'Opossum',
|
117
|
+
key: 'opossum'
|
115
118
|
}]
|
116
119
|
}, {
|
117
120
|
name: 'People',
|
118
121
|
key: 'People',
|
119
122
|
children: [{
|
120
|
-
name: 'Michael'
|
123
|
+
name: 'Michael',
|
124
|
+
key: 'michael'
|
121
125
|
}, {
|
122
|
-
name: 'Dwight'
|
126
|
+
name: 'Dwight',
|
127
|
+
key: 'dwight'
|
123
128
|
}, {
|
124
|
-
name: 'Creed'
|
129
|
+
name: 'Creed',
|
130
|
+
key: 'creed'
|
125
131
|
}]
|
126
132
|
}, {
|
127
|
-
name:
|
133
|
+
name: 'Fruits',
|
128
134
|
key: 'fruit',
|
129
135
|
children: [{
|
130
|
-
name: 'Apple'
|
136
|
+
name: 'Apple',
|
137
|
+
key: 'apple'
|
131
138
|
}, {
|
132
|
-
name: 'Orange'
|
139
|
+
name: 'Orange',
|
140
|
+
key: 'orange'
|
133
141
|
}, {
|
134
|
-
name: 'Banana'
|
142
|
+
name: 'Banana',
|
143
|
+
key: 'banana'
|
135
144
|
}]
|
136
145
|
}];
|
137
146
|
var actions = {
|
@@ -221,17 +230,17 @@ var Default = function Default(args) {
|
|
221
230
|
};
|
222
231
|
exports.Default = Default;
|
223
232
|
var WithSections = function WithSections(args) {
|
224
|
-
return (0, _react2.jsx)(_index.OverlayProvider, null, (0, _react2.jsx)(_index.ComboBoxField, (0, _extends2["default"])({
|
233
|
+
return (0, _react2.jsx)(_index.OverlayProvider, null, (0, _react2.jsx)(_index.ComboBoxField, (0, _extends2["default"])({}, args, {
|
225
234
|
label: "Example label",
|
226
|
-
|
227
|
-
}
|
235
|
+
defaultItems: withSection
|
236
|
+
}), function (section) {
|
228
237
|
return (0, _react2.jsx)(_index.Section, {
|
229
238
|
key: section.key,
|
230
239
|
items: section.children,
|
231
240
|
title: section.name
|
232
241
|
}, function (item) {
|
233
242
|
return (0, _react2.jsx)(_index.Item, {
|
234
|
-
key: item.
|
243
|
+
key: item.key
|
235
244
|
}, item.name);
|
236
245
|
});
|
237
246
|
}));
|
@@ -448,8 +457,7 @@ var WithCustomInputValue = function WithCustomInputValue() {
|
|
448
457
|
hasCustomValue: true
|
449
458
|
}, function (item) {
|
450
459
|
return (0, _react2.jsx)(_index.Item, {
|
451
|
-
key: item.id
|
452
|
-
textValue: item.id
|
460
|
+
key: item.id
|
453
461
|
}, item.name);
|
454
462
|
}));
|
455
463
|
};
|
@@ -23,6 +23,7 @@ var _filter = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-sta
|
|
23
23
|
var _find = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/find"));
|
24
24
|
var _concat = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/concat"));
|
25
25
|
var _forEach = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/for-each"));
|
26
|
+
var _includes = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/includes"));
|
26
27
|
var _map = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/map"));
|
27
28
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/defineProperty"));
|
28
29
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/asyncToGenerator"));
|
@@ -42,8 +43,8 @@ var _react3 = require("@emotion/react");
|
|
42
43
|
function _getRequireWildcardCache(nodeInterop) { if (typeof _WeakMap !== "function") return null; var cacheBabelInterop = new _WeakMap(); var cacheNodeInterop = new _WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
43
44
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = _Object$defineProperty && _Object$getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? _Object$getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { _Object$defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
44
45
|
function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = _filterInstanceProperty2(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
45
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var
|
46
|
-
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 _context6; _forEachInstanceProperty2(_context6 = ["next", "throw", "return"]).call(_context6, function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], _forEachInstanceProperty2(tryLocsList).call(tryLocsList, pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return _Object$setPrototypeOf ? _Object$setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = _Object$create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = _Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return _reverseInstanceProperty(keys).call(keys), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { var _context7; if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, _forEachInstanceProperty2(_context7 = this.tryEntries).call(_context7, 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; }
|
46
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context10, _context11; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty2(_context10 = ownKeys(Object(source), !0)).call(_context10, function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty2(_context11 = ownKeys(Object(source))).call(_context11, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
|
47
|
+
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 _context8; _forEachInstanceProperty2(_context8 = ["next", "throw", "return"]).call(_context8, function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], _forEachInstanceProperty2(tryLocsList).call(tryLocsList, pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return _Object$setPrototypeOf ? _Object$setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = _Object$create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = _Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return _reverseInstanceProperty(keys).call(keys), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { var _context9; if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, _forEachInstanceProperty2(_context9 = this.tryEntries).call(_context9, 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; }
|
47
48
|
var items = [{
|
48
49
|
name: 'Aardvark',
|
49
50
|
id: '1'
|
@@ -333,6 +334,47 @@ test('should be able to open and navigate through the listbox by click', functio
|
|
333
334
|
_userEvent["default"].click(button);
|
334
335
|
expect(options[0]).toHaveClass('is-focused');
|
335
336
|
});
|
337
|
+
test('should be able to hover list item and filter on input box', /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
338
|
+
var button, input, options;
|
339
|
+
return _regeneratorRuntime().wrap(function _callee$(_context3) {
|
340
|
+
while (1) switch (_context3.prev = _context3.next) {
|
341
|
+
case 0:
|
342
|
+
getComponentWithSections({
|
343
|
+
defaultFilter: function defaultFilter(option, inputValue) {
|
344
|
+
var _context2;
|
345
|
+
return (0, _includes["default"])(_context2 = option.name.toLowerCase()).call(_context2, inputValue.toLowerCase());
|
346
|
+
}
|
347
|
+
});
|
348
|
+
button = _testWrapper.screen.queryByRole('button');
|
349
|
+
input = _testWrapper.screen.queryByRole('combobox');
|
350
|
+
expect(_testWrapper.screen.queryByRole('combobox')).toHaveValue('');
|
351
|
+
expect(_testWrapper.screen.queryByRole('listbox')).not.toBeInTheDocument();
|
352
|
+
|
353
|
+
// Open the list by clicking on the button and ensure first option is not active
|
354
|
+
_userEvent["default"].click(button);
|
355
|
+
options = _testWrapper.screen.queryAllByRole('option');
|
356
|
+
expect(_testWrapper.screen.queryByRole('listbox')).toBeInTheDocument();
|
357
|
+
// Both dismiss buttons should be available, but the dropdown button should be inaccessible
|
358
|
+
expect(_testWrapper.screen.queryAllByRole('button')).toHaveLength(2);
|
359
|
+
expect(options).toHaveLength(9);
|
360
|
+
expect(input).not.toHaveAttribute('aria-activedescendant', options[0].id);
|
361
|
+
(0, _forEach["default"])(options).call(options, function (opt) {
|
362
|
+
return expect(opt).not.toHaveClass('is-focused');
|
363
|
+
});
|
364
|
+
|
365
|
+
// Ensure active styles are applied
|
366
|
+
_userEvent["default"].hover(options[0]);
|
367
|
+
expect(input).toHaveAttribute('aria-activedescendant', options[0].id);
|
368
|
+
expect(options[0]).toHaveClass('is-focused');
|
369
|
+
_userEvent["default"].type(input, 'k');
|
370
|
+
expect(_testWrapper.screen.queryByRole('listbox')).toBeInTheDocument();
|
371
|
+
expect(input).toHaveValue('k');
|
372
|
+
case 18:
|
373
|
+
case "end":
|
374
|
+
return _context3.stop();
|
375
|
+
}
|
376
|
+
}, _callee);
|
377
|
+
})));
|
336
378
|
test('should be able to open the listbox by keyboard', function () {
|
337
379
|
getComponent();
|
338
380
|
var input = _testWrapper.screen.getByRole('combobox');
|
@@ -521,37 +563,37 @@ test('should use default contains filtering', function () {
|
|
521
563
|
_userEvent["default"].type(input, 'z');
|
522
564
|
expect(_testWrapper.screen.queryByRole('option')).not.toBeInTheDocument();
|
523
565
|
});
|
524
|
-
test('should be able to use controlled filtering', /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regeneratorRuntime().mark(function
|
566
|
+
test('should be able to use controlled filtering', /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
525
567
|
var options, input;
|
526
|
-
return _regeneratorRuntime().wrap(function
|
527
|
-
while (1) switch (
|
568
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context4) {
|
569
|
+
while (1) switch (_context4.prev = _context4.next) {
|
528
570
|
case 0:
|
529
571
|
(0, _testWrapper.render)((0, _react3.jsx)(ComboBoxWithCustomFilter, null));
|
530
572
|
input = _testWrapper.screen.queryByRole('combobox'); // Should list all without filterable input
|
531
573
|
_userEvent["default"].type(input, '{arrowdown}');
|
532
|
-
|
574
|
+
_context4.next = 5;
|
533
575
|
return _testWrapper.screen.findAllByRole('option');
|
534
576
|
case 5:
|
535
|
-
options =
|
577
|
+
options = _context4.sent;
|
536
578
|
expect(options).toHaveLength(items.length);
|
537
579
|
|
538
580
|
// Should only list the second option
|
539
581
|
_userEvent["default"].type(input, 'k');
|
540
|
-
|
582
|
+
_context4.next = 10;
|
541
583
|
return _testWrapper.screen.findAllByRole('option');
|
542
584
|
case 10:
|
543
|
-
options =
|
585
|
+
options = _context4.sent;
|
544
586
|
expect(options[0]).toHaveTextContent(items[1].name);
|
545
587
|
case 12:
|
546
588
|
case "end":
|
547
|
-
return
|
589
|
+
return _context4.stop();
|
548
590
|
}
|
549
|
-
},
|
591
|
+
}, _callee2);
|
550
592
|
})));
|
551
|
-
test('should be able to use custom default filtering', /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regeneratorRuntime().mark(function
|
593
|
+
test('should be able to use custom default filtering', /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
552
594
|
var options, defaultFilter, input;
|
553
|
-
return _regeneratorRuntime().wrap(function
|
554
|
-
while (1) switch (
|
595
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context5) {
|
596
|
+
while (1) switch (_context5.prev = _context5.next) {
|
555
597
|
case 0:
|
556
598
|
defaultFilter = function defaultFilter(option, inputValue) {
|
557
599
|
return (0, _startsWith["default"])(option).call(option, inputValue);
|
@@ -561,29 +603,29 @@ test('should be able to use custom default filtering', /*#__PURE__*/(0, _asyncTo
|
|
561
603
|
});
|
562
604
|
input = _testWrapper.screen.queryByRole('combobox'); // Should list all without filterable input
|
563
605
|
_userEvent["default"].type(input, '{arrowdown}');
|
564
|
-
|
606
|
+
_context5.next = 6;
|
565
607
|
return _testWrapper.screen.findAllByRole('option');
|
566
608
|
case 6:
|
567
|
-
options =
|
609
|
+
options = _context5.sent;
|
568
610
|
expect(options).toHaveLength(items.length);
|
569
611
|
|
570
612
|
// Should only list the second option
|
571
613
|
_userEvent["default"].type(input, 'K');
|
572
|
-
|
614
|
+
_context5.next = 11;
|
573
615
|
return _testWrapper.screen.findAllByRole('option');
|
574
616
|
case 11:
|
575
|
-
options =
|
617
|
+
options = _context5.sent;
|
576
618
|
expect(options[0]).toHaveTextContent(items[1].name);
|
577
619
|
case 13:
|
578
620
|
case "end":
|
579
|
-
return
|
621
|
+
return _context5.stop();
|
580
622
|
}
|
581
|
-
},
|
623
|
+
}, _callee3);
|
582
624
|
})));
|
583
|
-
test('should show in input "textValue" if provided', /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regeneratorRuntime().mark(function
|
625
|
+
test('should show in input "textValue" if provided', /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
584
626
|
var newItems, input, options;
|
585
|
-
return _regeneratorRuntime().wrap(function
|
586
|
-
while (1) switch (
|
627
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context6) {
|
628
|
+
while (1) switch (_context6.prev = _context6.next) {
|
587
629
|
case 0:
|
588
630
|
newItems = (0, _map["default"])(items).call(items, function (item) {
|
589
631
|
return _objectSpread(_objectSpread({}, item), {}, {
|
@@ -595,10 +637,10 @@ test('should show in input "textValue" if provided', /*#__PURE__*/(0, _asyncToGe
|
|
595
637
|
});
|
596
638
|
input = _testWrapper.screen.queryByRole('combobox');
|
597
639
|
_userEvent["default"].click(input);
|
598
|
-
|
640
|
+
_context6.next = 6;
|
599
641
|
return _testWrapper.screen.findAllByRole('option');
|
600
642
|
case 6:
|
601
|
-
options =
|
643
|
+
options = _context6.sent;
|
602
644
|
_userEvent["default"].click(options[0]);
|
603
645
|
expect(input).toHaveValue(newItems[0].textValue);
|
604
646
|
|
@@ -607,14 +649,14 @@ test('should show in input "textValue" if provided', /*#__PURE__*/(0, _asyncToGe
|
|
607
649
|
expect(input).toHaveValue(newItems[0].textValue);
|
608
650
|
case 11:
|
609
651
|
case "end":
|
610
|
-
return
|
652
|
+
return _context6.stop();
|
611
653
|
}
|
612
|
-
},
|
654
|
+
}, _callee4);
|
613
655
|
})));
|
614
|
-
test('option list should be opened on scroll input value', /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regeneratorRuntime().mark(function
|
656
|
+
test('option list should be opened on scroll input value', /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
615
657
|
var options, otherItems, input;
|
616
|
-
return _regeneratorRuntime().wrap(function
|
617
|
-
while (1) switch (
|
658
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context7) {
|
659
|
+
while (1) switch (_context7.prev = _context7.next) {
|
618
660
|
case 0:
|
619
661
|
otherItems = [{
|
620
662
|
name: 'Short item name one',
|
@@ -654,9 +696,9 @@ test('option list should be opened on scroll input value', /*#__PURE__*/(0, _asy
|
|
654
696
|
expect(options.length).toBe(0);
|
655
697
|
case 14:
|
656
698
|
case "end":
|
657
|
-
return
|
699
|
+
return _context7.stop();
|
658
700
|
}
|
659
|
-
},
|
701
|
+
}, _callee5);
|
660
702
|
})));
|
661
703
|
describe('loadingState', function () {
|
662
704
|
it('combobox should not render a loader if menu is not open', function () {
|
@@ -95,31 +95,40 @@ var withSection = [{
|
|
95
95
|
name: 'Animals',
|
96
96
|
key: 'Animals',
|
97
97
|
children: [{
|
98
|
-
name: 'Raccoon'
|
98
|
+
name: 'Raccoon',
|
99
|
+
key: 'raccoon'
|
99
100
|
}, {
|
100
|
-
name: 'Kangaroo'
|
101
|
+
name: 'Kangaroo',
|
102
|
+
key: 'kangaroo'
|
101
103
|
}, {
|
102
|
-
name: 'Opossum'
|
104
|
+
name: 'Opossum',
|
105
|
+
key: 'opossum'
|
103
106
|
}]
|
104
107
|
}, {
|
105
108
|
name: 'People',
|
106
109
|
key: 'People',
|
107
110
|
children: [{
|
108
|
-
name: 'Michael'
|
111
|
+
name: 'Michael',
|
112
|
+
key: 'michael'
|
109
113
|
}, {
|
110
|
-
name: 'Dwight'
|
114
|
+
name: 'Dwight',
|
115
|
+
key: 'dwight'
|
111
116
|
}, {
|
112
|
-
name: 'Creed'
|
117
|
+
name: 'Creed',
|
118
|
+
key: 'creed'
|
113
119
|
}]
|
114
120
|
}, {
|
115
|
-
name:
|
121
|
+
name: 'Fruits',
|
116
122
|
key: 'fruit',
|
117
123
|
children: [{
|
118
|
-
name: 'Apple'
|
124
|
+
name: 'Apple',
|
125
|
+
key: 'apple'
|
119
126
|
}, {
|
120
|
-
name: 'Orange'
|
127
|
+
name: 'Orange',
|
128
|
+
key: 'orange'
|
121
129
|
}, {
|
122
|
-
name: 'Banana'
|
130
|
+
name: 'Banana',
|
131
|
+
key: 'banana'
|
123
132
|
}]
|
124
133
|
}];
|
125
134
|
var actions = {
|
@@ -207,17 +216,17 @@ export var Default = function Default(args) {
|
|
207
216
|
}));
|
208
217
|
};
|
209
218
|
export var WithSections = function WithSections(args) {
|
210
|
-
return ___EmotionJSX(OverlayProvider, null, ___EmotionJSX(ComboBoxField, _extends({
|
219
|
+
return ___EmotionJSX(OverlayProvider, null, ___EmotionJSX(ComboBoxField, _extends({}, args, {
|
211
220
|
label: "Example label",
|
212
|
-
|
213
|
-
}
|
221
|
+
defaultItems: withSection
|
222
|
+
}), function (section) {
|
214
223
|
return ___EmotionJSX(Section, {
|
215
224
|
key: section.key,
|
216
225
|
items: section.children,
|
217
226
|
title: section.name
|
218
227
|
}, function (item) {
|
219
228
|
return ___EmotionJSX(Item, {
|
220
|
-
key: item.
|
229
|
+
key: item.key
|
221
230
|
}, item.name);
|
222
231
|
});
|
223
232
|
}));
|
@@ -427,8 +436,7 @@ export var WithCustomInputValue = function WithCustomInputValue() {
|
|
427
436
|
hasCustomValue: true
|
428
437
|
}, function (item) {
|
429
438
|
return ___EmotionJSX(Item, {
|
430
|
-
key: item.id
|
431
|
-
textValue: item.id
|
439
|
+
key: item.id
|
432
440
|
}, item.name);
|
433
441
|
}));
|
434
442
|
};
|
@@ -17,13 +17,14 @@ import _asyncToGenerator from "@babel/runtime-corejs3/helpers/esm/asyncToGenerat
|
|
17
17
|
import _slicedToArray from "@babel/runtime-corejs3/helpers/esm/slicedToArray";
|
18
18
|
import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
|
19
19
|
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; }
|
20
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var
|
21
|
-
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 _context6; _forEachInstanceProperty(_context6 = ["next", "throw", "return"]).call(_context6, 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 _context7; 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(_context7 = this.tryEntries).call(_context7, 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 _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context10, _context11; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context10 = ownKeys(Object(source), !0)).call(_context10, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context11 = ownKeys(Object(source))).call(_context11, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
|
21
|
+
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 _context8; _forEachInstanceProperty(_context8 = ["next", "throw", "return"]).call(_context8, 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 _context9; 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(_context9 = this.tryEntries).call(_context9, 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; }
|
22
22
|
import _startsWithInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/starts-with";
|
23
23
|
import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
|
24
24
|
import _findInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/find";
|
25
25
|
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
|
26
26
|
import _forEachInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/for-each";
|
27
|
+
import _includesInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/includes";
|
27
28
|
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
|
28
29
|
import React, { useState } from 'react';
|
29
30
|
import { useFilter } from '@react-aria/i18n';
|
@@ -325,6 +326,47 @@ test('should be able to open and navigate through the listbox by click', functio
|
|
325
326
|
userEvent.click(button);
|
326
327
|
expect(options[0]).toHaveClass('is-focused');
|
327
328
|
});
|
329
|
+
test('should be able to hover list item and filter on input box', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
330
|
+
var button, input, options;
|
331
|
+
return _regeneratorRuntime().wrap(function _callee$(_context3) {
|
332
|
+
while (1) switch (_context3.prev = _context3.next) {
|
333
|
+
case 0:
|
334
|
+
getComponentWithSections({
|
335
|
+
defaultFilter: function defaultFilter(option, inputValue) {
|
336
|
+
var _context2;
|
337
|
+
return _includesInstanceProperty(_context2 = option.name.toLowerCase()).call(_context2, inputValue.toLowerCase());
|
338
|
+
}
|
339
|
+
});
|
340
|
+
button = screen.queryByRole('button');
|
341
|
+
input = screen.queryByRole('combobox');
|
342
|
+
expect(screen.queryByRole('combobox')).toHaveValue('');
|
343
|
+
expect(screen.queryByRole('listbox')).not.toBeInTheDocument();
|
344
|
+
|
345
|
+
// Open the list by clicking on the button and ensure first option is not active
|
346
|
+
userEvent.click(button);
|
347
|
+
options = screen.queryAllByRole('option');
|
348
|
+
expect(screen.queryByRole('listbox')).toBeInTheDocument();
|
349
|
+
// Both dismiss buttons should be available, but the dropdown button should be inaccessible
|
350
|
+
expect(screen.queryAllByRole('button')).toHaveLength(2);
|
351
|
+
expect(options).toHaveLength(9);
|
352
|
+
expect(input).not.toHaveAttribute('aria-activedescendant', options[0].id);
|
353
|
+
_forEachInstanceProperty(options).call(options, function (opt) {
|
354
|
+
return expect(opt).not.toHaveClass('is-focused');
|
355
|
+
});
|
356
|
+
|
357
|
+
// Ensure active styles are applied
|
358
|
+
userEvent.hover(options[0]);
|
359
|
+
expect(input).toHaveAttribute('aria-activedescendant', options[0].id);
|
360
|
+
expect(options[0]).toHaveClass('is-focused');
|
361
|
+
userEvent.type(input, 'k');
|
362
|
+
expect(screen.queryByRole('listbox')).toBeInTheDocument();
|
363
|
+
expect(input).toHaveValue('k');
|
364
|
+
case 18:
|
365
|
+
case "end":
|
366
|
+
return _context3.stop();
|
367
|
+
}
|
368
|
+
}, _callee);
|
369
|
+
})));
|
328
370
|
test('should be able to open the listbox by keyboard', function () {
|
329
371
|
getComponent();
|
330
372
|
var input = screen.getByRole('combobox');
|
@@ -513,37 +555,37 @@ test('should use default contains filtering', function () {
|
|
513
555
|
userEvent.type(input, 'z');
|
514
556
|
expect(screen.queryByRole('option')).not.toBeInTheDocument();
|
515
557
|
});
|
516
|
-
test('should be able to use controlled filtering', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
558
|
+
test('should be able to use controlled filtering', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
517
559
|
var options, input;
|
518
|
-
return _regeneratorRuntime().wrap(function
|
519
|
-
while (1) switch (
|
560
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context4) {
|
561
|
+
while (1) switch (_context4.prev = _context4.next) {
|
520
562
|
case 0:
|
521
563
|
render(___EmotionJSX(ComboBoxWithCustomFilter, null));
|
522
564
|
input = screen.queryByRole('combobox'); // Should list all without filterable input
|
523
565
|
userEvent.type(input, '{arrowdown}');
|
524
|
-
|
566
|
+
_context4.next = 5;
|
525
567
|
return screen.findAllByRole('option');
|
526
568
|
case 5:
|
527
|
-
options =
|
569
|
+
options = _context4.sent;
|
528
570
|
expect(options).toHaveLength(items.length);
|
529
571
|
|
530
572
|
// Should only list the second option
|
531
573
|
userEvent.type(input, 'k');
|
532
|
-
|
574
|
+
_context4.next = 10;
|
533
575
|
return screen.findAllByRole('option');
|
534
576
|
case 10:
|
535
|
-
options =
|
577
|
+
options = _context4.sent;
|
536
578
|
expect(options[0]).toHaveTextContent(items[1].name);
|
537
579
|
case 12:
|
538
580
|
case "end":
|
539
|
-
return
|
581
|
+
return _context4.stop();
|
540
582
|
}
|
541
|
-
},
|
583
|
+
}, _callee2);
|
542
584
|
})));
|
543
|
-
test('should be able to use custom default filtering', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
585
|
+
test('should be able to use custom default filtering', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
544
586
|
var options, defaultFilter, input;
|
545
|
-
return _regeneratorRuntime().wrap(function
|
546
|
-
while (1) switch (
|
587
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context5) {
|
588
|
+
while (1) switch (_context5.prev = _context5.next) {
|
547
589
|
case 0:
|
548
590
|
defaultFilter = function defaultFilter(option, inputValue) {
|
549
591
|
return _startsWithInstanceProperty(option).call(option, inputValue);
|
@@ -553,29 +595,29 @@ test('should be able to use custom default filtering', /*#__PURE__*/_asyncToGene
|
|
553
595
|
});
|
554
596
|
input = screen.queryByRole('combobox'); // Should list all without filterable input
|
555
597
|
userEvent.type(input, '{arrowdown}');
|
556
|
-
|
598
|
+
_context5.next = 6;
|
557
599
|
return screen.findAllByRole('option');
|
558
600
|
case 6:
|
559
|
-
options =
|
601
|
+
options = _context5.sent;
|
560
602
|
expect(options).toHaveLength(items.length);
|
561
603
|
|
562
604
|
// Should only list the second option
|
563
605
|
userEvent.type(input, 'K');
|
564
|
-
|
606
|
+
_context5.next = 11;
|
565
607
|
return screen.findAllByRole('option');
|
566
608
|
case 11:
|
567
|
-
options =
|
609
|
+
options = _context5.sent;
|
568
610
|
expect(options[0]).toHaveTextContent(items[1].name);
|
569
611
|
case 13:
|
570
612
|
case "end":
|
571
|
-
return
|
613
|
+
return _context5.stop();
|
572
614
|
}
|
573
|
-
},
|
615
|
+
}, _callee3);
|
574
616
|
})));
|
575
|
-
test('should show in input "textValue" if provided', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
617
|
+
test('should show in input "textValue" if provided', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
576
618
|
var newItems, input, options;
|
577
|
-
return _regeneratorRuntime().wrap(function
|
578
|
-
while (1) switch (
|
619
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context6) {
|
620
|
+
while (1) switch (_context6.prev = _context6.next) {
|
579
621
|
case 0:
|
580
622
|
newItems = _mapInstanceProperty(items).call(items, function (item) {
|
581
623
|
return _objectSpread(_objectSpread({}, item), {}, {
|
@@ -587,10 +629,10 @@ test('should show in input "textValue" if provided', /*#__PURE__*/_asyncToGenera
|
|
587
629
|
});
|
588
630
|
input = screen.queryByRole('combobox');
|
589
631
|
userEvent.click(input);
|
590
|
-
|
632
|
+
_context6.next = 6;
|
591
633
|
return screen.findAllByRole('option');
|
592
634
|
case 6:
|
593
|
-
options =
|
635
|
+
options = _context6.sent;
|
594
636
|
userEvent.click(options[0]);
|
595
637
|
expect(input).toHaveValue(newItems[0].textValue);
|
596
638
|
|
@@ -599,14 +641,14 @@ test('should show in input "textValue" if provided', /*#__PURE__*/_asyncToGenera
|
|
599
641
|
expect(input).toHaveValue(newItems[0].textValue);
|
600
642
|
case 11:
|
601
643
|
case "end":
|
602
|
-
return
|
644
|
+
return _context6.stop();
|
603
645
|
}
|
604
|
-
},
|
646
|
+
}, _callee4);
|
605
647
|
})));
|
606
|
-
test('option list should be opened on scroll input value', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
648
|
+
test('option list should be opened on scroll input value', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
607
649
|
var options, otherItems, input;
|
608
|
-
return _regeneratorRuntime().wrap(function
|
609
|
-
while (1) switch (
|
650
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context7) {
|
651
|
+
while (1) switch (_context7.prev = _context7.next) {
|
610
652
|
case 0:
|
611
653
|
otherItems = [{
|
612
654
|
name: 'Short item name one',
|
@@ -646,9 +688,9 @@ test('option list should be opened on scroll input value', /*#__PURE__*/_asyncTo
|
|
646
688
|
expect(options.length).toBe(0);
|
647
689
|
case 14:
|
648
690
|
case "end":
|
649
|
-
return
|
691
|
+
return _context7.stop();
|
650
692
|
}
|
651
|
-
},
|
693
|
+
}, _callee5);
|
652
694
|
})));
|
653
695
|
describe('loadingState', function () {
|
654
696
|
it('combobox should not render a loader if menu is not open', function () {
|