@pingux/astro 2.104.0 → 2.105.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/components/CheckboxField/CheckboxField.test.js +9 -0
- package/lib/cjs/components/CodeView/CodeView.js +4 -4
- package/lib/cjs/components/CodeView/CodeView.test.js +2 -2
- package/lib/cjs/components/ColorField/ColorField.test.js +10 -1
- package/lib/cjs/components/ComboBoxField/ComboBoxField.test.js +12 -0
- package/lib/cjs/components/DatePicker/DatePicker.test.js +17 -1
- package/lib/cjs/components/FileInputField/FileInputField.test.js +9 -0
- package/lib/cjs/components/ImageUploadField/ImageUploadField.test.js +9 -0
- package/lib/cjs/components/LinkSelectField/LinkSelectField.test.js +13 -0
- package/lib/cjs/components/MultivaluesField/MultivaluesField.test.js +14 -0
- package/lib/cjs/components/NavigationHeader/NavigationHeader.stories.js +1 -1
- package/lib/cjs/components/NumberField/NumberField.test.js +9 -0
- package/lib/cjs/components/PasswordField/PasswordField.test.js +16 -7
- package/lib/cjs/components/RadioGroupField/RadioGroupField.test.js +15 -0
- package/lib/cjs/components/SearchField/SearchField.test.js +9 -0
- package/lib/cjs/components/SelectField/SelectField.test.js +13 -0
- package/lib/cjs/components/SelectFieldBase/SelectFieldBase.js +3 -2
- package/lib/cjs/components/SwitchField/SwitchField.js +4 -2
- package/lib/cjs/components/SwitchField/SwitchField.test.js +9 -0
- package/lib/cjs/components/TextAreaField/TextAreaField.test.js +9 -0
- package/lib/cjs/components/TextField/TextField.test.js +9 -0
- package/lib/cjs/hooks/useGetTheme/useGetTheme.d.ts +6 -6
- package/lib/cjs/hooks/useGetTheme/useGetTheme.js +9 -9
- package/lib/cjs/hooks/useGetTheme/useGetTheme.test.js +3 -3
- package/lib/cjs/index.d.ts +2 -0
- package/lib/cjs/index.js +14 -0
- package/lib/cjs/recipes/NextGen/ListViewNextGen.stories.js +1 -1
- package/lib/cjs/recipes/NextGen/ModalNextGen.stories.js +1 -1
- package/lib/cjs/recipes/NextGen/NavBarNextGen.stories.js +1 -1
- package/lib/cjs/recipes/NextGen/NextGenDataTable.stories.js +1 -1
- package/lib/cjs/styles/themeOverrides/nextGenDarkMode/stories/NextGenDarkDataTable.chomatic.stories.js +1 -1
- package/lib/cjs/styles/themeOverrides/nextGenDarkMode/stories/NextGenDarkListView.chromatic.stories.js +1 -1
- package/lib/cjs/styles/themeOverrides/nextGenDarkMode/stories/NextGenDarkNavStory.chomatic.stories.js +1 -1
- package/lib/cjs/styles/themeOverrides/nextGenDarkMode/stories/NextGenDarkStickerSheet.chromatic.stories.js +1 -1
- package/lib/cjs/styles/themeOverrides/nextGenDarkMode/variants/forms.js +1 -1
- package/lib/cjs/styles/themeOverrides/nextGenDarkMode/variants/navbar.js +1 -1
- package/lib/cjs/styles/themes/next-gen/next-gen.d.ts +70 -0
- package/lib/cjs/styles/themes/next-gen/stories/DataTableNextGenComponent.js +1 -1
- package/lib/cjs/styles/themes/next-gen/stories/NextGenDataTable.chromatic.stories.js +1 -1
- package/lib/cjs/styles/themes/next-gen/stories/NextGenListView.chromatic.stories.js +1 -1
- package/lib/cjs/styles/themes/next-gen/stories/NextGenListViewItem.stories.d.ts +0 -1
- package/lib/cjs/styles/themes/next-gen/stories/NextGenListViewItem.stories.js +1 -2
- package/lib/cjs/styles/themes/next-gen/stories/NextGenNavBar.chromatic.stories.js +1 -1
- package/lib/cjs/styles/themes/next-gen/stories/NextGenStickerSheet.chromatic.stories.js +1 -1
- package/lib/cjs/styles/themes/next-gen/stories/StickerSheetComponent.js +1 -1
- package/lib/cjs/styles/themes/next-gen/variants/button.d.ts +52 -0
- package/lib/cjs/styles/themes/next-gen/variants/button.js +27 -25
- package/lib/cjs/styles/themes/next-gen/variants/links.d.ts +18 -0
- package/lib/cjs/styles/themes/next-gen/variants/links.js +2 -0
- package/lib/cjs/types/codeView.d.ts +1 -1
- package/lib/cjs/types/selectField.d.ts +1 -0
- package/lib/cjs/utils/devUtils/shouldReturnComingSoon.js +4 -1
- package/lib/cjs/utils/testUtils/universalFormSubmitTest.d.ts +6 -0
- package/lib/cjs/utils/testUtils/universalFormSubmitTest.js +370 -0
- package/lib/components/CheckboxField/CheckboxField.test.js +9 -0
- package/lib/components/CodeView/CodeView.js +4 -4
- package/lib/components/CodeView/CodeView.test.js +2 -2
- package/lib/components/ColorField/ColorField.test.js +10 -1
- package/lib/components/ComboBoxField/ComboBoxField.test.js +12 -0
- package/lib/components/DatePicker/DatePicker.test.js +17 -1
- package/lib/components/FileInputField/FileInputField.test.js +9 -0
- package/lib/components/ImageUploadField/ImageUploadField.test.js +9 -0
- package/lib/components/LinkSelectField/LinkSelectField.test.js +13 -0
- package/lib/components/MultivaluesField/MultivaluesField.test.js +14 -0
- package/lib/components/NavigationHeader/NavigationHeader.stories.js +1 -1
- package/lib/components/NumberField/NumberField.test.js +9 -0
- package/lib/components/PasswordField/PasswordField.test.js +16 -7
- package/lib/components/RadioGroupField/RadioGroupField.test.js +15 -0
- package/lib/components/SearchField/SearchField.test.js +9 -0
- package/lib/components/SelectField/SelectField.test.js +13 -0
- package/lib/components/SelectFieldBase/SelectFieldBase.js +3 -2
- package/lib/components/SwitchField/SwitchField.js +4 -2
- package/lib/components/SwitchField/SwitchField.test.js +9 -0
- package/lib/components/TextAreaField/TextAreaField.test.js +9 -0
- package/lib/components/TextField/TextField.test.js +9 -0
- package/lib/hooks/useGetTheme/useGetTheme.js +9 -9
- package/lib/hooks/useGetTheme/useGetTheme.test.js +3 -3
- package/lib/index.js +2 -0
- package/lib/recipes/NextGen/ListViewNextGen.stories.js +1 -1
- package/lib/recipes/NextGen/ModalNextGen.stories.js +1 -1
- package/lib/recipes/NextGen/NavBarNextGen.stories.js +1 -1
- package/lib/recipes/NextGen/NextGenDataTable.stories.js +1 -1
- package/lib/styles/themeOverrides/nextGenDarkMode/stories/NextGenDarkDataTable.chomatic.stories.js +1 -1
- package/lib/styles/themeOverrides/nextGenDarkMode/stories/NextGenDarkListView.chromatic.stories.js +1 -1
- package/lib/styles/themeOverrides/nextGenDarkMode/stories/NextGenDarkNavStory.chomatic.stories.js +1 -1
- package/lib/styles/themeOverrides/nextGenDarkMode/stories/NextGenDarkStickerSheet.chromatic.stories.js +1 -1
- package/lib/styles/themeOverrides/nextGenDarkMode/variants/forms.js +1 -1
- package/lib/styles/themeOverrides/nextGenDarkMode/variants/navbar.js +1 -1
- package/lib/styles/themes/next-gen/stories/DataTableNextGenComponent.js +1 -1
- package/lib/styles/themes/next-gen/stories/NextGenDataTable.chromatic.stories.js +1 -1
- package/lib/styles/themes/next-gen/stories/NextGenListView.chromatic.stories.js +1 -1
- package/lib/styles/themes/next-gen/stories/NextGenListViewItem.stories.js +1 -2
- package/lib/styles/themes/next-gen/stories/NextGenNavBar.chromatic.stories.js +1 -1
- package/lib/styles/themes/next-gen/stories/NextGenStickerSheet.chromatic.stories.js +1 -1
- package/lib/styles/themes/next-gen/stories/StickerSheetComponent.js +1 -1
- package/lib/styles/themes/next-gen/variants/button.js +27 -25
- package/lib/styles/themes/next-gen/variants/links.js +2 -0
- package/lib/utils/devUtils/shouldReturnComingSoon.js +4 -1
- package/lib/utils/testUtils/universalFormSubmitTest.js +358 -0
- package/package.json +1 -1
@@ -7,6 +7,7 @@ var _userEvent = _interopRequireDefault(require("@testing-library/user-event"));
|
|
7
7
|
var _statuses = _interopRequireDefault(require("../../utils/devUtils/constants/statuses"));
|
8
8
|
var _testWrapper = require("../../utils/testUtils/testWrapper");
|
9
9
|
var _universalComponentTest = require("../../utils/testUtils/universalComponentTest");
|
10
|
+
var _universalFormSubmitTest = require("../../utils/testUtils/universalFormSubmitTest");
|
10
11
|
var _ = _interopRequireDefault(require("."));
|
11
12
|
var _react2 = require("@emotion/react");
|
12
13
|
var testLabel = 'Test Label';
|
@@ -27,6 +28,14 @@ var getComponent = function getComponent() {
|
|
27
28
|
return (0, _react2.jsx)(_["default"], (0, _extends2["default"])({}, defaultProps, props));
|
28
29
|
}
|
29
30
|
});
|
31
|
+
(0, _universalFormSubmitTest.universalFieldComponentTests)({
|
32
|
+
renderComponent: function renderComponent(props) {
|
33
|
+
return (0, _react2.jsx)(_["default"], (0, _extends2["default"])({}, defaultProps, props));
|
34
|
+
},
|
35
|
+
testValue: 'testvalue',
|
36
|
+
testLabel: testLabel,
|
37
|
+
componentType: 'CheckboxField'
|
38
|
+
});
|
30
39
|
test('default checkbox', function () {
|
31
40
|
getComponent();
|
32
41
|
var input = _testWrapper.screen.getByRole('checkbox');
|
@@ -55,13 +55,13 @@ var CodeView = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
55
55
|
isHovered = _useHover.isHovered;
|
56
56
|
var theme = (0, _useGetTheme["default"])();
|
57
57
|
var themeState = theme.themeState;
|
58
|
-
var
|
58
|
+
var isOnyx = themeState.isOnyx;
|
59
59
|
var _useStatusClasses = (0, _hooks.useStatusClasses)(outerClassName, {
|
60
60
|
isFocused: isFocusVisible,
|
61
61
|
isHovered: isHovered,
|
62
62
|
hasLineNumbers: hasLineNumbers,
|
63
63
|
hasNoCopyButton: hasNoCopyButton,
|
64
|
-
|
64
|
+
isOnyx: isOnyx
|
65
65
|
}),
|
66
66
|
classNames = _useStatusClasses.classNames;
|
67
67
|
|
@@ -71,7 +71,7 @@ var CodeView = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
71
71
|
return tokens.length.toString().length * 12;
|
72
72
|
};
|
73
73
|
var code = (children === null || children === void 0 ? void 0 : (0, _trim["default"])(children).call(children)) || '';
|
74
|
-
var codeViewTheme = (stylesProp === null || stylesProp === void 0 ? void 0 : stylesProp.theme) || (
|
74
|
+
var codeViewTheme = (stylesProp === null || stylesProp === void 0 ? void 0 : stylesProp.theme) || (isOnyx ? _codeView["default"].theme : _CodeView["default"].theme);
|
75
75
|
var content = (0, _react2.jsx)(_prismReactRenderer["default"], (0, _extends2["default"])({}, _prismReactRenderer.defaultProps, {
|
76
76
|
theme: codeViewTheme,
|
77
77
|
code: code,
|
@@ -110,7 +110,7 @@ var CodeView = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
110
110
|
});
|
111
111
|
|
112
112
|
/* istanbul ignore next */
|
113
|
-
if (
|
113
|
+
if (isOnyx) {
|
114
114
|
return (0, _react2.jsx)(_.Box, (0, _extends2["default"])({
|
115
115
|
ref: ref,
|
116
116
|
variant: "codeView.wrapper",
|
@@ -202,11 +202,11 @@ test('renders CodeView component with highlighted code', function () {
|
|
202
202
|
expect(codeViewElement).toBeInTheDocument();
|
203
203
|
expect(codeViewElement).toHaveClass("language-".concat(language));
|
204
204
|
});
|
205
|
-
test('
|
205
|
+
test('isOnyx prop renders CodeView component with next-gen theme', function () {
|
206
206
|
var children = ' ';
|
207
207
|
getComponent({
|
208
208
|
children: children,
|
209
|
-
|
209
|
+
isOnyx: true,
|
210
210
|
language: 'json'
|
211
211
|
});
|
212
212
|
var codeViewElement = _testWrapper.screen.getByTestId(testId);
|
@@ -6,12 +6,13 @@ var _react = _interopRequireDefault(require("react"));
|
|
6
6
|
var _userEvent = _interopRequireDefault(require("@testing-library/user-event"));
|
7
7
|
var _testWrapper = require("../../utils/testUtils/testWrapper");
|
8
8
|
var _universalComponentTest = require("../../utils/testUtils/universalComponentTest");
|
9
|
+
var _universalFormSubmitTest = require("../../utils/testUtils/universalFormSubmitTest");
|
9
10
|
var _ColorField = _interopRequireDefault(require("./ColorField"));
|
10
11
|
var _react2 = require("@emotion/react");
|
11
12
|
var testId = 'test-colorField';
|
12
13
|
var testLabel = 'test-colorField-label';
|
13
14
|
var hexLabel = 'hex';
|
14
|
-
var testColor1 = '#
|
15
|
+
var testColor1 = '#FFFFFF';
|
15
16
|
var testColor2 = '#fffff1';
|
16
17
|
var defaultProps = {
|
17
18
|
'data-testid': testId,
|
@@ -29,6 +30,14 @@ var getComponent = function getComponent() {
|
|
29
30
|
return (0, _react2.jsx)(_ColorField["default"], (0, _extends2["default"])({}, defaultProps, props));
|
30
31
|
}
|
31
32
|
});
|
33
|
+
(0, _universalFormSubmitTest.universalFieldComponentTests)({
|
34
|
+
renderComponent: function renderComponent(props) {
|
35
|
+
return (0, _react2.jsx)(_ColorField["default"], (0, _extends2["default"])({}, defaultProps, props));
|
36
|
+
},
|
37
|
+
testValue: testColor1,
|
38
|
+
testLabel: testLabel,
|
39
|
+
componentType: 'ColorField'
|
40
|
+
});
|
32
41
|
test('renders ColorField component', function () {
|
33
42
|
getComponent();
|
34
43
|
var container = _testWrapper.screen.getByLabelText(testLabel);
|
@@ -37,6 +37,7 @@ var _loadingStates = _interopRequireDefault(require("../../utils/devUtils/consta
|
|
37
37
|
var _statuses = _interopRequireDefault(require("../../utils/devUtils/constants/statuses"));
|
38
38
|
var _testWrapper = require("../../utils/testUtils/testWrapper");
|
39
39
|
var _universalComponentTest = require("../../utils/testUtils/universalComponentTest");
|
40
|
+
var _universalFormSubmitTest = require("../../utils/testUtils/universalFormSubmitTest");
|
40
41
|
var _react3 = require("@emotion/react");
|
41
42
|
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); }
|
42
43
|
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; }
|
@@ -1089,4 +1090,15 @@ describe('when isReadOnly is true', function () {
|
|
1089
1090
|
"data-id": "item"
|
1090
1091
|
}, "item.name"));
|
1091
1092
|
}
|
1093
|
+
});
|
1094
|
+
(0, _universalFormSubmitTest.universalFieldComponentTests)({
|
1095
|
+
renderComponent: function renderComponent(props) {
|
1096
|
+
return (0, _react3.jsx)(_index.ComboBoxField, (0, _extends2["default"])({}, defaultProps, props), (0, _react3.jsx)(_index.Item, {
|
1097
|
+
key: "item",
|
1098
|
+
"data-id": "item"
|
1099
|
+
}, "item.name"));
|
1100
|
+
},
|
1101
|
+
testValue: items[0].name,
|
1102
|
+
testLabel: defaultProps.label,
|
1103
|
+
componentType: 'ComboBoxField'
|
1092
1104
|
});
|
@@ -26,12 +26,25 @@ var _index = require("../../index");
|
|
26
26
|
var _statuses = _interopRequireDefault(require("../../utils/devUtils/constants/statuses"));
|
27
27
|
var _testWrapper = require("../../utils/testUtils/testWrapper");
|
28
28
|
var _universalComponentTest = require("../../utils/testUtils/universalComponentTest");
|
29
|
+
var _universalFormSubmitTest = require("../../utils/testUtils/universalFormSubmitTest");
|
29
30
|
var _react2 = require("@emotion/react");
|
30
31
|
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); }
|
31
32
|
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; }
|
32
33
|
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = _Object$defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof _Symbol ? _Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return _Object$defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = _Object$create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = _Object$getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = _Object$create(IteratorPrototype); function defineIteratorMethods(prototype) { var _context10; _forEachInstanceProperty(_context10 = ["next", "throw", "return"]).call(_context10, 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 _context11; 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(_context11 = this.tryEntries).call(_context11, 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; }
|
33
34
|
var hiddenStyling = 'border: 0px; clip-path: inset(50%); height: 1px; margin: 0px -1px -1px 0px; overflow: hidden; padding: 0px; position: absolute; width: 1px; white-space: nowrap;';
|
34
35
|
var unavailableRanges = [['2022-08-01', '2022-08-03'], ['2022-08-15', '2022-08-20']];
|
36
|
+
(0, _universalFormSubmitTest.universalFieldComponentTests)({
|
37
|
+
renderComponent: function renderComponent(props) {
|
38
|
+
return (0, _react2.jsx)(_index.DatePicker, (0, _extends2["default"])({
|
39
|
+
"aria-label": "datePicker-controlled"
|
40
|
+
}, props, {
|
41
|
+
label: "test label"
|
42
|
+
}));
|
43
|
+
},
|
44
|
+
testValue: '2022-08-10',
|
45
|
+
testLabel: 'test label',
|
46
|
+
componentType: 'DatePicker'
|
47
|
+
});
|
35
48
|
var getComponent = function getComponent() {
|
36
49
|
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
37
50
|
var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
|
@@ -70,9 +83,12 @@ beforeEach(function () {
|
|
70
83
|
jest.useFakeTimers();
|
71
84
|
});
|
72
85
|
afterEach(function () {
|
73
|
-
jest.
|
86
|
+
jest.clearAllMocks();
|
74
87
|
window.getSelection = originalGetSelection;
|
75
88
|
});
|
89
|
+
afterAll(function () {
|
90
|
+
jest.restoreAllMocks();
|
91
|
+
});
|
76
92
|
test('renders DatePicker component', function () {
|
77
93
|
var labelText = 'test label';
|
78
94
|
getComponent({
|
@@ -17,6 +17,7 @@ var _react2 = require("@testing-library/react");
|
|
17
17
|
var _userEvent = _interopRequireDefault(require("@testing-library/user-event"));
|
18
18
|
var _statuses = _interopRequireDefault(require("../../utils/devUtils/constants/statuses"));
|
19
19
|
var _universalComponentTest = require("../../utils/testUtils/universalComponentTest");
|
20
|
+
var _universalFormSubmitTest = require("../../utils/testUtils/universalFormSubmitTest");
|
20
21
|
var _FileInputField = _interopRequireDefault(require("./FileInputField"));
|
21
22
|
var _react3 = require("@emotion/react");
|
22
23
|
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; }
|
@@ -67,6 +68,14 @@ var getComponent = function getComponent(props) {
|
|
67
68
|
return (0, _react3.jsx)(_FileInputField["default"], (0, _extends2["default"])({}, defaultProps, props));
|
68
69
|
}
|
69
70
|
});
|
71
|
+
(0, _universalFormSubmitTest.universalFieldComponentTests)({
|
72
|
+
renderComponent: function renderComponent(props) {
|
73
|
+
return (0, _react3.jsx)(_FileInputField["default"], (0, _extends2["default"])({}, defaultProps, props));
|
74
|
+
},
|
75
|
+
testValue: testFile,
|
76
|
+
testLabel: testLabel,
|
77
|
+
componentType: 'FileInputField'
|
78
|
+
});
|
70
79
|
test('should render file input field component by default', function () {
|
71
80
|
getComponent();
|
72
81
|
var fileUploadField = _react2.screen.getByTestId(fileInputFieldTestId);
|
@@ -19,6 +19,7 @@ var _react2 = require("@testing-library/react");
|
|
19
19
|
var _userEvent = _interopRequireDefault(require("@testing-library/user-event"));
|
20
20
|
var _testWrapper = require("../../utils/testUtils/testWrapper");
|
21
21
|
var _universalComponentTest = require("../../utils/testUtils/universalComponentTest");
|
22
|
+
var _universalFormSubmitTest = require("../../utils/testUtils/universalFormSubmitTest");
|
22
23
|
var _ImageUploadField = _interopRequireDefault(require("./ImageUploadField"));
|
23
24
|
var _react3 = require("@emotion/react");
|
24
25
|
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 _context9; _forEachInstanceProperty(_context9 = ["next", "throw", "return"]).call(_context9, 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 _context10; 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(_context10 = this.tryEntries).call(_context10, 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; }
|
@@ -70,6 +71,14 @@ var getComponent = function getComponent() {
|
|
70
71
|
return (0, _react3.jsx)(_ImageUploadField["default"], (0, _extends2["default"])({}, defaultProps, props));
|
71
72
|
}
|
72
73
|
});
|
74
|
+
(0, _universalFormSubmitTest.universalFieldComponentTests)({
|
75
|
+
renderComponent: function renderComponent(props) {
|
76
|
+
return (0, _react3.jsx)(_ImageUploadField["default"], (0, _extends2["default"])({}, defaultProps, props));
|
77
|
+
},
|
78
|
+
testValue: file,
|
79
|
+
testLabel: testLabel,
|
80
|
+
componentType: 'ImageUploadField'
|
81
|
+
});
|
73
82
|
test('should render image upload component by default', function () {
|
74
83
|
getComponent();
|
75
84
|
var imageUploadButton = _testWrapper.screen.getByTestId(testButtonId);
|
@@ -8,6 +8,7 @@ var _index = require("../../index");
|
|
8
8
|
var _statuses = _interopRequireDefault(require("../../utils/devUtils/constants/statuses"));
|
9
9
|
var _testWrapper = require("../../utils/testUtils/testWrapper");
|
10
10
|
var _universalComponentTest = require("../../utils/testUtils/universalComponentTest");
|
11
|
+
var _universalFormSubmitTest = require("../../utils/testUtils/universalFormSubmitTest");
|
11
12
|
var _react2 = require("@emotion/react");
|
12
13
|
var items = [{
|
13
14
|
name: 'a'
|
@@ -185,4 +186,16 @@ test('passing helper text should display it and correct aria attributes on input
|
|
185
186
|
}, item.name);
|
186
187
|
});
|
187
188
|
}
|
189
|
+
});
|
190
|
+
(0, _universalFormSubmitTest.universalFieldComponentTests)({
|
191
|
+
renderComponent: function renderComponent(props) {
|
192
|
+
return (0, _react2.jsx)(_index.LinkSelectField, (0, _extends2["default"])({}, defaultProps, props), function (item) {
|
193
|
+
return (0, _react2.jsx)(_index.Item, {
|
194
|
+
key: item.name
|
195
|
+
}, item.name);
|
196
|
+
});
|
197
|
+
},
|
198
|
+
testValue: items[0].name,
|
199
|
+
testLabel: defaultProps.label,
|
200
|
+
componentType: 'LinkSelectField'
|
188
201
|
});
|
@@ -26,6 +26,7 @@ var _index = require("../../index");
|
|
26
26
|
var _statuses = _interopRequireDefault(require("../../utils/devUtils/constants/statuses"));
|
27
27
|
var _testWrapper = require("../../utils/testUtils/testWrapper");
|
28
28
|
var _universalComponentTest = require("../../utils/testUtils/universalComponentTest");
|
29
|
+
var _universalFormSubmitTest = require("../../utils/testUtils/universalFormSubmitTest");
|
29
30
|
var _react2 = require("@emotion/react");
|
30
31
|
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); }
|
31
32
|
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; }
|
@@ -1131,4 +1132,17 @@ test('escape focus delegate calls correct functions if anything else is pressed'
|
|
1131
1132
|
}, item.name);
|
1132
1133
|
}));
|
1133
1134
|
}
|
1135
|
+
});
|
1136
|
+
(0, _universalFormSubmitTest.universalFieldComponentTests)({
|
1137
|
+
renderComponent: function renderComponent(props) {
|
1138
|
+
return (0, _react2.jsx)(_index.OverlayProvider, null, (0, _react2.jsx)(_index.MultivaluesField, (0, _extends2["default"])({}, defaultProps, props), function (item) {
|
1139
|
+
return (0, _react2.jsx)(_index.Item, {
|
1140
|
+
key: item.key,
|
1141
|
+
"data-id": item.name
|
1142
|
+
}, item.name);
|
1143
|
+
}));
|
1144
|
+
},
|
1145
|
+
testValue: items[0].name,
|
1146
|
+
testLabel: defaultProps.label,
|
1147
|
+
componentType: 'MultivaluesField'
|
1134
1148
|
});
|
@@ -149,7 +149,7 @@ var Default = function Default(_ref) {
|
|
149
149
|
justifyContent: "center",
|
150
150
|
py: "xs",
|
151
151
|
flex: "0 0 auto"
|
152
|
-
}, themeState.
|
152
|
+
}, themeState.isOnyxDark ? whiteLogo : logo, (0, _react2.jsx)(_index.Separator, {
|
153
153
|
orientation: "vertical",
|
154
154
|
sx: placeholderSeparator,
|
155
155
|
style: {
|
@@ -9,6 +9,7 @@ var _index = require("../../index");
|
|
9
9
|
var _statuses = _interopRequireDefault(require("../../utils/devUtils/constants/statuses"));
|
10
10
|
var _testWrapper = require("../../utils/testUtils/testWrapper");
|
11
11
|
var _universalComponentTest = require("../../utils/testUtils/universalComponentTest");
|
12
|
+
var _universalFormSubmitTest = require("../../utils/testUtils/universalFormSubmitTest");
|
12
13
|
var _react3 = require("@emotion/react");
|
13
14
|
var testId = 'test-NumberField';
|
14
15
|
var testLabel = 'test-NumberField-label';
|
@@ -36,6 +37,14 @@ var getComponent = function getComponent() {
|
|
36
37
|
return (0, _react3.jsx)(_index.NumberField, (0, _extends2["default"])({}, defaultProps, props));
|
37
38
|
}
|
38
39
|
});
|
40
|
+
(0, _universalFormSubmitTest.universalFieldComponentTests)({
|
41
|
+
renderComponent: function renderComponent(props) {
|
42
|
+
return (0, _react3.jsx)(_index.NumberField, (0, _extends2["default"])({}, defaultProps, props));
|
43
|
+
},
|
44
|
+
testValue: 5,
|
45
|
+
testLabel: testLabel,
|
46
|
+
componentType: 'NumberField'
|
47
|
+
});
|
39
48
|
test('renders NumberField component', function () {
|
40
49
|
getComponent();
|
41
50
|
expect(_testWrapper.screen.queryAllByLabelText(testLabel)[0]).toBeInTheDocument();
|
@@ -20,6 +20,7 @@ var _userEvent = _interopRequireDefault(require("@testing-library/user-event"));
|
|
20
20
|
var _statuses = _interopRequireDefault(require("../../utils/devUtils/constants/statuses"));
|
21
21
|
var _testWrapper = require("../../utils/testUtils/testWrapper");
|
22
22
|
var _universalComponentTest = require("../../utils/testUtils/universalComponentTest");
|
23
|
+
var _universalFormSubmitTest = require("../../utils/testUtils/universalFormSubmitTest");
|
23
24
|
var _ = _interopRequireDefault(require("."));
|
24
25
|
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; } // Emotion Cache added as test fails otherwise, root cause of this failure is unknown.
|
25
26
|
// Failure occured with ThemeUI refactor.
|
@@ -70,12 +71,14 @@ var successfulRequirements = [{
|
|
70
71
|
name: '1 special character',
|
71
72
|
status: _statuses["default"].SUCCESS
|
72
73
|
}];
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
74
|
+
(0, _universalFormSubmitTest.universalFieldComponentTests)({
|
75
|
+
renderComponent: function renderComponent(props) {
|
76
|
+
return (0, _react2.jsx)(_["default"], (0, _extends2["default"])({}, defaultProps, props));
|
77
|
+
},
|
78
|
+
testValue: 'testvalue',
|
79
|
+
testLabel: testLabel,
|
80
|
+
componentType: 'PasswordField'
|
81
|
+
});
|
79
82
|
|
80
83
|
// Needs to be added to each components test file
|
81
84
|
(0, _universalComponentTest.universalComponentTests)({
|
@@ -83,8 +86,14 @@ var getComponent = function getComponent() {
|
|
83
86
|
return (0, _react2.jsx)(_["default"], (0, _extends2["default"])({}, defaultProps, props));
|
84
87
|
}
|
85
88
|
});
|
89
|
+
var getComponent = function getComponent() {
|
90
|
+
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
91
|
+
return (0, _testWrapper.render)((0, _react2.jsx)(_react2.CacheProvider, {
|
92
|
+
value: emotionCache
|
93
|
+
}, (0, _react2.jsx)(_["default"], (0, _extends2["default"])({}, defaultProps, props))));
|
94
|
+
};
|
86
95
|
afterEach(function () {
|
87
|
-
jest.
|
96
|
+
jest.clearAllMocks();
|
88
97
|
});
|
89
98
|
test('default password field', function () {
|
90
99
|
getComponent();
|
@@ -20,6 +20,7 @@ var _orientation = _interopRequireDefault(require("../../utils/devUtils/constant
|
|
20
20
|
var _statuses = _interopRequireDefault(require("../../utils/devUtils/constants/statuses"));
|
21
21
|
var _testWrapper = require("../../utils/testUtils/testWrapper");
|
22
22
|
var _universalComponentTest = require("../../utils/testUtils/universalComponentTest");
|
23
|
+
var _universalFormSubmitTest = require("../../utils/testUtils/universalFormSubmitTest");
|
23
24
|
var _RadioField = _interopRequireDefault(require("../RadioField"));
|
24
25
|
var _ = _interopRequireDefault(require("."));
|
25
26
|
var _react2 = require("@emotion/react");
|
@@ -55,6 +56,20 @@ var getComponent = function getComponent() {
|
|
55
56
|
}));
|
56
57
|
}
|
57
58
|
});
|
59
|
+
(0, _universalFormSubmitTest.universalFieldComponentTests)({
|
60
|
+
renderComponent: function renderComponent(props) {
|
61
|
+
return (0, _react2.jsx)(_["default"], (0, _extends2["default"])({}, defaultProps, props), (0, _react2.jsx)(_RadioField["default"], {
|
62
|
+
value: testValues[0],
|
63
|
+
label: testValues[0]
|
64
|
+
}), (0, _react2.jsx)(_RadioField["default"], {
|
65
|
+
value: testValues[1],
|
66
|
+
label: testValues[1]
|
67
|
+
}));
|
68
|
+
},
|
69
|
+
testValue: testValues[0],
|
70
|
+
testLabel: testLabel,
|
71
|
+
componentType: 'RadioGroupField'
|
72
|
+
});
|
58
73
|
test('default radio group', function () {
|
59
74
|
getComponent();
|
60
75
|
var group = _testWrapper.screen.getByLabelText(testLabel);
|
@@ -6,6 +6,7 @@ var _react = _interopRequireDefault(require("react"));
|
|
6
6
|
var _userEvent = _interopRequireDefault(require("@testing-library/user-event"));
|
7
7
|
var _testWrapper = require("../../utils/testUtils/testWrapper");
|
8
8
|
var _universalComponentTest = require("../../utils/testUtils/universalComponentTest");
|
9
|
+
var _universalFormSubmitTest = require("../../utils/testUtils/universalFormSubmitTest");
|
9
10
|
var _ = _interopRequireDefault(require("."));
|
10
11
|
var _react2 = require("@emotion/react");
|
11
12
|
var testId = 'test-radio-group';
|
@@ -18,6 +19,14 @@ var getComponent = function getComponent() {
|
|
18
19
|
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
19
20
|
return (0, _testWrapper.render)((0, _react2.jsx)(_["default"], (0, _extends2["default"])({}, defaultProps, props)));
|
20
21
|
};
|
22
|
+
(0, _universalFormSubmitTest.universalFieldComponentTests)({
|
23
|
+
renderComponent: function renderComponent(props) {
|
24
|
+
return (0, _react2.jsx)(_["default"], (0, _extends2["default"])({}, defaultProps, props));
|
25
|
+
},
|
26
|
+
testValue: 'testvalue',
|
27
|
+
testLabel: testLabel,
|
28
|
+
componentType: 'SearchField'
|
29
|
+
});
|
21
30
|
|
22
31
|
// Needs to be added to each components test file
|
23
32
|
(0, _universalComponentTest.universalComponentTests)({
|
@@ -9,6 +9,7 @@ var _index = require("../../index");
|
|
9
9
|
var _statuses = _interopRequireDefault(require("../../utils/devUtils/constants/statuses"));
|
10
10
|
var _testWrapper = require("../../utils/testUtils/testWrapper");
|
11
11
|
var _universalComponentTest = require("../../utils/testUtils/universalComponentTest");
|
12
|
+
var _universalFormSubmitTest = require("../../utils/testUtils/universalFormSubmitTest");
|
12
13
|
var _react2 = require("@emotion/react");
|
13
14
|
var items = [{
|
14
15
|
name: 'a'
|
@@ -101,6 +102,18 @@ var getComponentWithSections = function getComponentWithSections() {
|
|
101
102
|
});
|
102
103
|
}
|
103
104
|
});
|
105
|
+
(0, _universalFormSubmitTest.universalFieldComponentTests)({
|
106
|
+
renderComponent: function renderComponent(props) {
|
107
|
+
return (0, _react2.jsx)(_index.SelectField, (0, _extends2["default"])({}, defaultProps, props), function (item) {
|
108
|
+
return (0, _react2.jsx)(_index.Item, {
|
109
|
+
key: item.name
|
110
|
+
}, item.name);
|
111
|
+
});
|
112
|
+
},
|
113
|
+
testValue: items[0].name,
|
114
|
+
testLabel: defaultProps.label,
|
115
|
+
componentType: 'SelectField'
|
116
|
+
});
|
104
117
|
test('default select field', function () {
|
105
118
|
getComponent();
|
106
119
|
var container = _testWrapper.screen.getByTestId(testId);
|
@@ -33,7 +33,7 @@ var _Loader = _interopRequireDefault(require("../Loader"));
|
|
33
33
|
var _Text = _interopRequireDefault(require("../Text"));
|
34
34
|
var _HiddenSelect = require("./HiddenSelect");
|
35
35
|
var _react2 = require("@emotion/react");
|
36
|
-
var _excluded = ["columnStyleProps", "defaultText", "fieldContainerProps", "fieldControlInputProps", "fieldControlWrapperProps", "fieldLabelProps", "helperText", "isLoadingInitial", "label", "labelMode", "name", "overlay", "placeholder", "slots", "state", "status", "trigger", "triggerProps", "triggerRef", "valueProps", "selectProps"];
|
36
|
+
var _excluded = ["columnStyleProps", "defaultText", "fieldContainerProps", "fieldControlInputProps", "fieldControlWrapperProps", "fieldLabelProps", "helperText", "isLoadingInitial", "isDisabled", "label", "labelMode", "name", "overlay", "placeholder", "slots", "state", "status", "trigger", "triggerProps", "triggerRef", "valueProps", "selectProps"];
|
37
37
|
/**
|
38
38
|
* Select field (dropdown) that does not rely on native browser or mobile implementations.
|
39
39
|
*
|
@@ -54,6 +54,7 @@ var SelectFieldBase = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref)
|
|
54
54
|
fieldLabelProps = props.fieldLabelProps,
|
55
55
|
helperText = props.helperText,
|
56
56
|
isLoadingInitial = props.isLoadingInitial,
|
57
|
+
isDisabled = props.isDisabled,
|
57
58
|
label = props.label,
|
58
59
|
labelMode = props.labelMode,
|
59
60
|
name = props.name,
|
@@ -113,7 +114,7 @@ var SelectFieldBase = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref)
|
|
113
114
|
triggerRef: triggerRef,
|
114
115
|
label: label,
|
115
116
|
name: name,
|
116
|
-
isDisabled:
|
117
|
+
isDisabled: isDisabled
|
117
118
|
}, selectProps)), trigger || defaultTrigger, overlay, helperText && (0, _react2.jsx)(_FieldHelperText["default"], {
|
118
119
|
status: status,
|
119
120
|
id: helperTextId
|
@@ -29,7 +29,7 @@ var _hooks = require("../../hooks");
|
|
29
29
|
var _pendoID = require("../../utils/devUtils/constants/pendoID");
|
30
30
|
var _statuses = _interopRequireDefault(require("../../utils/devUtils/constants/statuses"));
|
31
31
|
var _react2 = require("@emotion/react");
|
32
|
-
var _excluded = ["label", "helperText", "isDefaultSelected", "isDisabled", "status", "controlProps"];
|
32
|
+
var _excluded = ["label", "helperText", "isDefaultSelected", "isDisabled", "status", "controlProps", "name"];
|
33
33
|
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); }
|
34
34
|
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; }
|
35
35
|
function ownKeys(object, enumerableOnly) { var keys = _Object$keys2(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; }
|
@@ -43,6 +43,7 @@ var SwitchField = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
43
43
|
isDisabled = props.isDisabled,
|
44
44
|
status = props.status,
|
45
45
|
controlProps = props.controlProps,
|
46
|
+
name = props.name,
|
46
47
|
others = (0, _objectWithoutProperties2["default"])(props, _excluded);
|
47
48
|
(0, _hooks.usePropWarning)(props, 'disabled', 'isDisabled');
|
48
49
|
var switchRef = (0, _hooks.useLocalOrForwardRef)(ref);
|
@@ -80,7 +81,8 @@ var SwitchField = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
80
81
|
variant: "forms.switch.label"
|
81
82
|
}, fieldLabelProps), (0, _react2.jsx)(_.Box, fieldControlWrapperProps, (0, _react2.jsx)(_.Switch, (0, _extends2["default"])({
|
82
83
|
ref: switchRef,
|
83
|
-
inputProps: fieldControlInputProps
|
84
|
+
inputProps: fieldControlInputProps,
|
85
|
+
name: name
|
84
86
|
}, unhandledAriaProps, (0, _omit["default"])(others, 'data-pendo-id', 'aria-label')))), label), helperText && (0, _react2.jsx)(_.FieldHelperText, {
|
85
87
|
status: status
|
86
88
|
}, helperText));
|
@@ -6,6 +6,7 @@ var _react = _interopRequireDefault(require("react"));
|
|
6
6
|
var _userEvent = _interopRequireDefault(require("@testing-library/user-event"));
|
7
7
|
var _testWrapper = require("../../utils/testUtils/testWrapper");
|
8
8
|
var _universalComponentTest = require("../../utils/testUtils/universalComponentTest");
|
9
|
+
var _universalFormSubmitTest = require("../../utils/testUtils/universalFormSubmitTest");
|
9
10
|
var _SwitchField = _interopRequireDefault(require("./SwitchField"));
|
10
11
|
var _react2 = require("@emotion/react");
|
11
12
|
var TEST_LABEL = 'test label';
|
@@ -16,6 +17,14 @@ var getComponent = function getComponent() {
|
|
16
17
|
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
17
18
|
return (0, _testWrapper.render)((0, _react2.jsx)(_SwitchField["default"], (0, _extends2["default"])({}, defaultProps, props)));
|
18
19
|
};
|
20
|
+
(0, _universalFormSubmitTest.universalFieldComponentTests)({
|
21
|
+
renderComponent: function renderComponent(props) {
|
22
|
+
return (0, _react2.jsx)(_SwitchField["default"], (0, _extends2["default"])({}, defaultProps, props));
|
23
|
+
},
|
24
|
+
testValue: 'testvalue',
|
25
|
+
testLabel: defaultProps.label,
|
26
|
+
componentType: 'SwitchField'
|
27
|
+
});
|
19
28
|
|
20
29
|
// Needs to be added to each components test file
|
21
30
|
(0, _universalComponentTest.universalComponentTests)({
|
@@ -11,6 +11,7 @@ var _userEvent = _interopRequireDefault(require("@testing-library/user-event"));
|
|
11
11
|
var _statuses = _interopRequireDefault(require("../../utils/devUtils/constants/statuses"));
|
12
12
|
var _testWrapper = require("../../utils/testUtils/testWrapper");
|
13
13
|
var _universalComponentTest = require("../../utils/testUtils/universalComponentTest");
|
14
|
+
var _universalFormSubmitTest = require("../../utils/testUtils/universalFormSubmitTest");
|
14
15
|
var _ = _interopRequireDefault(require("."));
|
15
16
|
var _react3 = require("@emotion/react");
|
16
17
|
var testId = 'test-textAreaField';
|
@@ -31,6 +32,14 @@ var mockfunction = jest.fn();
|
|
31
32
|
return (0, _react3.jsx)(_["default"], (0, _extends2["default"])({}, defaultProps, props));
|
32
33
|
}
|
33
34
|
});
|
35
|
+
(0, _universalFormSubmitTest.universalFieldComponentTests)({
|
36
|
+
renderComponent: function renderComponent(props) {
|
37
|
+
return (0, _react3.jsx)(_["default"], (0, _extends2["default"])({}, defaultProps, props));
|
38
|
+
},
|
39
|
+
testValue: 'testvalue',
|
40
|
+
testLabel: defaultProps.label,
|
41
|
+
componentType: 'TextAreaField'
|
42
|
+
});
|
34
43
|
test('disabled prop disables input', function () {
|
35
44
|
getComponent({
|
36
45
|
isDisabled: true
|