@ukhomeoffice/cop-react-form-renderer 6.16.0-charlie → 7.0.0-echo
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/dist/components/CheckYourAnswers/Answer.js +5 -2
- package/dist/components/CheckYourAnswers/Answer.test.js +8 -7
- package/dist/components/CheckYourAnswers/CheckYourAnswers.js +86 -68
- package/dist/components/CheckYourAnswers/CheckYourAnswers.test.js +22 -22
- package/dist/components/CollectionPage/CollectionPage.js +3 -3
- package/dist/components/CollectionPage/CollectionPage.test.js +13 -13
- package/dist/components/CollectionSummary/BannerStrip.js +22 -21
- package/dist/components/CollectionSummary/BannerStrip.test.js +8 -8
- package/dist/components/CollectionSummary/CollectionSummary.js +105 -99
- package/dist/components/CollectionSummary/CollectionSummary.test.js +23 -19
- package/dist/components/CollectionSummary/Confirmation.js +16 -10
- package/dist/components/CollectionSummary/Confirmation.test.js +12 -11
- package/dist/components/CollectionSummary/RenderListView.js +78 -65
- package/dist/components/CollectionSummary/RenderListView.test.js +18 -12
- package/dist/components/CollectionSummary/SummaryCard.js +83 -72
- package/dist/components/CollectionSummary/SummaryCard.test.js +105 -101
- package/dist/components/CollectionSummary/SummaryCardButtons.js +17 -13
- package/dist/components/CollectionSummary/SummaryCardButtons.test.js +3 -2
- package/dist/components/CollectionSummary/SummaryCardDetails.js +72 -67
- package/dist/components/CollectionSummary/SummaryCardDetails.test.js +12 -12
- package/dist/components/CollectionSummary/SummaryCardValidationContext.js +6 -5
- package/dist/components/CollectionSummary/SummaryCardValidationContext.test.js +29 -13
- package/dist/components/FormComponent/Collection.js +91 -82
- package/dist/components/FormComponent/Collection.test.js +16 -15
- package/dist/components/FormComponent/Container.js +21 -22
- package/dist/components/FormComponent/Container.test.js +9 -8
- package/dist/components/FormComponent/FormComponent.js +7 -8
- package/dist/components/FormComponent/FormComponent.test.js +18 -13
- package/dist/components/FormPage/FormPage.js +29 -23
- package/dist/components/FormPage/FormPage.test.js +11 -11
- package/dist/components/FormRenderer/FormRenderer.js +81 -92
- package/dist/components/FormRenderer/FormRenderer.test.js +23 -24
- package/dist/components/FormRenderer/clear-uncompleted-routes/test-data/forms/form-hidden-component-with-nested-questions-visible-elsewhere.json +118 -0
- package/dist/components/FormRenderer/clear-uncompleted-routes/test-data/forms/form-nested-answers-hidden-by-option-visible-elsewhere.json +113 -0
- package/dist/components/FormRenderer/clear-uncompleted-routes/test-data/forms/form-page-nested-component.json +26003 -0
- package/dist/components/FormRenderer/clear-uncompleted-routes/test-data/input/data-hidden-component-with-nested-questions-visible-elsewhere.json +12 -0
- package/dist/components/FormRenderer/clear-uncompleted-routes/test-data/input/data-nested-answers-hidden-by-option-visible-elsewhere.json +12 -0
- package/dist/components/FormRenderer/clear-uncompleted-routes/test-data/input/data-page-nested-component.json +63 -0
- package/dist/components/FormRenderer/clear-uncompleted-routes/test-data/output/data-hidden-component-with-nested-questions-visible-elsewhere-removed.json +11 -0
- package/dist/components/FormRenderer/clear-uncompleted-routes/test-data/output/data-nested-answers-hidden-by-option-visible-elsewhere-removed.json +12 -0
- package/dist/components/FormRenderer/clear-uncompleted-routes/test-data/output/data-page-nested-component.json +63 -0
- package/dist/components/FormRenderer/helpers/clearOutUncompletedRoutes.js +18 -16
- package/dist/components/FormRenderer/helpers/clearOutUncompletedRoutes.test.js +31 -0
- package/dist/components/FormRenderer/helpers/clearOutUncompletedRoutesUtils.js +44 -35
- package/dist/components/FormRenderer/helpers/clearOutUncompletedRoutesUtils.test.js +1 -2
- package/dist/components/PageActions/ActionButton.js +12 -6
- package/dist/components/PageActions/ActionButton.test.js +5 -5
- package/dist/components/PageActions/PageActions.js +7 -5
- package/dist/components/PageActions/PageActions.test.js +5 -4
- package/dist/components/SummaryList/GroupAction.js +14 -8
- package/dist/components/SummaryList/GroupAction.test.js +5 -4
- package/dist/components/SummaryList/RowAction.js +12 -6
- package/dist/components/SummaryList/RowAction.test.js +5 -4
- package/dist/components/SummaryList/SummaryList.js +54 -49
- package/dist/components/SummaryList/SummaryList.test.js +33 -19
- package/dist/components/SummaryList/SummaryListHeadingRow.js +9 -3
- package/dist/components/SummaryList/SummaryListHeadingRowWithAction.js +20 -12
- package/dist/components/SummaryList/SummaryListRow.js +16 -11
- package/dist/components/SummaryList/SummaryListTitleRow.js +7 -3
- package/dist/components/TaskList/Task.js +20 -17
- package/dist/components/TaskList/Task.test.js +8 -7
- package/dist/components/TaskList/TaskList.js +68 -45
- package/dist/components/TaskList/TaskList.test.js +11 -11
- package/dist/components/TaskList/TaskState.js +5 -3
- package/dist/components/TaskList/TaskState.test.js +8 -7
- package/dist/context/HooksContext/HooksContext.js +6 -5
- package/dist/context/HooksContext/HooksContext.test.js +14 -6
- package/dist/context/HooksContext/index.js +1 -2
- package/dist/context/ValidationContext/ValidationContext.js +6 -5
- package/dist/context/ValidationContext/ValidationContext.test.js +33 -9
- package/dist/context/ValidationContext/index.js +1 -2
- package/dist/hooks/index.js +1 -2
- package/dist/hooks/useRefData.js +1 -2
- package/dist/index.js +1 -2
- package/dist/setupTests.js +23 -18
- package/dist/utils/CheckYourAnswers/getCYARowForGroup.js +19 -16
- package/dist/utils/CheckYourAnswers/getSummaryListRowForDetails.js +5 -5
- package/dist/utils/CollectionPage/getQuickEditPage.js +2 -2
- package/dist/utils/Component/cleanAttributes.test.js +1 -2
- package/dist/utils/Component/getComponent.js +38 -28
- package/dist/utils/Component/getDefaultValueFromConfig.js +1 -2
- package/dist/utils/Component/isEditable.test.js +1 -2
- package/dist/utils/Component/wrapInFormGroup.js +10 -4
- package/dist/utils/Format/formatDataForComponent.test.js +1 -2
- package/dist/utils/Format/formatDataForPage.test.js +1 -2
- package/dist/utils/Validate/validateDate.test.js +1 -2
- package/dist/utils/Validate/validateMultifile.test.js +1 -2
- package/package.json +89 -27
|
@@ -9,6 +9,7 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
9
9
|
var _react = _interopRequireDefault(require("react"));
|
|
10
10
|
var _utils = _interopRequireDefault(require("../../utils"));
|
|
11
11
|
require("./BannerStrip.scss");
|
|
12
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
13
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
14
|
// Global imports.
|
|
14
15
|
|
|
@@ -26,28 +27,28 @@ const BannerStrip = _ref => {
|
|
|
26
27
|
} = _ref;
|
|
27
28
|
const classes = _utils.default.classBuilder(DEFAULT_CLASS, classModifiers, '');
|
|
28
29
|
const filteredBanners = banners.filter(banner => _utils.default.Component.show(banner, formData));
|
|
29
|
-
return /*#__PURE__*/
|
|
30
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
30
31
|
id: id,
|
|
31
|
-
className: classes()
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
})
|
|
50
|
-
})
|
|
32
|
+
className: classes(),
|
|
33
|
+
children: filteredBanners.map((banner, index) => {
|
|
34
|
+
const bannerId = "".concat(id, "-banner-").concat(index);
|
|
35
|
+
if (typeof banner === 'string' || banner.type === 'plain') {
|
|
36
|
+
const bannerText = typeof banner === 'string' ? banner : banner.text;
|
|
37
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
38
|
+
id: bannerId,
|
|
39
|
+
className: classes('banner'),
|
|
40
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_copReactComponents.Markup, {
|
|
41
|
+
content: _utils.default.interpolateString(bannerText, formData)
|
|
42
|
+
})
|
|
43
|
+
}, bannerId);
|
|
44
|
+
}
|
|
45
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_copReactComponents.Tag, {
|
|
46
|
+
classBlock: "".concat(DEFAULT_CLASS, "__tag"),
|
|
47
|
+
classModifiers: banner.classModifiers,
|
|
48
|
+
text: _utils.default.interpolateString(banner.text, formData)
|
|
49
|
+
}, bannerId);
|
|
50
|
+
})
|
|
51
|
+
});
|
|
51
52
|
};
|
|
52
53
|
BannerStrip.propTypes = {
|
|
53
54
|
id: _propTypes.default.string.isRequired,
|
|
@@ -4,8 +4,8 @@ var _copReactComponents = require("@ukhomeoffice/cop-react-components");
|
|
|
4
4
|
var _react = _interopRequireDefault(require("react"));
|
|
5
5
|
var _setupTests = require("../../setupTests");
|
|
6
6
|
var _BannerStrip = _interopRequireWildcard(require("./BannerStrip"));
|
|
7
|
-
|
|
8
|
-
function _interopRequireWildcard(e, r) { if (!
|
|
7
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
8
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
9
9
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
10
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
11
11
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
@@ -29,7 +29,7 @@ describe('components.CollectionSummary.BannerStrip', () => {
|
|
|
29
29
|
it('should correctly render a BannerStrip component with plain-text banners', () => {
|
|
30
30
|
const {
|
|
31
31
|
container
|
|
32
|
-
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/
|
|
32
|
+
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_BannerStrip.default, {
|
|
33
33
|
id: ID,
|
|
34
34
|
banners: BANNERS,
|
|
35
35
|
formData: FORM_DATA
|
|
@@ -56,7 +56,7 @@ describe('components.CollectionSummary.BannerStrip', () => {
|
|
|
56
56
|
}];
|
|
57
57
|
const {
|
|
58
58
|
container
|
|
59
|
-
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/
|
|
59
|
+
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_BannerStrip.default, {
|
|
60
60
|
id: ID,
|
|
61
61
|
banners: TAG_BANNERS,
|
|
62
62
|
formData: FORM_DATA
|
|
@@ -84,7 +84,7 @@ describe('components.CollectionSummary.BannerStrip', () => {
|
|
|
84
84
|
'Another interpolated ${textField}'];
|
|
85
85
|
const {
|
|
86
86
|
container
|
|
87
|
-
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/
|
|
87
|
+
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_BannerStrip.default, {
|
|
88
88
|
id: ID,
|
|
89
89
|
banners: INTERPOLATED_BANNERS,
|
|
90
90
|
formData: FORM_DATA
|
|
@@ -104,7 +104,7 @@ describe('components.CollectionSummary.BannerStrip', () => {
|
|
|
104
104
|
it('should render no banners if none are provided', () => {
|
|
105
105
|
const {
|
|
106
106
|
container
|
|
107
|
-
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/
|
|
107
|
+
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_BannerStrip.default, {
|
|
108
108
|
id: ID,
|
|
109
109
|
formData: FORM_DATA
|
|
110
110
|
}));
|
|
@@ -117,7 +117,7 @@ describe('components.CollectionSummary.BannerStrip', () => {
|
|
|
117
117
|
const PLAIN_STRING_BANNER = 'banner';
|
|
118
118
|
const {
|
|
119
119
|
container
|
|
120
|
-
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/
|
|
120
|
+
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_BannerStrip.default, {
|
|
121
121
|
id: ID,
|
|
122
122
|
banners: [PLAIN_STRING_BANNER],
|
|
123
123
|
formData: FORM_DATA
|
|
@@ -147,7 +147,7 @@ describe('components.CollectionSummary.BannerStrip', () => {
|
|
|
147
147
|
});
|
|
148
148
|
const {
|
|
149
149
|
container
|
|
150
|
-
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/
|
|
150
|
+
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_BannerStrip.default, {
|
|
151
151
|
id: ID,
|
|
152
152
|
banners: CUSTOM_BANNERS,
|
|
153
153
|
formData: CUSTOM_FORM_DATA
|
|
@@ -18,12 +18,12 @@ var _Confirmation = _interopRequireDefault(require("./Confirmation"));
|
|
|
18
18
|
var _SummaryCard = _interopRequireDefault(require("./SummaryCard"));
|
|
19
19
|
var _SummaryCardValidationContext = _interopRequireDefault(require("./SummaryCardValidationContext"));
|
|
20
20
|
require("./CollectionSummary.scss");
|
|
21
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
21
22
|
const _excluded = ["isDuplicate"];
|
|
22
|
-
function
|
|
23
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
23
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
24
24
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
25
|
-
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var
|
|
26
|
-
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.
|
|
25
|
+
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
26
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
27
27
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
28
28
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
29
29
|
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
@@ -198,103 +198,109 @@ const CollectionSummary = _ref => {
|
|
|
198
198
|
const row = (0, _getCYARow.default)(_objectSpread(_objectSpread({}, masterPage), {}, {
|
|
199
199
|
formData: _objectSpread(_objectSpread({}, formData), entryToDelete)
|
|
200
200
|
}), component);
|
|
201
|
-
return /*#__PURE__*/
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
})
|
|
201
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
202
|
+
className: "confirmation-field-value",
|
|
203
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Answer.default, {
|
|
204
|
+
value: row.value,
|
|
205
|
+
component: row.component,
|
|
206
|
+
formData: row.formData
|
|
207
|
+
})
|
|
208
|
+
}, field);
|
|
209
209
|
};
|
|
210
|
-
return /*#__PURE__*/
|
|
211
|
-
id: config.fieldId
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
}), /*#__PURE__*/_react.default.createElement("ul", {
|
|
244
|
-
className: "collection-summary-card-list"
|
|
245
|
-
}, data.map((entry, index) => {
|
|
246
|
-
const isInError = errors.filter(e => e.entryId === entry.id).length > 0;
|
|
247
|
-
const finalConfig = _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, config.card), entry.isDuplicate && config.duplicatedCard ? config.duplicatedCard : {}), isInError && config.errorCard ? config.errorCard : {}), {}, {
|
|
248
|
-
focusOn: (toFocusOn === null || toFocusOn === void 0 ? void 0 : toFocusOn.id) === entry.id
|
|
249
|
-
});
|
|
250
|
-
const key = "".concat(config.fieldId, ".summaryCard").concat(entry.id);
|
|
251
|
-
return /*#__PURE__*/_react.default.createElement("li", null, /*#__PURE__*/_react.default.createElement(_SummaryCardValidationContext.default, {
|
|
252
|
-
entryId: entry.id,
|
|
253
|
-
topLevelErrors: errors,
|
|
254
|
-
clearTopLevelErrorsForCard: () => {
|
|
255
|
-
const newErrors = errors.filter(e => e.entryId !== entry.id);
|
|
256
|
-
clearErrors();
|
|
257
|
-
addErrors(newErrors);
|
|
258
|
-
}
|
|
259
|
-
}, /*#__PURE__*/_react.default.createElement(_SummaryCard.default, {
|
|
260
|
-
id: key,
|
|
261
|
-
key: key,
|
|
262
|
-
entryData: _objectSpread(_objectSpread({}, entry), {}, {
|
|
263
|
-
index
|
|
264
|
-
}),
|
|
265
|
-
masterPage: masterPage,
|
|
266
|
-
config: finalConfig || {},
|
|
267
|
-
onFullEdit: onSummaryCardFullEdit,
|
|
268
|
-
onDuplicate: onDuplicate,
|
|
269
|
-
onDelete: () => setEntryToDelete(_objectSpread(_objectSpread({}, entry), {}, {
|
|
270
|
-
index
|
|
271
|
-
})),
|
|
272
|
-
onQuickEdit: target => {
|
|
273
|
-
validateEntries();
|
|
274
|
-
return onChange(target);
|
|
210
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
211
|
+
id: config.fieldId,
|
|
212
|
+
children: [entryToDelete && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Confirmation.default, {
|
|
213
|
+
id: "".concat(config.fieldId, ".confirmation"),
|
|
214
|
+
message: _utils.default.interpolateString((_config$confirmation = config.confirmation) === null || _config$confirmation === void 0 ? void 0 : _config$confirmation.message, _objectSpread(_objectSpread({}, entryToDelete), {}, {
|
|
215
|
+
index: entryToDelete.index + 1
|
|
216
|
+
})) || null,
|
|
217
|
+
confirmLabel: _utils.default.interpolateString((_config$confirmation2 = config.confirmation) === null || _config$confirmation2 === void 0 ? void 0 : _config$confirmation2.label, entryToDelete) || null,
|
|
218
|
+
onConfirm: onDeleteConfirm,
|
|
219
|
+
onCancel: () => setEntryToDelete(null),
|
|
220
|
+
children: config.card.listView ? /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
221
|
+
className: "confirmation-content",
|
|
222
|
+
children: (_config$confirmation3 = config.confirmation) === null || _config$confirmation3 === void 0 ? void 0 : _config$confirmation3.displayFields.map(renderFieldValue)
|
|
223
|
+
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_SummaryCard.default, {
|
|
224
|
+
id: "".concat(config.fieldId, ".confirmationChild"),
|
|
225
|
+
entryData: entryToDelete,
|
|
226
|
+
config: config.card ? _objectSpread(_objectSpread({}, config.card), {}, {
|
|
227
|
+
quickEdit: null
|
|
228
|
+
}) : {},
|
|
229
|
+
masterPage: masterPage,
|
|
230
|
+
classModifiers: "nested",
|
|
231
|
+
hideDetails: true
|
|
232
|
+
})
|
|
233
|
+
}), !config.card.listView && config.addButton && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ActionButton.default, {
|
|
234
|
+
id: "".concat(config.fieldId, ".addButton"),
|
|
235
|
+
action: {
|
|
236
|
+
collection: config.collectionName,
|
|
237
|
+
label: _utils.default.interpolateString(config.addButton.label || DEFAULT_ADD_BUTTON_LABEL, {
|
|
238
|
+
documents: data
|
|
239
|
+
}),
|
|
240
|
+
page: config.addButton.page,
|
|
241
|
+
type: _PageAction.PageActionTypes.COLLECTION_ADD,
|
|
242
|
+
classModifiers: ['secondary']
|
|
275
243
|
},
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
244
|
+
onAction: onAction
|
|
245
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("ul", {
|
|
246
|
+
className: "collection-summary-card-list",
|
|
247
|
+
children: data.map((entry, index) => {
|
|
248
|
+
const isInError = errors.filter(e => e.entryId === entry.id).length > 0;
|
|
249
|
+
const finalConfig = _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, config.card), entry.isDuplicate && config.duplicatedCard ? config.duplicatedCard : {}), isInError && config.errorCard ? config.errorCard : {}), {}, {
|
|
250
|
+
focusOn: (toFocusOn === null || toFocusOn === void 0 ? void 0 : toFocusOn.id) === entry.id
|
|
251
|
+
});
|
|
252
|
+
const key = "".concat(config.fieldId, ".summaryCard").concat(entry.id);
|
|
253
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("li", {
|
|
254
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_SummaryCardValidationContext.default, {
|
|
255
|
+
entryId: entry.id,
|
|
256
|
+
topLevelErrors: errors,
|
|
257
|
+
clearTopLevelErrorsForCard: () => {
|
|
258
|
+
const newErrors = errors.filter(e => e.entryId !== entry.id);
|
|
259
|
+
clearErrors();
|
|
260
|
+
addErrors(newErrors);
|
|
261
|
+
},
|
|
262
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_SummaryCard.default, {
|
|
263
|
+
id: key,
|
|
264
|
+
entryData: _objectSpread(_objectSpread({}, entry), {}, {
|
|
265
|
+
index
|
|
266
|
+
}),
|
|
267
|
+
masterPage: masterPage,
|
|
268
|
+
config: finalConfig || {},
|
|
269
|
+
onFullEdit: onSummaryCardFullEdit,
|
|
270
|
+
onDuplicate: onDuplicate,
|
|
271
|
+
onDelete: () => setEntryToDelete(_objectSpread(_objectSpread({}, entry), {}, {
|
|
272
|
+
index
|
|
273
|
+
})),
|
|
274
|
+
onQuickEdit: target => {
|
|
275
|
+
validateEntries();
|
|
276
|
+
return onChange(target);
|
|
277
|
+
},
|
|
278
|
+
parentCollectionName: config.collectionName.split('.').shift(),
|
|
279
|
+
childCollections: config.childCollections || [],
|
|
280
|
+
formData: formData,
|
|
281
|
+
classModifiers: entry.id === (entryToDelete === null || entryToDelete === void 0 ? void 0 : entryToDelete.id) ? ['deleting-summary-card'] : [''],
|
|
282
|
+
inError: errors.filter(e => e.entryId === entry.id).length > 0
|
|
283
|
+
}, key)
|
|
284
|
+
})
|
|
285
|
+
});
|
|
286
|
+
})
|
|
287
|
+
}), config.card.listView && config.addButton && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ActionButton.default, {
|
|
288
|
+
id: "".concat(config.fieldId, ".addButton"),
|
|
289
|
+
action: {
|
|
290
|
+
collection: config.collectionName,
|
|
291
|
+
label: _utils.default.interpolateString(config.addButton.label || DEFAULT_ADD_BUTTON_LABEL, {
|
|
292
|
+
documents: data
|
|
293
|
+
}),
|
|
294
|
+
page: config.addButton.page,
|
|
295
|
+
type: _PageAction.PageActionTypes.COLLECTION_ADD,
|
|
296
|
+
classModifiers: ['secondary'],
|
|
297
|
+
customAction: {
|
|
298
|
+
type: config.addButton.customAction
|
|
299
|
+
}
|
|
300
|
+
},
|
|
301
|
+
onAction: onAction
|
|
302
|
+
})]
|
|
303
|
+
});
|
|
298
304
|
};
|
|
299
305
|
CollectionSummary.propTypes = {
|
|
300
306
|
config: _propTypes.default.shape({
|
|
@@ -6,8 +6,8 @@ var _setupTests = require("../../setupTests");
|
|
|
6
6
|
var _hooks = require("../../hooks");
|
|
7
7
|
var _CollectionSummary = _interopRequireWildcard(require("./CollectionSummary"));
|
|
8
8
|
var _Confirmation = require("./Confirmation");
|
|
9
|
-
|
|
10
|
-
function _interopRequireWildcard(e, r) { if (!
|
|
9
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
10
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
11
11
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
12
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
13
13
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
@@ -75,7 +75,7 @@ describe('components.CollectionSummary.CollectionSummary', () => {
|
|
|
75
75
|
it('should correctly render a CollectionSummary component', () => {
|
|
76
76
|
const {
|
|
77
77
|
container
|
|
78
|
-
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/
|
|
78
|
+
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_CollectionSummary.default, {
|
|
79
79
|
config: CONFIG,
|
|
80
80
|
formData: FORM_DATA,
|
|
81
81
|
onAction: ON_ACTION
|
|
@@ -121,7 +121,7 @@ describe('components.CollectionSummary.CollectionSummary', () => {
|
|
|
121
121
|
};
|
|
122
122
|
const {
|
|
123
123
|
container
|
|
124
|
-
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/
|
|
124
|
+
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_CollectionSummary.default, {
|
|
125
125
|
config: customConfig,
|
|
126
126
|
formData: customFormData,
|
|
127
127
|
onAction: ON_ACTION
|
|
@@ -139,16 +139,20 @@ describe('components.CollectionSummary.CollectionSummary', () => {
|
|
|
139
139
|
const {
|
|
140
140
|
queuedErrors
|
|
141
141
|
} = (0, _hooks.useValidation)();
|
|
142
|
-
return /*#__PURE__*/
|
|
142
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
143
|
+
children: [Array.isArray(queuedErrors) && "queuedErrors is an array of length ".concat(queuedErrors.length), (queuedErrors === null || queuedErrors === void 0 ? void 0 : queuedErrors.length) > 0 && queuedErrors.map(e => e.error)]
|
|
144
|
+
});
|
|
143
145
|
};
|
|
144
146
|
const {
|
|
145
147
|
container
|
|
146
|
-
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
148
|
+
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
149
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(ErrorCheckComponent, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_CollectionSummary.default, {
|
|
150
|
+
config: CONFIG,
|
|
151
|
+
formData: FORM_DATA,
|
|
152
|
+
onAction: ON_ACTION,
|
|
153
|
+
pages: PAGES
|
|
154
|
+
})]
|
|
155
|
+
}));
|
|
152
156
|
const errorChecker = container.children[0];
|
|
153
157
|
expect(errorChecker.textContent).toContain('queuedErrors is an array of length 1');
|
|
154
158
|
expect(errorChecker.textContent).toContain('testText is required');
|
|
@@ -156,7 +160,7 @@ describe('components.CollectionSummary.CollectionSummary', () => {
|
|
|
156
160
|
it('should render a confirmation when a SummaryCard\'s delete button is pressed', () => {
|
|
157
161
|
const {
|
|
158
162
|
container
|
|
159
|
-
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/
|
|
163
|
+
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_CollectionSummary.default, {
|
|
160
164
|
config: CONFIG,
|
|
161
165
|
formData: FORM_DATA,
|
|
162
166
|
onAction: ON_ACTION
|
|
@@ -189,7 +193,7 @@ describe('components.CollectionSummary.CollectionSummary', () => {
|
|
|
189
193
|
};
|
|
190
194
|
const {
|
|
191
195
|
container
|
|
192
|
-
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/
|
|
196
|
+
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_CollectionSummary.default, {
|
|
193
197
|
config: CONFIG_WITH_BUTTON,
|
|
194
198
|
formData: FORM_DATA,
|
|
195
199
|
onAction: ON_ACTION
|
|
@@ -216,7 +220,7 @@ describe('components.CollectionSummary.CollectionSummary', () => {
|
|
|
216
220
|
};
|
|
217
221
|
const {
|
|
218
222
|
container
|
|
219
|
-
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/
|
|
223
|
+
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_CollectionSummary.default, {
|
|
220
224
|
config: CONFIG_WITH_BUTTON,
|
|
221
225
|
formData: FORM_DATA,
|
|
222
226
|
onAction: ON_ACTION
|
|
@@ -232,7 +236,7 @@ describe('components.CollectionSummary.CollectionSummary', () => {
|
|
|
232
236
|
it('should apply the expected class name to the summary card when delete button is pressed', () => {
|
|
233
237
|
const {
|
|
234
238
|
container
|
|
235
|
-
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/
|
|
239
|
+
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_CollectionSummary.default, {
|
|
236
240
|
config: CONFIG,
|
|
237
241
|
formData: FORM_DATA,
|
|
238
242
|
onAction: ON_ACTION
|
|
@@ -251,7 +255,7 @@ describe('components.CollectionSummary.CollectionSummary', () => {
|
|
|
251
255
|
it('should focus on the delete button in the confirmation panel', () => {
|
|
252
256
|
const {
|
|
253
257
|
container
|
|
254
|
-
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/
|
|
258
|
+
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_CollectionSummary.default, {
|
|
255
259
|
config: CONFIG,
|
|
256
260
|
formData: FORM_DATA,
|
|
257
261
|
onAction: ON_ACTION
|
|
@@ -270,7 +274,7 @@ describe('components.CollectionSummary.CollectionSummary', () => {
|
|
|
270
274
|
it('should have the role "alert" in the confirmation panel', () => {
|
|
271
275
|
const {
|
|
272
276
|
container
|
|
273
|
-
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/
|
|
277
|
+
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_CollectionSummary.default, {
|
|
274
278
|
config: CONFIG,
|
|
275
279
|
formData: FORM_DATA,
|
|
276
280
|
onAction: ON_ACTION
|
|
@@ -299,7 +303,7 @@ describe('components.CollectionSummary.CollectionSummary', () => {
|
|
|
299
303
|
const {
|
|
300
304
|
container,
|
|
301
305
|
getByText
|
|
302
|
-
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/
|
|
306
|
+
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_CollectionSummary.default, {
|
|
303
307
|
config: listViewConfig,
|
|
304
308
|
formData: FORM_DATA,
|
|
305
309
|
onAction: ON_ACTION,
|
|
@@ -334,7 +338,7 @@ describe('components.CollectionSummary.CollectionSummary', () => {
|
|
|
334
338
|
const {
|
|
335
339
|
container,
|
|
336
340
|
getByText
|
|
337
|
-
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/
|
|
341
|
+
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_CollectionSummary.default, {
|
|
338
342
|
config: listViewConfig,
|
|
339
343
|
formData: FORM_DATA,
|
|
340
344
|
onAction: ON_ACTION,
|
|
@@ -8,6 +8,7 @@ var _copReactComponents = require("@ukhomeoffice/cop-react-components");
|
|
|
8
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
9
|
var _react = _interopRequireDefault(require("react"));
|
|
10
10
|
require("./Confirmation.scss");
|
|
11
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
12
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
13
|
// Global imports.
|
|
13
14
|
|
|
@@ -27,18 +28,23 @@ const Confirmation = _ref => {
|
|
|
27
28
|
classModifiers
|
|
28
29
|
} = _ref;
|
|
29
30
|
const classes = _copReactComponents.Utils.classBuilder(DEFAULT_CLASS, classModifiers, '');
|
|
30
|
-
return /*#__PURE__*/
|
|
31
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
31
32
|
id: id,
|
|
32
33
|
className: classes(),
|
|
33
|
-
role: "alert"
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
34
|
+
role: "alert",
|
|
35
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("h2", {
|
|
36
|
+
children: message || DEFAULT_MESSAGE
|
|
37
|
+
}), children, /*#__PURE__*/(0, _jsxRuntime.jsx)(_copReactComponents.Button, {
|
|
38
|
+
classModifiers: "warning",
|
|
39
|
+
onClick: onConfirm,
|
|
40
|
+
autoFocus: true,
|
|
41
|
+
children: confirmLabel || DEFAULT_CONFIRM_LABEL
|
|
42
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_copReactComponents.Button, {
|
|
43
|
+
classModifiers: "secondary",
|
|
44
|
+
onClick: onCancel,
|
|
45
|
+
children: "Cancel"
|
|
46
|
+
})]
|
|
47
|
+
});
|
|
42
48
|
};
|
|
43
49
|
Confirmation.propTypes = {
|
|
44
50
|
id: _propTypes.default.string.isRequired,
|
|
@@ -2,15 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
var _react = require("@testing-library/react");
|
|
4
4
|
var _Confirmation = _interopRequireWildcard(require("./Confirmation"));
|
|
5
|
-
|
|
6
|
-
function _interopRequireWildcard(e, r) { if (!
|
|
5
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
6
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
7
7
|
// Global imports.
|
|
8
8
|
|
|
9
9
|
// Local imports.
|
|
10
10
|
|
|
11
|
-
/* eslint-disable no-plusplus */
|
|
12
|
-
|
|
13
|
-
describe('components.CollectionSummary.Confirmation', () => {
|
|
11
|
+
/* eslint-disable no-plusplus */describe('components.CollectionSummary.Confirmation', () => {
|
|
14
12
|
let onConfirmCalls = 0;
|
|
15
13
|
const ON_CONFIRM = () => {
|
|
16
14
|
onConfirmCalls += 1;
|
|
@@ -48,7 +46,7 @@ describe('components.CollectionSummary.Confirmation', () => {
|
|
|
48
46
|
it('should render correctly', () => {
|
|
49
47
|
const {
|
|
50
48
|
container
|
|
51
|
-
} = (0, _react.render)(/*#__PURE__*/
|
|
49
|
+
} = (0, _react.render)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_Confirmation.default, {
|
|
52
50
|
id: ID,
|
|
53
51
|
message: MESSAGE,
|
|
54
52
|
confirmLabel: LABEL,
|
|
@@ -70,7 +68,7 @@ describe('components.CollectionSummary.Confirmation', () => {
|
|
|
70
68
|
it('should use the default message if one is not provided', () => {
|
|
71
69
|
const {
|
|
72
70
|
container
|
|
73
|
-
} = (0, _react.render)(/*#__PURE__*/
|
|
71
|
+
} = (0, _react.render)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_Confirmation.default, {
|
|
74
72
|
id: ID,
|
|
75
73
|
confirmLabel: LABEL,
|
|
76
74
|
onConfirm: ON_CONFIRM,
|
|
@@ -84,7 +82,7 @@ describe('components.CollectionSummary.Confirmation', () => {
|
|
|
84
82
|
it('should use the default label if one is not provided', () => {
|
|
85
83
|
const {
|
|
86
84
|
container
|
|
87
|
-
} = (0, _react.render)(/*#__PURE__*/
|
|
85
|
+
} = (0, _react.render)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_Confirmation.default, {
|
|
88
86
|
id: ID,
|
|
89
87
|
onConfirm: ON_CONFIRM,
|
|
90
88
|
onCancel: ON_CANCEL
|
|
@@ -95,11 +93,14 @@ describe('components.CollectionSummary.Confirmation', () => {
|
|
|
95
93
|
it('should render children correctly', () => {
|
|
96
94
|
const {
|
|
97
95
|
container
|
|
98
|
-
} = (0, _react.render)(/*#__PURE__*/
|
|
96
|
+
} = (0, _react.render)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_Confirmation.default, {
|
|
99
97
|
id: ID,
|
|
100
98
|
onConfirm: ON_CONFIRM,
|
|
101
|
-
onCancel: ON_CANCEL
|
|
102
|
-
|
|
99
|
+
onCancel: ON_CANCEL,
|
|
100
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
|
|
101
|
+
children: "A child"
|
|
102
|
+
})
|
|
103
|
+
}));
|
|
103
104
|
const child = checkSetup(container, true).children;
|
|
104
105
|
expect(child.tagName).toEqual('P');
|
|
105
106
|
expect(child.textContent).toEqual('A child');
|