@pingux/astro 2.37.0-alpha.1 → 2.37.0-alpha.3
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/Calendar/Calendar.js +7 -3
- package/lib/cjs/components/Calendar/Calendar.stories.js +15 -14
- package/lib/cjs/components/ListBox/ListBox.test.js +18 -36
- package/lib/cjs/components/PopoverContainer/PopoverContainer.test.js +9 -4
- package/lib/components/Calendar/Calendar.js +7 -3
- package/lib/components/Calendar/Calendar.stories.js +15 -14
- package/lib/components/ListBox/ListBox.test.js +18 -36
- package/lib/components/PopoverContainer/PopoverContainer.test.js +9 -4
- package/package.json +1 -1
@@ -37,11 +37,12 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
37
37
|
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; }
|
38
38
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context, _context2; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context = ownKeys(Object(source), !0)).call(_context, function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context2 = ownKeys(Object(source))).call(_context2, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
|
39
39
|
var Calendar = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
40
|
-
var
|
40
|
+
var defaultFocusedValue = props.defaultFocusedValue,
|
41
41
|
defaultValue = props.defaultValue,
|
42
|
-
|
42
|
+
hasAutoFocus = props.hasAutoFocus,
|
43
43
|
maxValue = props.maxValue,
|
44
|
-
|
44
|
+
minValue = props.minValue,
|
45
|
+
value = props.value;
|
45
46
|
var _useLocale = (0, _i18n.useLocale)(),
|
46
47
|
locale = _useLocale.locale;
|
47
48
|
var calenderRef = (0, _react.useRef)();
|
@@ -53,6 +54,7 @@ var Calendar = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
53
54
|
var parsedDates = {
|
54
55
|
value: typeof value === 'string' && (0, _date.parseDate)(value) || value,
|
55
56
|
defaultValue: typeof defaultValue === 'string' && (0, _date.parseDate)(defaultValue) || defaultValue,
|
57
|
+
defaultFocusedValue: typeof defaultFocusedValue === 'string' && (0, _date.parseDate)(defaultFocusedValue) || defaultFocusedValue,
|
56
58
|
maxValue: typeof maxValue === 'string' && (0, _date.parseDate)(maxValue) || maxValue,
|
57
59
|
minValue: typeof minValue === 'string' && (0, _date.parseDate)(minValue) || minValue
|
58
60
|
};
|
@@ -179,6 +181,8 @@ var Calendar = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
179
181
|
Calendar.propTypes = {
|
180
182
|
/** Prop to provide a custom default date (uncontrolled) */
|
181
183
|
defaultValue: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].object]),
|
184
|
+
/** Prop to provide a custom default focused date (uncontrolled) */
|
185
|
+
defaultFocusedValue: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].object]),
|
182
186
|
/** Prop to provide a default date (controlled) */
|
183
187
|
value: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].object]),
|
184
188
|
/** custom week days for other calendars */
|
@@ -119,7 +119,8 @@ var _default = {
|
|
119
119
|
isReadOnly: false,
|
120
120
|
isRequired: false,
|
121
121
|
onChange: null,
|
122
|
-
onFocusChange: null
|
122
|
+
onFocusChange: null,
|
123
|
+
defaultFocusedValue: '2023-11-15'
|
123
124
|
}
|
124
125
|
};
|
125
126
|
exports["default"] = _default;
|
@@ -135,11 +136,11 @@ Default.parameters = {
|
|
135
136
|
url: _figmaLinks.FIGMA_LINKS.calendar["default"]
|
136
137
|
}
|
137
138
|
};
|
138
|
-
var DefaultValue = function DefaultValue(
|
139
|
-
return (0, _react2.jsx)(_Calendar["default"],
|
139
|
+
var DefaultValue = function DefaultValue() {
|
140
|
+
return (0, _react2.jsx)(_Calendar["default"], {
|
140
141
|
"aria-label": "calendar-with-default-value",
|
141
142
|
defaultValue: "2022-08-10"
|
142
|
-
})
|
143
|
+
});
|
143
144
|
};
|
144
145
|
exports.DefaultValue = DefaultValue;
|
145
146
|
DefaultValue.parameters = {
|
@@ -161,7 +162,7 @@ Disabled.parameters = {
|
|
161
162
|
url: _figmaLinks.FIGMA_LINKS.calendar.disabled
|
162
163
|
}
|
163
164
|
};
|
164
|
-
var UnavailableDates = function UnavailableDates(
|
165
|
+
var UnavailableDates = function UnavailableDates() {
|
165
166
|
var unavailableRanges = [['2022-07-29', '2022-08-05'], ['2022-08-15', '2022-08-20'], ['2022-08-25', '2022-08-26']];
|
166
167
|
// This function is run against each date in the calendar
|
167
168
|
var isDateUnavailable = function isDateUnavailable(date) {
|
@@ -169,11 +170,11 @@ var UnavailableDates = function UnavailableDates(args) {
|
|
169
170
|
return date.compare((0, _date.parseDate)(interval[0])) >= 0 && date.compare((0, _date.parseDate)(interval[1])) <= 0;
|
170
171
|
});
|
171
172
|
};
|
172
|
-
return (0, _react2.jsx)(_Calendar["default"],
|
173
|
+
return (0, _react2.jsx)(_Calendar["default"], {
|
173
174
|
"aria-label": "calendar-component-unavailable-dates",
|
174
175
|
defaultValue: "2022-08-10",
|
175
176
|
isDateUnavailable: isDateUnavailable
|
176
|
-
})
|
177
|
+
});
|
177
178
|
};
|
178
179
|
exports.UnavailableDates = UnavailableDates;
|
179
180
|
UnavailableDates.parameters = {
|
@@ -182,12 +183,12 @@ UnavailableDates.parameters = {
|
|
182
183
|
url: _figmaLinks.FIGMA_LINKS.calendar.unavailableDates
|
183
184
|
}
|
184
185
|
};
|
185
|
-
var MinimumDate = function MinimumDate(
|
186
|
-
return (0, _react2.jsx)(_Calendar["default"],
|
186
|
+
var MinimumDate = function MinimumDate() {
|
187
|
+
return (0, _react2.jsx)(_Calendar["default"], {
|
187
188
|
"aria-label": "calendar-component-min-date",
|
188
189
|
minValue: "2022-09-10",
|
189
|
-
|
190
|
-
})
|
190
|
+
defaultValue: "2022-09-14"
|
191
|
+
});
|
191
192
|
};
|
192
193
|
exports.MinimumDate = MinimumDate;
|
193
194
|
MinimumDate.parameters = {
|
@@ -196,12 +197,12 @@ MinimumDate.parameters = {
|
|
196
197
|
url: _figmaLinks.FIGMA_LINKS.calendar.minimumDate
|
197
198
|
}
|
198
199
|
};
|
199
|
-
var MaximumDate = function MaximumDate(
|
200
|
-
return (0, _react2.jsx)(_Calendar["default"],
|
200
|
+
var MaximumDate = function MaximumDate() {
|
201
|
+
return (0, _react2.jsx)(_Calendar["default"], {
|
201
202
|
"aria-label": "calendar-component-max-date",
|
202
203
|
maxValue: "2022-10-10",
|
203
204
|
defaultValue: "2022-10-05"
|
204
|
-
})
|
205
|
+
});
|
205
206
|
};
|
206
207
|
exports.MaximumDate = MaximumDate;
|
207
208
|
MaximumDate.parameters = {
|
@@ -1,27 +1,15 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
|
-
var _typeof = require("@babel/runtime-corejs3/helpers/typeof");
|
4
|
-
var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
|
5
|
-
var _Symbol = require("@babel/runtime-corejs3/core-js-stable/symbol");
|
6
|
-
var _Object$create = require("@babel/runtime-corejs3/core-js-stable/object/create");
|
7
|
-
var _Object$getPrototypeOf = require("@babel/runtime-corejs3/core-js-stable/object/get-prototype-of");
|
8
|
-
var _forEachInstanceProperty = require("@babel/runtime-corejs3/core-js-stable/instance/for-each");
|
9
|
-
var _Object$setPrototypeOf = require("@babel/runtime-corejs3/core-js-stable/object/set-prototype-of");
|
10
|
-
var _Promise = require("@babel/runtime-corejs3/core-js-stable/promise");
|
11
|
-
var _reverseInstanceProperty = require("@babel/runtime-corejs3/core-js-stable/instance/reverse");
|
12
|
-
var _sliceInstanceProperty = require("@babel/runtime-corejs3/core-js-stable/instance/slice");
|
13
3
|
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
14
|
-
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/asyncToGenerator"));
|
15
4
|
var _extends2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/extends"));
|
16
5
|
var _react = _interopRequireDefault(require("react"));
|
17
6
|
var _reactStately = require("react-stately");
|
18
7
|
var _list = require("@react-stately/list");
|
19
8
|
var _react2 = require("@testing-library/react");
|
20
9
|
var _userEvent = _interopRequireDefault(require("@testing-library/user-event"));
|
21
|
-
var
|
10
|
+
var _universalComponentTest = require("../../utils/testUtils/universalComponentTest");
|
22
11
|
var _ = _interopRequireDefault(require("."));
|
23
12
|
var _react3 = require("@emotion/react");
|
24
|
-
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 _context2; _forEachInstanceProperty(_context2 = ["next", "throw", "return"]).call(_context2, 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 _context3; 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(_context3 = this.tryEntries).call(_context3, 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; }
|
25
13
|
var testId = 'test-label';
|
26
14
|
var items = [{
|
27
15
|
name: 'a'
|
@@ -52,17 +40,20 @@ var defaultWithSectionsProps = {
|
|
52
40
|
'aria-labelledby': 'label',
|
53
41
|
items: itemsWithSections
|
54
42
|
};
|
55
|
-
var ListBoxWithState = function
|
56
|
-
var state = (0, _list.useListState)(
|
43
|
+
var ListBoxWithState = /*#__PURE__*/_react["default"].forwardRef(function (props, ref) {
|
44
|
+
var state = (0, _list.useListState)({
|
45
|
+
props: props
|
46
|
+
});
|
57
47
|
return (0, _react3.jsx)(_["default"], (0, _extends2["default"])({}, props, {
|
58
|
-
state: state
|
48
|
+
state: state,
|
49
|
+
ref: ref
|
59
50
|
}), function (item) {
|
60
51
|
return (0, _react3.jsx)(_reactStately.Item, {
|
61
52
|
key: item.name,
|
62
|
-
|
53
|
+
childItems: item.options
|
63
54
|
}, item.name);
|
64
55
|
});
|
65
|
-
};
|
56
|
+
});
|
66
57
|
var ListBoxWithSections = function ListBoxWithSections(props) {
|
67
58
|
var state = (0, _list.useListState)(props);
|
68
59
|
return (0, _react3.jsx)(_["default"], (0, _extends2["default"])({}, props, {
|
@@ -123,24 +114,15 @@ test('default listbox', function () {
|
|
123
114
|
var listbox = _react2.screen.getByRole('listbox');
|
124
115
|
expect(listbox).toBeInTheDocument();
|
125
116
|
});
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
case 4:
|
136
|
-
results = _context.sent;
|
137
|
-
expect(results).toHaveNoViolations();
|
138
|
-
case 6:
|
139
|
-
case "end":
|
140
|
-
return _context.stop();
|
141
|
-
}
|
142
|
-
}, _callee);
|
143
|
-
})));
|
117
|
+
|
118
|
+
// Needs to be added to each components test file
|
119
|
+
(0, _universalComponentTest.universalComponentTests)({
|
120
|
+
renderComponent: function renderComponent(props) {
|
121
|
+
return (0, _react3.jsx)(ListBoxWithState, (0, _extends2["default"])({
|
122
|
+
"aria-label": "label"
|
123
|
+
}, props));
|
124
|
+
}
|
125
|
+
});
|
144
126
|
test('renders sections and items within section', function () {
|
145
127
|
getSectionsComponent();
|
146
128
|
var listbox = _react2.screen.getByRole('listbox');
|
@@ -1,10 +1,11 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
4
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/extends"));
|
4
5
|
var _react = _interopRequireDefault(require("react"));
|
5
6
|
var _index = require("../../index");
|
6
|
-
var _testAxe = _interopRequireDefault(require("../../utils/testUtils/testAxe"));
|
7
7
|
var _testWrapper = require("../../utils/testUtils/testWrapper");
|
8
|
+
var _universalComponentTest = require("../../utils/testUtils/universalComponentTest");
|
8
9
|
var _PopoverContainer = _interopRequireDefault(require("./PopoverContainer"));
|
9
10
|
var _react2 = require("@emotion/react");
|
10
11
|
var getComponent = function getComponent() {
|
@@ -17,9 +18,13 @@ var getComponentInOverlayPanel = function getComponentInOverlayPanel() {
|
|
17
18
|
isOpen: true
|
18
19
|
}, (0, _react2.jsx)(_PopoverContainer["default"], props, (0, _react2.jsx)(_index.Box, null, "I am in a popover"))));
|
19
20
|
};
|
20
|
-
|
21
|
-
|
22
|
-
(0,
|
21
|
+
(0, _universalComponentTest.universalComponentTests)({
|
22
|
+
renderComponent: function renderComponent(props) {
|
23
|
+
return (0, _react2.jsx)(_PopoverContainer["default"], (0, _extends2["default"])({
|
24
|
+
isOpen: true
|
25
|
+
}, props), (0, _react2.jsx)(_index.Box, null, "I am in a popover"));
|
26
|
+
}
|
27
|
+
});
|
23
28
|
test('should render a popover with an arrow by default', function () {
|
24
29
|
getComponent({
|
25
30
|
isOpen: true
|
@@ -26,11 +26,12 @@ import { Box, Button, Icon, IconButton, Text } from '../../index';
|
|
26
26
|
import CalendarGrid from './CalendarGrid';
|
27
27
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
28
28
|
var Calendar = /*#__PURE__*/forwardRef(function (props, ref) {
|
29
|
-
var
|
29
|
+
var defaultFocusedValue = props.defaultFocusedValue,
|
30
30
|
defaultValue = props.defaultValue,
|
31
|
-
|
31
|
+
hasAutoFocus = props.hasAutoFocus,
|
32
32
|
maxValue = props.maxValue,
|
33
|
-
|
33
|
+
minValue = props.minValue,
|
34
|
+
value = props.value;
|
34
35
|
var _useLocale = useLocale(),
|
35
36
|
locale = _useLocale.locale;
|
36
37
|
var calenderRef = useRef();
|
@@ -42,6 +43,7 @@ var Calendar = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
42
43
|
var parsedDates = {
|
43
44
|
value: typeof value === 'string' && parseDate(value) || value,
|
44
45
|
defaultValue: typeof defaultValue === 'string' && parseDate(defaultValue) || defaultValue,
|
46
|
+
defaultFocusedValue: typeof defaultFocusedValue === 'string' && parseDate(defaultFocusedValue) || defaultFocusedValue,
|
45
47
|
maxValue: typeof maxValue === 'string' && parseDate(maxValue) || maxValue,
|
46
48
|
minValue: typeof minValue === 'string' && parseDate(minValue) || minValue
|
47
49
|
};
|
@@ -168,6 +170,8 @@ var Calendar = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
168
170
|
Calendar.propTypes = {
|
169
171
|
/** Prop to provide a custom default date (uncontrolled) */
|
170
172
|
defaultValue: PropTypes.oneOfType([PropTypes.string, PropTypes.object]),
|
173
|
+
/** Prop to provide a custom default focused date (uncontrolled) */
|
174
|
+
defaultFocusedValue: PropTypes.oneOfType([PropTypes.string, PropTypes.object]),
|
171
175
|
/** Prop to provide a default date (controlled) */
|
172
176
|
value: PropTypes.oneOfType([PropTypes.string, PropTypes.object]),
|
173
177
|
/** custom week days for other calendars */
|
@@ -108,7 +108,8 @@ export default {
|
|
108
108
|
isReadOnly: false,
|
109
109
|
isRequired: false,
|
110
110
|
onChange: null,
|
111
|
-
onFocusChange: null
|
111
|
+
onFocusChange: null,
|
112
|
+
defaultFocusedValue: '2023-11-15'
|
112
113
|
}
|
113
114
|
};
|
114
115
|
export var Default = function Default(args) {
|
@@ -122,11 +123,11 @@ Default.parameters = {
|
|
122
123
|
url: FIGMA_LINKS.calendar["default"]
|
123
124
|
}
|
124
125
|
};
|
125
|
-
export var DefaultValue = function DefaultValue(
|
126
|
-
return ___EmotionJSX(Calendar,
|
126
|
+
export var DefaultValue = function DefaultValue() {
|
127
|
+
return ___EmotionJSX(Calendar, {
|
127
128
|
"aria-label": "calendar-with-default-value",
|
128
129
|
defaultValue: "2022-08-10"
|
129
|
-
})
|
130
|
+
});
|
130
131
|
};
|
131
132
|
DefaultValue.parameters = {
|
132
133
|
design: {
|
@@ -146,7 +147,7 @@ Disabled.parameters = {
|
|
146
147
|
url: FIGMA_LINKS.calendar.disabled
|
147
148
|
}
|
148
149
|
};
|
149
|
-
export var UnavailableDates = function UnavailableDates(
|
150
|
+
export var UnavailableDates = function UnavailableDates() {
|
150
151
|
var unavailableRanges = [['2022-07-29', '2022-08-05'], ['2022-08-15', '2022-08-20'], ['2022-08-25', '2022-08-26']];
|
151
152
|
// This function is run against each date in the calendar
|
152
153
|
var isDateUnavailable = function isDateUnavailable(date) {
|
@@ -154,11 +155,11 @@ export var UnavailableDates = function UnavailableDates(args) {
|
|
154
155
|
return date.compare(parseDate(interval[0])) >= 0 && date.compare(parseDate(interval[1])) <= 0;
|
155
156
|
});
|
156
157
|
};
|
157
|
-
return ___EmotionJSX(Calendar,
|
158
|
+
return ___EmotionJSX(Calendar, {
|
158
159
|
"aria-label": "calendar-component-unavailable-dates",
|
159
160
|
defaultValue: "2022-08-10",
|
160
161
|
isDateUnavailable: isDateUnavailable
|
161
|
-
})
|
162
|
+
});
|
162
163
|
};
|
163
164
|
UnavailableDates.parameters = {
|
164
165
|
design: {
|
@@ -166,12 +167,12 @@ UnavailableDates.parameters = {
|
|
166
167
|
url: FIGMA_LINKS.calendar.unavailableDates
|
167
168
|
}
|
168
169
|
};
|
169
|
-
export var MinimumDate = function MinimumDate(
|
170
|
-
return ___EmotionJSX(Calendar,
|
170
|
+
export var MinimumDate = function MinimumDate() {
|
171
|
+
return ___EmotionJSX(Calendar, {
|
171
172
|
"aria-label": "calendar-component-min-date",
|
172
173
|
minValue: "2022-09-10",
|
173
|
-
|
174
|
-
})
|
174
|
+
defaultValue: "2022-09-14"
|
175
|
+
});
|
175
176
|
};
|
176
177
|
MinimumDate.parameters = {
|
177
178
|
design: {
|
@@ -179,12 +180,12 @@ MinimumDate.parameters = {
|
|
179
180
|
url: FIGMA_LINKS.calendar.minimumDate
|
180
181
|
}
|
181
182
|
};
|
182
|
-
export var MaximumDate = function MaximumDate(
|
183
|
-
return ___EmotionJSX(Calendar,
|
183
|
+
export var MaximumDate = function MaximumDate() {
|
184
|
+
return ___EmotionJSX(Calendar, {
|
184
185
|
"aria-label": "calendar-component-max-date",
|
185
186
|
maxValue: "2022-10-10",
|
186
187
|
defaultValue: "2022-10-05"
|
187
|
-
})
|
188
|
+
});
|
188
189
|
};
|
189
190
|
MaximumDate.parameters = {
|
190
191
|
design: {
|
@@ -1,22 +1,10 @@
|
|
1
|
-
import _Object$defineProperty from "@babel/runtime-corejs3/core-js-stable/object/define-property";
|
2
|
-
import _Symbol from "@babel/runtime-corejs3/core-js-stable/symbol";
|
3
|
-
import _Object$create from "@babel/runtime-corejs3/core-js-stable/object/create";
|
4
|
-
import _Object$getPrototypeOf from "@babel/runtime-corejs3/core-js-stable/object/get-prototype-of";
|
5
|
-
import _forEachInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/for-each";
|
6
|
-
import _Object$setPrototypeOf from "@babel/runtime-corejs3/core-js-stable/object/set-prototype-of";
|
7
|
-
import _Promise from "@babel/runtime-corejs3/core-js-stable/promise";
|
8
|
-
import _reverseInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/reverse";
|
9
|
-
import _sliceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/slice";
|
10
|
-
import _typeof from "@babel/runtime-corejs3/helpers/esm/typeof";
|
11
|
-
import _asyncToGenerator from "@babel/runtime-corejs3/helpers/esm/asyncToGenerator";
|
12
1
|
import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
|
13
|
-
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 _context2; _forEachInstanceProperty(_context2 = ["next", "throw", "return"]).call(_context2, 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 _context3; 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(_context3 = this.tryEntries).call(_context3, 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; }
|
14
2
|
import React from 'react';
|
15
3
|
import { Item, Section } from 'react-stately';
|
16
4
|
import { useListState } from '@react-stately/list';
|
17
5
|
import { render, screen } from '@testing-library/react';
|
18
6
|
import userEvent from '@testing-library/user-event';
|
19
|
-
import {
|
7
|
+
import { universalComponentTests } from '../../utils/testUtils/universalComponentTest';
|
20
8
|
import ListBox from '.';
|
21
9
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
22
10
|
var testId = 'test-label';
|
@@ -49,17 +37,20 @@ var defaultWithSectionsProps = {
|
|
49
37
|
'aria-labelledby': 'label',
|
50
38
|
items: itemsWithSections
|
51
39
|
};
|
52
|
-
var ListBoxWithState = function
|
53
|
-
var state = useListState(
|
40
|
+
var ListBoxWithState = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
41
|
+
var state = useListState({
|
42
|
+
props: props
|
43
|
+
});
|
54
44
|
return ___EmotionJSX(ListBox, _extends({}, props, {
|
55
|
-
state: state
|
45
|
+
state: state,
|
46
|
+
ref: ref
|
56
47
|
}), function (item) {
|
57
48
|
return ___EmotionJSX(Item, {
|
58
49
|
key: item.name,
|
59
|
-
|
50
|
+
childItems: item.options
|
60
51
|
}, item.name);
|
61
52
|
});
|
62
|
-
};
|
53
|
+
});
|
63
54
|
var ListBoxWithSections = function ListBoxWithSections(props) {
|
64
55
|
var state = useListState(props);
|
65
56
|
return ___EmotionJSX(ListBox, _extends({}, props, {
|
@@ -120,24 +111,15 @@ test('default listbox', function () {
|
|
120
111
|
var listbox = screen.getByRole('listbox');
|
121
112
|
expect(listbox).toBeInTheDocument();
|
122
113
|
});
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
case 4:
|
133
|
-
results = _context.sent;
|
134
|
-
expect(results).toHaveNoViolations();
|
135
|
-
case 6:
|
136
|
-
case "end":
|
137
|
-
return _context.stop();
|
138
|
-
}
|
139
|
-
}, _callee);
|
140
|
-
})));
|
114
|
+
|
115
|
+
// Needs to be added to each components test file
|
116
|
+
universalComponentTests({
|
117
|
+
renderComponent: function renderComponent(props) {
|
118
|
+
return ___EmotionJSX(ListBoxWithState, _extends({
|
119
|
+
"aria-label": "label"
|
120
|
+
}, props));
|
121
|
+
}
|
122
|
+
});
|
141
123
|
test('renders sections and items within section', function () {
|
142
124
|
getSectionsComponent();
|
143
125
|
var listbox = screen.getByRole('listbox');
|
@@ -1,7 +1,8 @@
|
|
1
|
+
import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
|
1
2
|
import React from 'react';
|
2
3
|
import { Box, OverlayPanel } from '../../index';
|
3
|
-
import axeTest from '../../utils/testUtils/testAxe';
|
4
4
|
import { render, screen } from '../../utils/testUtils/testWrapper';
|
5
|
+
import { universalComponentTests } from '../../utils/testUtils/universalComponentTest';
|
5
6
|
import PopoverContainer from './PopoverContainer';
|
6
7
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
7
8
|
var getComponent = function getComponent() {
|
@@ -14,9 +15,13 @@ var getComponentInOverlayPanel = function getComponentInOverlayPanel() {
|
|
14
15
|
isOpen: true
|
15
16
|
}, ___EmotionJSX(PopoverContainer, props, ___EmotionJSX(Box, null, "I am in a popover"))));
|
16
17
|
};
|
17
|
-
|
18
|
-
|
19
|
-
|
18
|
+
universalComponentTests({
|
19
|
+
renderComponent: function renderComponent(props) {
|
20
|
+
return ___EmotionJSX(PopoverContainer, _extends({
|
21
|
+
isOpen: true
|
22
|
+
}, props), ___EmotionJSX(Box, null, "I am in a popover"));
|
23
|
+
}
|
24
|
+
});
|
20
25
|
test('should render a popover with an arrow by default', function () {
|
21
26
|
getComponent({
|
22
27
|
isOpen: true
|