@ukhomeoffice/cop-react-form-renderer 6.16.0-beta → 7.0.0-charlie
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 +12 -12
- 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 +10 -10
- 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 +43 -13
|
@@ -9,8 +9,8 @@ var _setupTests = require("../../setupTests");
|
|
|
9
9
|
var _SummaryCard = _interopRequireWildcard(require("./SummaryCard"));
|
|
10
10
|
var _BannerStrip = require("./BannerStrip");
|
|
11
11
|
var _SummaryCardValidationContext = _interopRequireDefault(require("./SummaryCardValidationContext"));
|
|
12
|
-
|
|
13
|
-
function _interopRequireWildcard(e, r) { if (!
|
|
12
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
|
+
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); }
|
|
14
14
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
15
15
|
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; }
|
|
16
16
|
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; }
|
|
@@ -61,7 +61,7 @@ describe('components.CollectionSummary.SummaryCard', () => {
|
|
|
61
61
|
};
|
|
62
62
|
const {
|
|
63
63
|
container
|
|
64
|
-
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/
|
|
64
|
+
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_SummaryCard.default, {
|
|
65
65
|
id: ID,
|
|
66
66
|
entryData: ENTRY,
|
|
67
67
|
config: CONFIG,
|
|
@@ -94,7 +94,7 @@ describe('components.CollectionSummary.SummaryCard', () => {
|
|
|
94
94
|
};
|
|
95
95
|
const {
|
|
96
96
|
container
|
|
97
|
-
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/
|
|
97
|
+
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_SummaryCard.default, {
|
|
98
98
|
id: ID,
|
|
99
99
|
entryData: ENTRY,
|
|
100
100
|
config: CONFIG,
|
|
@@ -128,7 +128,7 @@ describe('components.CollectionSummary.SummaryCard', () => {
|
|
|
128
128
|
};
|
|
129
129
|
const {
|
|
130
130
|
container
|
|
131
|
-
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/
|
|
131
|
+
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_SummaryCard.default, {
|
|
132
132
|
id: ID,
|
|
133
133
|
entryData: ENTRY,
|
|
134
134
|
config: CONFIG,
|
|
@@ -161,7 +161,7 @@ describe('components.CollectionSummary.SummaryCard', () => {
|
|
|
161
161
|
};
|
|
162
162
|
const {
|
|
163
163
|
container
|
|
164
|
-
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/
|
|
164
|
+
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_SummaryCard.default, {
|
|
165
165
|
id: ID,
|
|
166
166
|
entryData: ENTRY,
|
|
167
167
|
config: CONFIG,
|
|
@@ -203,7 +203,7 @@ describe('components.CollectionSummary.SummaryCard', () => {
|
|
|
203
203
|
});
|
|
204
204
|
const {
|
|
205
205
|
container
|
|
206
|
-
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/
|
|
206
|
+
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_SummaryCard.default, {
|
|
207
207
|
id: ID,
|
|
208
208
|
entryData: CUSTOM_ENTRY,
|
|
209
209
|
config: CONFIG,
|
|
@@ -229,7 +229,7 @@ describe('components.CollectionSummary.SummaryCard', () => {
|
|
|
229
229
|
};
|
|
230
230
|
const {
|
|
231
231
|
container
|
|
232
|
-
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/
|
|
232
|
+
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_SummaryCard.default, {
|
|
233
233
|
id: ID,
|
|
234
234
|
entryData: ENTRY,
|
|
235
235
|
config: CONFIG,
|
|
@@ -273,7 +273,7 @@ describe('components.CollectionSummary.SummaryCard', () => {
|
|
|
273
273
|
};
|
|
274
274
|
const {
|
|
275
275
|
container
|
|
276
|
-
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/
|
|
276
|
+
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_SummaryCard.default, {
|
|
277
277
|
id: ID,
|
|
278
278
|
entryData: ENTRY,
|
|
279
279
|
config: CONFIG,
|
|
@@ -308,7 +308,7 @@ describe('components.CollectionSummary.SummaryCard', () => {
|
|
|
308
308
|
};
|
|
309
309
|
const {
|
|
310
310
|
container
|
|
311
|
-
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/
|
|
311
|
+
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_SummaryCard.default, {
|
|
312
312
|
id: ID,
|
|
313
313
|
entryData: ENTRY,
|
|
314
314
|
config: CONFIG,
|
|
@@ -330,7 +330,7 @@ describe('components.CollectionSummary.SummaryCard', () => {
|
|
|
330
330
|
it('should not render when no config is provided for it', () => {
|
|
331
331
|
const {
|
|
332
332
|
container
|
|
333
|
-
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/
|
|
333
|
+
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_SummaryCard.default, {
|
|
334
334
|
id: ID,
|
|
335
335
|
entryData: ENTRY,
|
|
336
336
|
config: {},
|
|
@@ -355,7 +355,7 @@ describe('components.CollectionSummary.SummaryCard', () => {
|
|
|
355
355
|
};
|
|
356
356
|
const {
|
|
357
357
|
container
|
|
358
|
-
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/
|
|
358
|
+
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_SummaryCard.default, {
|
|
359
359
|
id: ID,
|
|
360
360
|
entryData: ENTRY,
|
|
361
361
|
config: CONFIG,
|
|
@@ -393,7 +393,7 @@ describe('components.CollectionSummary.SummaryCard', () => {
|
|
|
393
393
|
};
|
|
394
394
|
const {
|
|
395
395
|
container
|
|
396
|
-
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/
|
|
396
|
+
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_SummaryCard.default, {
|
|
397
397
|
id: ID,
|
|
398
398
|
entryData: ENTRY,
|
|
399
399
|
config: CONFIG,
|
|
@@ -423,7 +423,7 @@ describe('components.CollectionSummary.SummaryCard', () => {
|
|
|
423
423
|
};
|
|
424
424
|
const {
|
|
425
425
|
container
|
|
426
|
-
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/
|
|
426
|
+
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_SummaryCard.default, {
|
|
427
427
|
id: ID,
|
|
428
428
|
entryData: ENTRY,
|
|
429
429
|
config: CONFIG,
|
|
@@ -445,7 +445,7 @@ describe('components.CollectionSummary.SummaryCard', () => {
|
|
|
445
445
|
it('should not render when no config is provided for it', () => {
|
|
446
446
|
const {
|
|
447
447
|
container
|
|
448
|
-
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/
|
|
448
|
+
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_SummaryCard.default, {
|
|
449
449
|
id: ID,
|
|
450
450
|
entryData: ENTRY,
|
|
451
451
|
config: {},
|
|
@@ -469,7 +469,7 @@ describe('components.CollectionSummary.SummaryCard', () => {
|
|
|
469
469
|
};
|
|
470
470
|
const {
|
|
471
471
|
container
|
|
472
|
-
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/
|
|
472
|
+
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_SummaryCard.default, {
|
|
473
473
|
id: ID,
|
|
474
474
|
entryData: ENTRY,
|
|
475
475
|
config: CONFIG,
|
|
@@ -492,7 +492,7 @@ describe('components.CollectionSummary.SummaryCard', () => {
|
|
|
492
492
|
};
|
|
493
493
|
const {
|
|
494
494
|
container
|
|
495
|
-
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/
|
|
495
|
+
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_SummaryCard.default, {
|
|
496
496
|
id: ID,
|
|
497
497
|
entryData: ENTRY,
|
|
498
498
|
config: CONFIG,
|
|
@@ -526,7 +526,7 @@ describe('components.CollectionSummary.SummaryCard', () => {
|
|
|
526
526
|
};
|
|
527
527
|
const {
|
|
528
528
|
container
|
|
529
|
-
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/
|
|
529
|
+
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_SummaryCard.default, {
|
|
530
530
|
id: ID,
|
|
531
531
|
entryData: ENTRY,
|
|
532
532
|
config: CONFIG,
|
|
@@ -555,7 +555,7 @@ describe('components.CollectionSummary.SummaryCard', () => {
|
|
|
555
555
|
};
|
|
556
556
|
const {
|
|
557
557
|
container
|
|
558
|
-
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/
|
|
558
|
+
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_SummaryCard.default, {
|
|
559
559
|
id: ID,
|
|
560
560
|
entryData: ENTRY,
|
|
561
561
|
config: CONFIG,
|
|
@@ -577,7 +577,7 @@ describe('components.CollectionSummary.SummaryCard', () => {
|
|
|
577
577
|
it('should not render when no config is provided for it', () => {
|
|
578
578
|
const {
|
|
579
579
|
container
|
|
580
|
-
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/
|
|
580
|
+
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_SummaryCard.default, {
|
|
581
581
|
id: ID,
|
|
582
582
|
entryData: ENTRY,
|
|
583
583
|
config: {},
|
|
@@ -601,7 +601,7 @@ describe('components.CollectionSummary.SummaryCard', () => {
|
|
|
601
601
|
};
|
|
602
602
|
const {
|
|
603
603
|
container
|
|
604
|
-
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/
|
|
604
|
+
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_SummaryCard.default, {
|
|
605
605
|
id: ID,
|
|
606
606
|
entryData: ENTRY,
|
|
607
607
|
config: CONFIG,
|
|
@@ -630,7 +630,7 @@ describe('components.CollectionSummary.SummaryCard', () => {
|
|
|
630
630
|
const onDuplicate = jest.fn();
|
|
631
631
|
const {
|
|
632
632
|
getByTestId
|
|
633
|
-
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/
|
|
633
|
+
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_SummaryCard.default, {
|
|
634
634
|
id: ID,
|
|
635
635
|
entryData: entryData,
|
|
636
636
|
config: config,
|
|
@@ -651,7 +651,7 @@ describe('components.CollectionSummary.SummaryCard', () => {
|
|
|
651
651
|
// Rerender the component with updated config
|
|
652
652
|
const {
|
|
653
653
|
getByTestId: getByTestIdRerender
|
|
654
|
-
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/
|
|
654
|
+
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_SummaryCard.default, {
|
|
655
655
|
id: ID,
|
|
656
656
|
entryData: entryData,
|
|
657
657
|
config: updatedConfig,
|
|
@@ -705,7 +705,7 @@ describe('components.CollectionSummary.SummaryCard', () => {
|
|
|
705
705
|
it('should render correctly', () => {
|
|
706
706
|
const {
|
|
707
707
|
container
|
|
708
|
-
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/
|
|
708
|
+
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_SummaryCard.default, {
|
|
709
709
|
id: ID,
|
|
710
710
|
entryData: ENTRY,
|
|
711
711
|
config: CONFIG,
|
|
@@ -747,7 +747,7 @@ describe('components.CollectionSummary.SummaryCard', () => {
|
|
|
747
747
|
it('should not render when no config is provided for it', () => {
|
|
748
748
|
const {
|
|
749
749
|
container
|
|
750
|
-
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/
|
|
750
|
+
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_SummaryCard.default, {
|
|
751
751
|
id: ID,
|
|
752
752
|
entryData: ENTRY,
|
|
753
753
|
config: {},
|
|
@@ -804,19 +804,20 @@ describe('components.CollectionSummary.SummaryCard', () => {
|
|
|
804
804
|
}];
|
|
805
805
|
const {
|
|
806
806
|
container
|
|
807
|
-
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/
|
|
807
|
+
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_SummaryCardValidationContext.default, {
|
|
808
808
|
entryId: CUSTOM_ENTRY.id,
|
|
809
|
-
topLevelErrors: TOP_LEVEL_ERRORS
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
809
|
+
topLevelErrors: TOP_LEVEL_ERRORS,
|
|
810
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_SummaryCard.default, {
|
|
811
|
+
id: ID,
|
|
812
|
+
entryData: CUSTOM_ENTRY,
|
|
813
|
+
config: CONFIG,
|
|
814
|
+
parentCollectionName: "parent",
|
|
815
|
+
formData: {},
|
|
816
|
+
masterPage: {
|
|
817
|
+
childPages: PAGES
|
|
818
|
+
}
|
|
819
|
+
})
|
|
820
|
+
}));
|
|
820
821
|
const {
|
|
821
822
|
headerActionDiv
|
|
822
823
|
} = checkSetup(container);
|
|
@@ -846,20 +847,21 @@ describe('components.CollectionSummary.SummaryCard', () => {
|
|
|
846
847
|
}];
|
|
847
848
|
const {
|
|
848
849
|
container
|
|
849
|
-
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/
|
|
850
|
+
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_SummaryCardValidationContext.default, {
|
|
850
851
|
entryId: CUSTOM_ENTRY.id,
|
|
851
|
-
topLevelErrors: TOP_LEVEL_ERRORS
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
852
|
+
topLevelErrors: TOP_LEVEL_ERRORS,
|
|
853
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_SummaryCard.default, {
|
|
854
|
+
id: ID,
|
|
855
|
+
entryData: CUSTOM_ENTRY,
|
|
856
|
+
config: CONFIG,
|
|
857
|
+
parentCollectionName: "parent",
|
|
858
|
+
formData: {},
|
|
859
|
+
masterPage: {
|
|
860
|
+
childPages: PAGES
|
|
861
|
+
},
|
|
862
|
+
onQuickEdit: () => {}
|
|
863
|
+
})
|
|
864
|
+
}));
|
|
863
865
|
const {
|
|
864
866
|
headerActionDiv
|
|
865
867
|
} = checkSetup(container);
|
|
@@ -940,7 +942,7 @@ describe('components.CollectionSummary.SummaryCard', () => {
|
|
|
940
942
|
it('should render correctly', () => {
|
|
941
943
|
const {
|
|
942
944
|
container
|
|
943
|
-
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/
|
|
945
|
+
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_SummaryCard.default, {
|
|
944
946
|
id: ID,
|
|
945
947
|
entryData: ENTRY,
|
|
946
948
|
config: CONFIG,
|
|
@@ -985,7 +987,7 @@ describe('components.CollectionSummary.SummaryCard', () => {
|
|
|
985
987
|
};
|
|
986
988
|
const {
|
|
987
989
|
container
|
|
988
|
-
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/
|
|
990
|
+
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_SummaryCard.default, {
|
|
989
991
|
id: ID,
|
|
990
992
|
entryData: ENTRY,
|
|
991
993
|
config: CONFIG,
|
|
@@ -1026,7 +1028,7 @@ describe('components.CollectionSummary.SummaryCard', () => {
|
|
|
1026
1028
|
};
|
|
1027
1029
|
const {
|
|
1028
1030
|
container
|
|
1029
|
-
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/
|
|
1031
|
+
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_SummaryCard.default, {
|
|
1030
1032
|
id: ID,
|
|
1031
1033
|
entryData: _objectSpread(_objectSpread({}, ENTRY), {}, {
|
|
1032
1034
|
index: 0
|
|
@@ -1089,7 +1091,7 @@ describe('components.CollectionSummary.SummaryCard', () => {
|
|
|
1089
1091
|
};
|
|
1090
1092
|
const {
|
|
1091
1093
|
container
|
|
1092
|
-
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/
|
|
1094
|
+
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_SummaryCard.default, {
|
|
1093
1095
|
id: ID,
|
|
1094
1096
|
entryData: ENTRY,
|
|
1095
1097
|
config: CONFIG,
|
|
@@ -1145,28 +1147,29 @@ describe('components.CollectionSummary.SummaryCard', () => {
|
|
|
1145
1147
|
};
|
|
1146
1148
|
const {
|
|
1147
1149
|
container
|
|
1148
|
-
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/
|
|
1150
|
+
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_SummaryCardValidationContext.default, {
|
|
1149
1151
|
entryId: "id",
|
|
1150
1152
|
topLevelErrors: [],
|
|
1151
|
-
clearTopLevelErrorsForCard: () => {}
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1153
|
+
clearTopLevelErrorsForCard: () => {},
|
|
1154
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_SummaryCard.default, {
|
|
1155
|
+
id: ID,
|
|
1156
|
+
entryData: {
|
|
1157
|
+
index: 0,
|
|
1158
|
+
id: '0'
|
|
1159
|
+
},
|
|
1160
|
+
config: CONFIG,
|
|
1161
|
+
parentCollectionName: "parents",
|
|
1162
|
+
onQuickEdit: ON_QUICK_EDIT,
|
|
1163
|
+
formData: {
|
|
1164
|
+
parents: [{
|
|
1165
|
+
alreadyProvidedField: 'hello'
|
|
1166
|
+
}]
|
|
1167
|
+
},
|
|
1168
|
+
masterPage: {
|
|
1169
|
+
childPages: PAGES
|
|
1170
|
+
}
|
|
1171
|
+
})
|
|
1172
|
+
}), {
|
|
1170
1173
|
hooks
|
|
1171
1174
|
});
|
|
1172
1175
|
const {
|
|
@@ -1209,29 +1212,30 @@ describe('components.CollectionSummary.SummaryCard', () => {
|
|
|
1209
1212
|
};
|
|
1210
1213
|
const {
|
|
1211
1214
|
container
|
|
1212
|
-
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/
|
|
1215
|
+
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_SummaryCardValidationContext.default, {
|
|
1213
1216
|
entryId: "id",
|
|
1214
1217
|
topLevelErrors: [],
|
|
1215
|
-
clearTopLevelErrorsForCard: () => {}
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1218
|
+
clearTopLevelErrorsForCard: () => {},
|
|
1219
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_SummaryCard.default, {
|
|
1220
|
+
id: ID,
|
|
1221
|
+
entryData: {
|
|
1222
|
+
index: 0,
|
|
1223
|
+
id: '0',
|
|
1224
|
+
isDuplicate: true
|
|
1225
|
+
},
|
|
1226
|
+
config: CONFIG,
|
|
1227
|
+
parentCollectionName: "parents",
|
|
1228
|
+
onQuickEdit: ON_QUICK_EDIT,
|
|
1229
|
+
formData: {
|
|
1230
|
+
parents: [{
|
|
1231
|
+
alreadyProvidedField: 'hello'
|
|
1232
|
+
}]
|
|
1233
|
+
},
|
|
1234
|
+
masterPage: {
|
|
1235
|
+
childPages: PAGES
|
|
1236
|
+
}
|
|
1237
|
+
})
|
|
1238
|
+
}), {
|
|
1235
1239
|
hooks
|
|
1236
1240
|
});
|
|
1237
1241
|
const {
|
|
@@ -1271,7 +1275,7 @@ describe('components.CollectionSummary.SummaryCard', () => {
|
|
|
1271
1275
|
};
|
|
1272
1276
|
const {
|
|
1273
1277
|
container
|
|
1274
|
-
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/
|
|
1278
|
+
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_SummaryCard.default, {
|
|
1275
1279
|
id: ID,
|
|
1276
1280
|
entryData: ENTRY,
|
|
1277
1281
|
config: CONFIG,
|
|
@@ -1311,7 +1315,7 @@ describe('components.CollectionSummary.SummaryCard', () => {
|
|
|
1311
1315
|
};
|
|
1312
1316
|
const {
|
|
1313
1317
|
container
|
|
1314
|
-
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/
|
|
1318
|
+
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_SummaryCard.default, {
|
|
1315
1319
|
id: ID,
|
|
1316
1320
|
entryData: _objectSpread(_objectSpread({}, ENTRY), {}, {
|
|
1317
1321
|
field: true
|
|
@@ -1339,7 +1343,7 @@ describe('components.CollectionSummary.SummaryCard', () => {
|
|
|
1339
1343
|
};
|
|
1340
1344
|
const {
|
|
1341
1345
|
container
|
|
1342
|
-
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/
|
|
1346
|
+
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_SummaryCard.default, {
|
|
1343
1347
|
id: ID,
|
|
1344
1348
|
entryData: ENTRY,
|
|
1345
1349
|
config: CONFIG,
|
|
@@ -1369,7 +1373,7 @@ describe('components.CollectionSummary.SummaryCard', () => {
|
|
|
1369
1373
|
};
|
|
1370
1374
|
const {
|
|
1371
1375
|
container
|
|
1372
|
-
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/
|
|
1376
|
+
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_SummaryCard.default, {
|
|
1373
1377
|
id: ID,
|
|
1374
1378
|
entryData: INTERPOLATED_ENTRY,
|
|
1375
1379
|
config: CONFIG,
|
|
@@ -1393,7 +1397,7 @@ describe('components.CollectionSummary.SummaryCard', () => {
|
|
|
1393
1397
|
};
|
|
1394
1398
|
const {
|
|
1395
1399
|
container
|
|
1396
|
-
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/
|
|
1400
|
+
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_SummaryCard.default, {
|
|
1397
1401
|
id: ID,
|
|
1398
1402
|
entryData: ENTRY,
|
|
1399
1403
|
config: CONFIG,
|
|
@@ -1418,7 +1422,7 @@ describe('components.CollectionSummary.SummaryCard', () => {
|
|
|
1418
1422
|
};
|
|
1419
1423
|
const {
|
|
1420
1424
|
container
|
|
1421
|
-
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/
|
|
1425
|
+
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_SummaryCard.default, {
|
|
1422
1426
|
id: ID,
|
|
1423
1427
|
entryData: ENTRY,
|
|
1424
1428
|
config: CONFIG,
|
|
@@ -9,6 +9,7 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
9
9
|
var _copReactComponents = require("@ukhomeoffice/cop-react-components");
|
|
10
10
|
var _SummaryCard = require("./SummaryCard");
|
|
11
11
|
var _utils = _interopRequireDefault(require("../../utils"));
|
|
12
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
13
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
14
|
const actionShape = exports.actionShape = {
|
|
14
15
|
label: _propTypes.default.string,
|
|
@@ -28,26 +29,29 @@ const SummaryCardButtons = _ref => {
|
|
|
28
29
|
autoFocus
|
|
29
30
|
} = _ref;
|
|
30
31
|
if (!Array.isArray(actions)) {
|
|
31
|
-
return /*#__PURE__*/
|
|
32
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_copReactComponents.Button, {
|
|
32
33
|
id: id,
|
|
33
34
|
"data-testid": testId,
|
|
34
35
|
onClick: () => onFullEdit(actions === null || actions === void 0 ? void 0 : actions.page, entryData.id),
|
|
35
36
|
classModifiers: (actions === null || actions === void 0 ? void 0 : actions.classModifiers) || _SummaryCard.DEFAULT_CHANGE_BUTTON_CLASS,
|
|
36
37
|
"aria-label": _utils.default.FormPage.getConditionalText(actions === null || actions === void 0 ? void 0 : actions.aria_label, entryData),
|
|
37
38
|
name: name,
|
|
38
|
-
autoFocus: autoFocus
|
|
39
|
-
|
|
39
|
+
autoFocus: autoFocus,
|
|
40
|
+
children: (actions === null || actions === void 0 ? void 0 : actions.label) || _SummaryCard.DEFAULT_CHANGE_BUTTON_LABEL
|
|
41
|
+
});
|
|
40
42
|
}
|
|
41
|
-
return /*#__PURE__*/
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
43
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
44
|
+
children: actions.filter(a => _utils.default.Component.show(a, formData)).map(action => /*#__PURE__*/(0, _jsxRuntime.jsx)(_copReactComponents.Button, {
|
|
45
|
+
id: id,
|
|
46
|
+
"data-testid": testId,
|
|
47
|
+
onClick: () => onFullEdit(action === null || action === void 0 ? void 0 : action.page, entryData.id),
|
|
48
|
+
classModifiers: (action === null || action === void 0 ? void 0 : action.classModifiers) || _SummaryCard.DEFAULT_CHANGE_BUTTON_CLASS,
|
|
49
|
+
"aria-label": _utils.default.FormPage.getConditionalText(action === null || action === void 0 ? void 0 : action.aria_label, entryData),
|
|
50
|
+
name: name,
|
|
51
|
+
autoFocus: autoFocus,
|
|
52
|
+
children: (action === null || action === void 0 ? void 0 : action.label) || _SummaryCard.DEFAULT_CHANGE_BUTTON_LABEL
|
|
53
|
+
}, id))
|
|
54
|
+
});
|
|
51
55
|
};
|
|
52
56
|
exports.SummaryCardButtons = SummaryCardButtons;
|
|
53
57
|
SummaryCardButtons.propTypes = {
|
|
@@ -4,6 +4,7 @@ require("@testing-library/jest-dom/extend-expect");
|
|
|
4
4
|
var _react = _interopRequireDefault(require("react"));
|
|
5
5
|
var _setupTests = require("../../setupTests");
|
|
6
6
|
var _SummaryCardButtons = require("./SummaryCardButtons");
|
|
7
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
7
8
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
8
9
|
// Global imports.
|
|
9
10
|
|
|
@@ -31,7 +32,7 @@ describe('components.CollectionSummary.SummaryCardButtons', () => {
|
|
|
31
32
|
};
|
|
32
33
|
const {
|
|
33
34
|
container
|
|
34
|
-
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/
|
|
35
|
+
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_SummaryCardButtons.SummaryCardButtons, {
|
|
35
36
|
id: "".concat(ID, ".changeButton"),
|
|
36
37
|
"data-testid": "change-button",
|
|
37
38
|
actions: CONFIG.changeAction,
|
|
@@ -68,7 +69,7 @@ describe('components.CollectionSummary.SummaryCardButtons', () => {
|
|
|
68
69
|
};
|
|
69
70
|
const {
|
|
70
71
|
container
|
|
71
|
-
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/
|
|
72
|
+
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_SummaryCardButtons.SummaryCardButtons, {
|
|
72
73
|
id: "".concat(ID, ".changeButton"),
|
|
73
74
|
"data-testid": "change-button",
|
|
74
75
|
actions: CONFIG.changeAction,
|