@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
|
@@ -8,6 +8,7 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
8
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
9
|
var _VisuallyHidden = _interopRequireDefault(require("@ukhomeoffice/cop-react-components/dist/VisuallyHidden"));
|
|
10
10
|
var _FormComponent = _interopRequireDefault(require("../FormComponent"));
|
|
11
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
12
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
13
|
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
14
|
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; }
|
|
@@ -24,12 +25,14 @@ const Answer = _ref => {
|
|
|
24
25
|
} = _ref;
|
|
25
26
|
if (!value) {
|
|
26
27
|
const placeholderValue = Object.prototype.hasOwnProperty.call(component || {}, 'cyaPlaceholder') ? component === null || component === void 0 ? void 0 : component.cyaPlaceholder : placeholder;
|
|
27
|
-
return placeholderValue || /*#__PURE__*/
|
|
28
|
+
return placeholderValue || /*#__PURE__*/(0, _jsxRuntime.jsx)(_VisuallyHidden.default, {
|
|
29
|
+
children: "No answer"
|
|
30
|
+
});
|
|
28
31
|
}
|
|
29
32
|
if (!component) {
|
|
30
33
|
return Object.prototype.hasOwnProperty.call(value, 'label') ? value.label : value;
|
|
31
34
|
}
|
|
32
|
-
return /*#__PURE__*/
|
|
35
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_FormComponent.default, {
|
|
33
36
|
component: _objectSpread(_objectSpread({}, component), {}, {
|
|
34
37
|
readonly: true
|
|
35
38
|
}),
|
|
@@ -4,6 +4,7 @@ var _Readonly = require("@ukhomeoffice/cop-react-components/dist/Readonly");
|
|
|
4
4
|
var _react = _interopRequireDefault(require("react"));
|
|
5
5
|
var _setupTests = require("../../setupTests");
|
|
6
6
|
var _Answer = _interopRequireDefault(require("./Answer"));
|
|
7
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
7
8
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
8
9
|
/* eslint-disable no-template-curly-in-string */
|
|
9
10
|
// Global imports
|
|
@@ -17,7 +18,7 @@ describe('components', () => {
|
|
|
17
18
|
const COMPONENT = null;
|
|
18
19
|
const {
|
|
19
20
|
container
|
|
20
|
-
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/
|
|
21
|
+
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_Answer.default, {
|
|
21
22
|
value: VALUE,
|
|
22
23
|
component: COMPONENT
|
|
23
24
|
}));
|
|
@@ -29,7 +30,7 @@ describe('components', () => {
|
|
|
29
30
|
const COMPONENT = null;
|
|
30
31
|
const {
|
|
31
32
|
container
|
|
32
|
-
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/
|
|
33
|
+
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_Answer.default, {
|
|
33
34
|
value: VALUE,
|
|
34
35
|
component: COMPONENT
|
|
35
36
|
}));
|
|
@@ -45,7 +46,7 @@ describe('components', () => {
|
|
|
45
46
|
};
|
|
46
47
|
const {
|
|
47
48
|
container
|
|
48
|
-
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/
|
|
49
|
+
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_Answer.default, {
|
|
49
50
|
value: VALUE,
|
|
50
51
|
component: COMPONENT
|
|
51
52
|
}));
|
|
@@ -65,7 +66,7 @@ describe('components', () => {
|
|
|
65
66
|
};
|
|
66
67
|
const {
|
|
67
68
|
container
|
|
68
|
-
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/
|
|
69
|
+
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_Answer.default, {
|
|
69
70
|
value: VALUE,
|
|
70
71
|
component: COMPONENT,
|
|
71
72
|
placeholder: PLACEHOLDER
|
|
@@ -85,7 +86,7 @@ describe('components', () => {
|
|
|
85
86
|
};
|
|
86
87
|
const {
|
|
87
88
|
container
|
|
88
|
-
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/
|
|
89
|
+
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_Answer.default, {
|
|
89
90
|
value: VALUE,
|
|
90
91
|
component: COMPONENT,
|
|
91
92
|
placeholder: GLOBAL_PLACEHOLDER
|
|
@@ -101,7 +102,7 @@ describe('components', () => {
|
|
|
101
102
|
const COMPONENT = null;
|
|
102
103
|
const {
|
|
103
104
|
container
|
|
104
|
-
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/
|
|
105
|
+
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_Answer.default, {
|
|
105
106
|
value: VALUE,
|
|
106
107
|
component: COMPONENT
|
|
107
108
|
}));
|
|
@@ -128,7 +129,7 @@ describe('components', () => {
|
|
|
128
129
|
};
|
|
129
130
|
const {
|
|
130
131
|
container
|
|
131
|
-
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/
|
|
132
|
+
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_Answer.default, {
|
|
132
133
|
value: VALUE,
|
|
133
134
|
component: COMPONENT,
|
|
134
135
|
formData: DATA
|
|
@@ -16,9 +16,9 @@ var _PageActions = _interopRequireDefault(require("../PageActions"));
|
|
|
16
16
|
var _SummaryList = _interopRequireDefault(require("../SummaryList"));
|
|
17
17
|
var _Answer = _interopRequireDefault(require("./Answer"));
|
|
18
18
|
require("./CheckYourAnswers.scss");
|
|
19
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
19
20
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
20
|
-
function
|
|
21
|
-
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; }
|
|
21
|
+
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); }
|
|
22
22
|
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; }
|
|
23
23
|
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; }
|
|
24
24
|
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; }
|
|
@@ -60,13 +60,12 @@ const CheckYourAnswers = _ref => {
|
|
|
60
60
|
const getRows = (page, pageIndex) => {
|
|
61
61
|
const rows = _utils.default.CheckYourAnswers.getRows(page, onRowAction, hooks.onGetCYARows);
|
|
62
62
|
return rows.map((row, index) => _objectSpread(_objectSpread({}, row), {}, {
|
|
63
|
-
value: /*#__PURE__*/
|
|
64
|
-
key: "".concat(pageIndex, "_").concat(index),
|
|
63
|
+
value: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Answer.default, {
|
|
65
64
|
value: row.value,
|
|
66
65
|
component: row.component,
|
|
67
66
|
formData: page.formData,
|
|
68
67
|
placeholder: optionalFieldPlaceholder
|
|
69
|
-
})
|
|
68
|
+
}, "".concat(pageIndex, "_").concat(index))
|
|
70
69
|
}));
|
|
71
70
|
};
|
|
72
71
|
const pagesWithMergedCollections = _utils.default.CollectionPage.mergePages(_pages);
|
|
@@ -112,73 +111,92 @@ const CheckYourAnswers = _ref => {
|
|
|
112
111
|
const getPageHeading = (page, size) => {
|
|
113
112
|
var _page$cya_link;
|
|
114
113
|
if (!((_page$cya_link = page.cya_link) !== null && _page$cya_link !== void 0 && _page$cya_link.singleChangeLink) || noChangeAction) {
|
|
115
|
-
return /*#__PURE__*/
|
|
114
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
115
|
+
children: [size === 's' && /*#__PURE__*/(0, _jsxRuntime.jsx)(_copReactComponents.SmallHeading, {
|
|
116
|
+
children: _utils.default.FormPage.getTitle(page.title, page.formData)
|
|
117
|
+
}), size === 'm' && /*#__PURE__*/(0, _jsxRuntime.jsx)(_copReactComponents.MediumHeading, {
|
|
118
|
+
children: _utils.default.FormPage.getTitle(page.title, page.formData)
|
|
119
|
+
})]
|
|
120
|
+
});
|
|
116
121
|
}
|
|
117
122
|
const headingAction = (0, _getCYAAction.default)(false, page, onRowAction);
|
|
118
|
-
return /*#__PURE__*/
|
|
119
|
-
className: "heading-with-action"
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
}
|
|
128
|
-
|
|
123
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
124
|
+
className: "heading-with-action",
|
|
125
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
126
|
+
className: "heading-text",
|
|
127
|
+
children: [size === 's' && /*#__PURE__*/(0, _jsxRuntime.jsx)(_copReactComponents.SmallHeading, {
|
|
128
|
+
children: _utils.default.FormPage.getTitle(page.title, page.formData)
|
|
129
|
+
}), size === 'm' && /*#__PURE__*/(0, _jsxRuntime.jsx)(_copReactComponents.MediumHeading, {
|
|
130
|
+
children: _utils.default.FormPage.getTitle(page.title, page.formData)
|
|
131
|
+
})]
|
|
132
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
133
|
+
className: "heading-action",
|
|
134
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_RowAction.default, {
|
|
135
|
+
row: {
|
|
136
|
+
action: headingAction
|
|
137
|
+
}
|
|
138
|
+
})
|
|
139
|
+
})]
|
|
140
|
+
});
|
|
129
141
|
};
|
|
130
|
-
return /*#__PURE__*/
|
|
131
|
-
className: DEFAULT_CLASS
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
142
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
143
|
+
className: DEFAULT_CLASS,
|
|
144
|
+
children: [title && !hide_title && /*#__PURE__*/(0, _jsxRuntime.jsx)(_copReactComponents.LargeHeading, {
|
|
145
|
+
children: title
|
|
146
|
+
}, 'heading'), errors && errors.length > 0 && /*#__PURE__*/(0, _jsxRuntime.jsx)(_copReactComponents.ErrorSummary, {
|
|
147
|
+
errors: errors
|
|
148
|
+
}), type === _models.FormTypes.TASK_CYA && pages.length > 0 && sections && sections.map(section => section.tasks.filter(task => task.state !== _models.TaskStates.TYPES.SKIPPED).map((task, taskIndex) => {
|
|
149
|
+
const filterPages = pages.filter(page => task.pages.some(p => p === page.name));
|
|
150
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_react.Fragment, {
|
|
151
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_copReactComponents.MediumHeading, {
|
|
152
|
+
children: filterPages.length > 0 && (task.displayName || task.name)
|
|
153
|
+
}), filterPages.map((page, pageIndex) => {
|
|
154
|
+
const hideActionButtons = isGroup(page.id) || noChangeAction;
|
|
155
|
+
const showHeading = !hide_page_titles && page.title && !isGroup(page.id);
|
|
156
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_react.Fragment, {
|
|
157
|
+
children: [showHeading && getPageHeading(page, 's'), /*#__PURE__*/(0, _jsxRuntime.jsx)(_SummaryList.default, {
|
|
158
|
+
rows: page.rows,
|
|
159
|
+
classModifiers: summaryListClassModifiers,
|
|
160
|
+
noChangeAction: hideActionButtons,
|
|
161
|
+
noGroupAction: noGroupAction,
|
|
162
|
+
isGroup: isGroup(page.id)
|
|
163
|
+
})]
|
|
164
|
+
}, pageIndex);
|
|
165
|
+
})]
|
|
166
|
+
}, taskIndex);
|
|
167
|
+
})), type !== _models.FormTypes.TASK_CYA && pages && pages.map((page, pageIndex, array) => {
|
|
168
|
+
const filteredRows = !hideBlankRows || page.collection ? page.rows : page.rows.filter(row => {
|
|
169
|
+
var _row$value;
|
|
170
|
+
return row === null || row === void 0 || (_row$value = row.value) === null || _row$value === void 0 || (_row$value = _row$value.props) === null || _row$value === void 0 ? void 0 : _row$value.value;
|
|
171
|
+
});
|
|
172
|
+
if (filteredRows.length === 0) {
|
|
173
|
+
return null;
|
|
174
|
+
}
|
|
175
|
+
const showPageTitle = !hide_page_titles && page.title && !isGroup(page.id);
|
|
176
|
+
const pageMarginBottom = isLastPage(pageIndex) || isGroup(array[pageIndex].id) || array.length > pageIndex + 1 && isGroup(array[pageIndex + 1].id) ? DEFAULT_MARGIN_BOTTOM : listMarginBottom;
|
|
177
|
+
const currentGroup = isGroup(page.id) ? getGroupForPage(page.id) : undefined;
|
|
178
|
+
const className = "govuk-!-margin-bottom-".concat(pageMarginBottom);
|
|
141
179
|
const hideActionButtons = isGroup(page.id) || noChangeAction;
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
})
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
const pageMarginBottom = isLastPage(pageIndex) || isGroup(array[pageIndex].id) || array.length > pageIndex + 1 && isGroup(array[pageIndex + 1].id) ? DEFAULT_MARGIN_BOTTOM : listMarginBottom;
|
|
163
|
-
const currentGroup = isGroup(page.id) ? getGroupForPage(page.id) : undefined;
|
|
164
|
-
const className = "govuk-!-margin-bottom-".concat(pageMarginBottom);
|
|
165
|
-
const hideActionButtons = isGroup(page.id) || noChangeAction;
|
|
166
|
-
return /*#__PURE__*/_react.default.createElement(_react.Fragment, {
|
|
167
|
-
key: pageIndex
|
|
168
|
-
}, showPageTitle && getPageHeading(page, 'm'), currentGroup && /*#__PURE__*/_react.default.createElement("div", {
|
|
169
|
-
className: "group-title"
|
|
170
|
-
}, /*#__PURE__*/_react.default.createElement(_copReactComponents.MediumHeading, null, currentGroup.title || _utils.default.FormPage.getTitle(page.title, page.formData))), /*#__PURE__*/_react.default.createElement(_SummaryList.default, {
|
|
171
|
-
className: className,
|
|
172
|
-
rows: filteredRows,
|
|
173
|
-
classModifiers: summaryListClassModifiers,
|
|
174
|
-
noChangeAction: hideActionButtons,
|
|
175
|
-
noGroupAction: noGroupAction,
|
|
176
|
-
isGroup: isGroup(page.id)
|
|
177
|
-
}));
|
|
178
|
-
}), !hide_actions && /*#__PURE__*/_react.default.createElement(_PageActions.default, {
|
|
179
|
-
actions: actions === null || actions === void 0 ? void 0 : actions.filter(action => _utils.default.Component.show(action, _pages[_pages.length - 1].formData)),
|
|
180
|
-
onAction: action => onAction(action)
|
|
181
|
-
}));
|
|
180
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_react.Fragment, {
|
|
181
|
+
children: [showPageTitle && getPageHeading(page, 'm'), currentGroup && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
182
|
+
className: "group-title",
|
|
183
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_copReactComponents.MediumHeading, {
|
|
184
|
+
children: currentGroup.title || _utils.default.FormPage.getTitle(page.title, page.formData)
|
|
185
|
+
})
|
|
186
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_SummaryList.default, {
|
|
187
|
+
className: className,
|
|
188
|
+
rows: filteredRows,
|
|
189
|
+
classModifiers: summaryListClassModifiers,
|
|
190
|
+
noChangeAction: hideActionButtons,
|
|
191
|
+
noGroupAction: noGroupAction,
|
|
192
|
+
isGroup: isGroup(page.id)
|
|
193
|
+
})]
|
|
194
|
+
}, pageIndex);
|
|
195
|
+
}), !hide_actions && /*#__PURE__*/(0, _jsxRuntime.jsx)(_PageActions.default, {
|
|
196
|
+
actions: actions === null || actions === void 0 ? void 0 : actions.filter(action => _utils.default.Component.show(action, _pages[_pages.length - 1].formData)),
|
|
197
|
+
onAction: action => onAction(action)
|
|
198
|
+
})]
|
|
199
|
+
});
|
|
182
200
|
};
|
|
183
201
|
CheckYourAnswers.propTypes = {
|
|
184
202
|
actions: _propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.object, _propTypes.default.string])),
|
|
@@ -19,8 +19,8 @@ var _models = require("../../models");
|
|
|
19
19
|
var _setupTests = require("../../setupTests");
|
|
20
20
|
var _utils = _interopRequireDefault(require("../../utils"));
|
|
21
21
|
var _CheckYourAnswers = _interopRequireWildcard(require("./CheckYourAnswers"));
|
|
22
|
-
|
|
23
|
-
function _interopRequireWildcard(e, r) { if (!
|
|
22
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
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
25
|
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; }
|
|
26
26
|
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; }
|
|
@@ -79,7 +79,7 @@ describe('components', () => {
|
|
|
79
79
|
};
|
|
80
80
|
it('should show default title if none is provided', async () => {
|
|
81
81
|
await (0, _testUtils.act)(async () => {
|
|
82
|
-
(0, _setupTests.renderDomWithValidation)(/*#__PURE__*/
|
|
82
|
+
(0, _setupTests.renderDomWithValidation)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_CheckYourAnswers.default, {
|
|
83
83
|
pages: PAGES,
|
|
84
84
|
onRowAction: ON_ROW_ACTION,
|
|
85
85
|
onAction: ON_ACTION
|
|
@@ -93,7 +93,7 @@ describe('components', () => {
|
|
|
93
93
|
it('should allow title to be overridden', async () => {
|
|
94
94
|
const TITLE = 'Alpha Bravo Charlie';
|
|
95
95
|
await (0, _testUtils.act)(async () => {
|
|
96
|
-
(0, _setupTests.renderDomWithValidation)(/*#__PURE__*/
|
|
96
|
+
(0, _setupTests.renderDomWithValidation)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_CheckYourAnswers.default, {
|
|
97
97
|
title: TITLE,
|
|
98
98
|
pages: PAGES,
|
|
99
99
|
onRowAction: ON_ROW_ACTION,
|
|
@@ -107,7 +107,7 @@ describe('components', () => {
|
|
|
107
107
|
});
|
|
108
108
|
it('should show readonly page components correctly', async () => {
|
|
109
109
|
await (0, _testUtils.act)(async () => {
|
|
110
|
-
(0, _setupTests.renderDomWithValidation)(/*#__PURE__*/
|
|
110
|
+
(0, _setupTests.renderDomWithValidation)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_CheckYourAnswers.default, {
|
|
111
111
|
pages: PAGES,
|
|
112
112
|
onRowAction: ON_ROW_ACTION,
|
|
113
113
|
onAction: ON_ACTION
|
|
@@ -124,7 +124,7 @@ describe('components', () => {
|
|
|
124
124
|
});
|
|
125
125
|
it('should show editable page components correctly', async () => {
|
|
126
126
|
await (0, _testUtils.act)(async () => {
|
|
127
|
-
(0, _setupTests.renderDomWithValidation)(/*#__PURE__*/
|
|
127
|
+
(0, _setupTests.renderDomWithValidation)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_CheckYourAnswers.default, {
|
|
128
128
|
pages: PAGES,
|
|
129
129
|
onRowAction: ON_ROW_ACTION,
|
|
130
130
|
onAction: ON_ACTION
|
|
@@ -141,7 +141,7 @@ describe('components', () => {
|
|
|
141
141
|
});
|
|
142
142
|
it('should show editable page components correctly with page titles hidden', async () => {
|
|
143
143
|
await (0, _testUtils.act)(async () => {
|
|
144
|
-
(0, _setupTests.renderDomWithValidation)(/*#__PURE__*/
|
|
144
|
+
(0, _setupTests.renderDomWithValidation)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_CheckYourAnswers.default, {
|
|
145
145
|
pages: PAGES,
|
|
146
146
|
onRowAction: ON_ROW_ACTION,
|
|
147
147
|
onAction: ON_ACTION,
|
|
@@ -165,7 +165,7 @@ describe('components', () => {
|
|
|
165
165
|
}
|
|
166
166
|
}));
|
|
167
167
|
await (0, _testUtils.act)(async () => {
|
|
168
|
-
(0, _setupTests.renderDomWithValidation)(/*#__PURE__*/
|
|
168
|
+
(0, _setupTests.renderDomWithValidation)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_CheckYourAnswers.default, {
|
|
169
169
|
pages: CUSTOM_PAGES,
|
|
170
170
|
onRowAction: ON_ROW_ACTION,
|
|
171
171
|
onAction: ON_ACTION
|
|
@@ -205,7 +205,7 @@ describe('components', () => {
|
|
|
205
205
|
}]
|
|
206
206
|
}];
|
|
207
207
|
await (0, _testUtils.act)(async () => {
|
|
208
|
-
(0, _setupTests.renderDomWithValidation)(/*#__PURE__*/
|
|
208
|
+
(0, _setupTests.renderDomWithValidation)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_CheckYourAnswers.default, {
|
|
209
209
|
pages: CUSTOM_PAGES,
|
|
210
210
|
onRowAction: ON_ROW_ACTION,
|
|
211
211
|
onAction: ON_ACTION,
|
|
@@ -237,7 +237,7 @@ describe('components', () => {
|
|
|
237
237
|
});
|
|
238
238
|
it('should show no title if is set to hidden', async () => {
|
|
239
239
|
await (0, _testUtils.act)(async () => {
|
|
240
|
-
(0, _setupTests.renderDomWithValidation)(/*#__PURE__*/
|
|
240
|
+
(0, _setupTests.renderDomWithValidation)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_CheckYourAnswers.default, {
|
|
241
241
|
pages: PAGES,
|
|
242
242
|
onRowAction: ON_ROW_ACTION,
|
|
243
243
|
onAction: ON_ACTION,
|
|
@@ -267,7 +267,7 @@ describe('components', () => {
|
|
|
267
267
|
}]
|
|
268
268
|
}];
|
|
269
269
|
await (0, _testUtils.act)(async () => {
|
|
270
|
-
(0, _setupTests.renderDomWithValidation)(/*#__PURE__*/
|
|
270
|
+
(0, _setupTests.renderDomWithValidation)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_CheckYourAnswers.default, {
|
|
271
271
|
pages: PAGES,
|
|
272
272
|
onRowAction: ON_ROW_ACTION,
|
|
273
273
|
onAction: ON_ACTION,
|
|
@@ -309,7 +309,7 @@ describe('components', () => {
|
|
|
309
309
|
}]
|
|
310
310
|
}];
|
|
311
311
|
await (0, _testUtils.act)(async () => {
|
|
312
|
-
(0, _setupTests.renderDomWithValidation)(/*#__PURE__*/
|
|
312
|
+
(0, _setupTests.renderDomWithValidation)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_CheckYourAnswers.default, {
|
|
313
313
|
pages: PAGES,
|
|
314
314
|
onRowAction: ON_ROW_ACTION,
|
|
315
315
|
onAction: ON_ACTION,
|
|
@@ -339,7 +339,7 @@ describe('components', () => {
|
|
|
339
339
|
}]
|
|
340
340
|
}];
|
|
341
341
|
await (0, _testUtils.act)(async () => {
|
|
342
|
-
(0, _setupTests.renderDomWithValidation)(/*#__PURE__*/
|
|
342
|
+
(0, _setupTests.renderDomWithValidation)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_CheckYourAnswers.default, {
|
|
343
343
|
pages: PAGES,
|
|
344
344
|
onRowAction: ON_ROW_ACTION,
|
|
345
345
|
onAction: ON_ACTION,
|
|
@@ -357,7 +357,7 @@ describe('components', () => {
|
|
|
357
357
|
const ADDRESS_DATA = _utils.default.Data.setupForm(_group.default.pages, _group.default.components, _groupData.default);
|
|
358
358
|
const GROUP_PAGES = _utils.default.FormPage.getAll(_group.default.pages, _group.default.components, _objectSpread({}, ADDRESS_DATA));
|
|
359
359
|
await (0, _testUtils.act)(async () => {
|
|
360
|
-
(0, _setupTests.renderDomWithValidation)(/*#__PURE__*/
|
|
360
|
+
(0, _setupTests.renderDomWithValidation)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_CheckYourAnswers.default, {
|
|
361
361
|
pages: GROUP_PAGES,
|
|
362
362
|
onRowAction: ON_ROW_ACTION,
|
|
363
363
|
onAction: ON_ACTION,
|
|
@@ -385,7 +385,7 @@ describe('components', () => {
|
|
|
385
385
|
it('should render a group with one action button', async () => {
|
|
386
386
|
const GROUP_PAGES = _utils.default.FormPage.getAll(_groupOfRow.default.pages, _groupOfRow.default.components, _objectSpread({}, DATA));
|
|
387
387
|
await (0, _testUtils.act)(async () => {
|
|
388
|
-
(0, _setupTests.renderDomWithValidation)(/*#__PURE__*/
|
|
388
|
+
(0, _setupTests.renderDomWithValidation)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_CheckYourAnswers.default, {
|
|
389
389
|
pages: GROUP_PAGES,
|
|
390
390
|
onRowAction: ON_ROW_ACTION,
|
|
391
391
|
onAction: ON_ACTION,
|
|
@@ -415,7 +415,7 @@ describe('components', () => {
|
|
|
415
415
|
it('should show a conditional button', async () => {
|
|
416
416
|
const GROUP_PAGES = _utils.default.FormPage.getAll(_groupOfRow.default.pages, _groupOfRow.default.components, _objectSpread({}, DATA));
|
|
417
417
|
await (0, _testUtils.act)(async () => {
|
|
418
|
-
(0, _setupTests.renderDomWithValidation)(/*#__PURE__*/
|
|
418
|
+
(0, _setupTests.renderDomWithValidation)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_CheckYourAnswers.default, {
|
|
419
419
|
pages: GROUP_PAGES,
|
|
420
420
|
onRowAction: ON_ROW_ACTION,
|
|
421
421
|
onAction: ON_ACTION,
|
|
@@ -436,7 +436,7 @@ describe('components', () => {
|
|
|
436
436
|
it('should not show a conditional button', async () => {
|
|
437
437
|
const GROUP_PAGES = _utils.default.FormPage.getAll(_groupOfRow.default.pages, _groupOfRow.default.components, _objectSpread({}, DATA));
|
|
438
438
|
await (0, _testUtils.act)(async () => {
|
|
439
|
-
(0, _setupTests.renderDomWithValidation)(/*#__PURE__*/
|
|
439
|
+
(0, _setupTests.renderDomWithValidation)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_CheckYourAnswers.default, {
|
|
440
440
|
pages: GROUP_PAGES,
|
|
441
441
|
onRowAction: ON_ROW_ACTION,
|
|
442
442
|
onAction: ON_ACTION,
|
|
@@ -456,7 +456,7 @@ describe('components', () => {
|
|
|
456
456
|
it('should render empty optional fields with a placeholder value when provided', async () => {
|
|
457
457
|
const GROUP_PAGES = _utils.default.FormPage.getAll(_groupOfRow.default.pages, _groupOfRow.default.components, {});
|
|
458
458
|
await (0, _testUtils.act)(async () => {
|
|
459
|
-
(0, _setupTests.renderDomWithValidation)(/*#__PURE__*/
|
|
459
|
+
(0, _setupTests.renderDomWithValidation)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_CheckYourAnswers.default, {
|
|
460
460
|
pages: GROUP_PAGES,
|
|
461
461
|
groups: _groupOfRow.default.cya.groups,
|
|
462
462
|
optionalFieldPlaceholder: "Not entered"
|
|
@@ -492,7 +492,7 @@ describe('components', () => {
|
|
|
492
492
|
});
|
|
493
493
|
const T_PAGES = _utils.default.FormPage.getAll(_PAGES, _COMPONENTS, DATA);
|
|
494
494
|
await (0, _testUtils.act)(async () => {
|
|
495
|
-
(0, _setupTests.renderDomWithValidation)(/*#__PURE__*/
|
|
495
|
+
(0, _setupTests.renderDomWithValidation)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_CheckYourAnswers.default, {
|
|
496
496
|
pages: T_PAGES,
|
|
497
497
|
onRowAction: ON_ROW_ACTION,
|
|
498
498
|
onAction: ON_ACTION
|
|
@@ -519,7 +519,7 @@ describe('components', () => {
|
|
|
519
519
|
});
|
|
520
520
|
const T_PAGES = _utils.default.FormPage.getAll(_PAGES, _COMPONENTS, _objectSpread({}, DATA));
|
|
521
521
|
await (0, _testUtils.act)(async () => {
|
|
522
|
-
(0, _setupTests.renderDomWithValidation)(/*#__PURE__*/
|
|
522
|
+
(0, _setupTests.renderDomWithValidation)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_CheckYourAnswers.default, {
|
|
523
523
|
pages: T_PAGES,
|
|
524
524
|
onRowAction: ON_ROW_ACTION,
|
|
525
525
|
onAction: ON_ACTION
|
|
@@ -549,7 +549,7 @@ describe('components', () => {
|
|
|
549
549
|
}]
|
|
550
550
|
}];
|
|
551
551
|
await (0, _testUtils.act)(async () => {
|
|
552
|
-
(0, _setupTests.renderDomWithValidation)(/*#__PURE__*/
|
|
552
|
+
(0, _setupTests.renderDomWithValidation)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_CheckYourAnswers.default, {
|
|
553
553
|
pages: PAGES,
|
|
554
554
|
onRowAction: ON_ROW_ACTION,
|
|
555
555
|
onAction: ON_ACTION,
|
|
@@ -572,7 +572,7 @@ describe('components', () => {
|
|
|
572
572
|
const ADDRESS_DATA = _utils.default.Data.setupForm(_group.default.pages, _group.default.components, _groupData.default);
|
|
573
573
|
const GROUP_PAGES = _utils.default.FormPage.getAll(_group.default.pages, _group.default.components, _objectSpread({}, ADDRESS_DATA));
|
|
574
574
|
await (0, _testUtils.act)(async () => {
|
|
575
|
-
(0, _setupTests.renderDomWithValidation)(/*#__PURE__*/
|
|
575
|
+
(0, _setupTests.renderDomWithValidation)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_CheckYourAnswers.default, {
|
|
576
576
|
pages: GROUP_PAGES,
|
|
577
577
|
onRowAction: ON_ROW_ACTION,
|
|
578
578
|
onAction: ON_ACTION,
|
|
@@ -11,8 +11,8 @@ var _utils = _interopRequireDefault(require("../../utils"));
|
|
|
11
11
|
var _FormPage = _interopRequireDefault(require("../FormPage"));
|
|
12
12
|
var _FormPage2 = require("../FormPage/FormPage");
|
|
13
13
|
require("../FormPage/FormPage.scss");
|
|
14
|
-
|
|
15
|
-
function _interopRequireWildcard(e, r) { if (!
|
|
14
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
15
|
+
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); }
|
|
16
16
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
17
17
|
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; }
|
|
18
18
|
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; }
|
|
@@ -124,7 +124,7 @@ const CollectionPage = _ref => {
|
|
|
124
124
|
if ((_page$collection = page.collection) !== null && _page$collection !== void 0 && _page$collection.waitForFormData && page.formData && Object.keys(page.formData).length === 0) {
|
|
125
125
|
return null;
|
|
126
126
|
}
|
|
127
|
-
return /*#__PURE__*/
|
|
127
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_FormPage.default, {
|
|
128
128
|
page: _objectSpread(_objectSpread({}, page), {}, {
|
|
129
129
|
formData: _objectSpread(_objectSpread(_objectSpread({}, page.formData), data[activeIndex]), {}, {
|
|
130
130
|
["".concat(currentCollectionName, "ActiveIndex")]: activeIndex,
|
|
@@ -7,8 +7,8 @@ var _setupTests = require("../../setupTests");
|
|
|
7
7
|
var _utils = _interopRequireDefault(require("../../utils"));
|
|
8
8
|
var _ActionButton = require("../PageActions/ActionButton");
|
|
9
9
|
var _CollectionPage = _interopRequireWildcard(require("./CollectionPage"));
|
|
10
|
-
|
|
11
|
-
function _interopRequireWildcard(e, r) { if (!
|
|
10
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
|
+
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); }
|
|
12
12
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
13
|
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; }
|
|
14
14
|
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; }
|
|
@@ -183,7 +183,7 @@ describe('components.CollectionPage', () => {
|
|
|
183
183
|
expect(outerWrapper.classList).toContain('hods-autocomplete__outer-wrapper');
|
|
184
184
|
const autocomplete = outerWrapper.childNodes[0];
|
|
185
185
|
expect(autocomplete.classList).toContain('hods-autocomplete__wrapper');
|
|
186
|
-
const input =
|
|
186
|
+
const input = autocomplete.querySelector('input');
|
|
187
187
|
expect(input.classList).toContain('hods-autocomplete__input');
|
|
188
188
|
expect(input.tagName).toEqual('INPUT');
|
|
189
189
|
expect(input.id).toEqual(fieldId);
|
|
@@ -224,7 +224,7 @@ describe('components.CollectionPage', () => {
|
|
|
224
224
|
it('should render a submit page correctly', async () => {
|
|
225
225
|
const {
|
|
226
226
|
container
|
|
227
|
-
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/
|
|
227
|
+
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_CollectionPage.default, {
|
|
228
228
|
page: PAGE,
|
|
229
229
|
onAction: ON_ACTION
|
|
230
230
|
}));
|
|
@@ -240,7 +240,7 @@ describe('components.CollectionPage', () => {
|
|
|
240
240
|
it('should render nothing when there is no formData and page.collection.waitForFormData is true', async () => {
|
|
241
241
|
const {
|
|
242
242
|
container
|
|
243
|
-
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/
|
|
243
|
+
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_CollectionPage.default, {
|
|
244
244
|
page: _objectSpread(_objectSpread({}, PAGE), {}, {
|
|
245
245
|
collection: _objectSpread(_objectSpread({}, PAGE.collection), {}, {
|
|
246
246
|
waitForFormData: true
|
|
@@ -254,7 +254,7 @@ describe('components.CollectionPage', () => {
|
|
|
254
254
|
it('should render a submit page correctly and submit action button has interpolated label', async () => {
|
|
255
255
|
const {
|
|
256
256
|
container
|
|
257
|
-
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/
|
|
257
|
+
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_CollectionPage.default, {
|
|
258
258
|
page: PAGE_WITH_BUTTON_ACTIONS,
|
|
259
259
|
onAction: ON_ACTION
|
|
260
260
|
}));
|
|
@@ -272,7 +272,7 @@ describe('components.CollectionPage', () => {
|
|
|
272
272
|
it('should render only the conditionally shown button', async () => {
|
|
273
273
|
const {
|
|
274
274
|
container
|
|
275
|
-
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/
|
|
275
|
+
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_CollectionPage.default, {
|
|
276
276
|
page: PAGE_WITH_CONDITIONAL_BUTTONS,
|
|
277
277
|
onAction: ON_ACTION
|
|
278
278
|
}));
|
|
@@ -283,7 +283,7 @@ describe('components.CollectionPage', () => {
|
|
|
283
283
|
it('should handle a page change appropriately', async () => {
|
|
284
284
|
const {
|
|
285
285
|
container
|
|
286
|
-
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/
|
|
286
|
+
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_CollectionPage.default, {
|
|
287
287
|
page: PAGE,
|
|
288
288
|
onAction: ON_ACTION
|
|
289
289
|
}));
|
|
@@ -307,7 +307,7 @@ describe('components.CollectionPage', () => {
|
|
|
307
307
|
it('should handle a page action appropriately, updating the active entry if there is one', async () => {
|
|
308
308
|
const {
|
|
309
309
|
container
|
|
310
|
-
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/
|
|
310
|
+
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_CollectionPage.default, {
|
|
311
311
|
page: PAGE,
|
|
312
312
|
onAction: ON_ACTION
|
|
313
313
|
}));
|
|
@@ -344,7 +344,7 @@ describe('components.CollectionPage', () => {
|
|
|
344
344
|
PAGE.formData["".concat(COLLECTION_NAME, "ActiveId")] = 'newId';
|
|
345
345
|
const {
|
|
346
346
|
container
|
|
347
|
-
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/
|
|
347
|
+
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_CollectionPage.default, {
|
|
348
348
|
page: PAGE,
|
|
349
349
|
onAction: ON_ACTION
|
|
350
350
|
}));
|
|
@@ -410,7 +410,7 @@ describe('components.CollectionPage', () => {
|
|
|
410
410
|
it('should handle a page change appropriately', async () => {
|
|
411
411
|
const {
|
|
412
412
|
container
|
|
413
|
-
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/
|
|
413
|
+
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_CollectionPage.default, {
|
|
414
414
|
page: NESTED_PAGE,
|
|
415
415
|
onAction: ON_ACTION
|
|
416
416
|
}));
|
|
@@ -434,7 +434,7 @@ describe('components.CollectionPage', () => {
|
|
|
434
434
|
it('should handle a page action appropriately, updating the active entry if there is one', async () => {
|
|
435
435
|
const {
|
|
436
436
|
container
|
|
437
|
-
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/
|
|
437
|
+
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_CollectionPage.default, {
|
|
438
438
|
page: NESTED_PAGE,
|
|
439
439
|
onAction: ON_ACTION
|
|
440
440
|
}));
|
|
@@ -474,7 +474,7 @@ describe('components.CollectionPage', () => {
|
|
|
474
474
|
NESTED_PAGE.formData.childActiveId = 'newId';
|
|
475
475
|
const {
|
|
476
476
|
container
|
|
477
|
-
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/
|
|
477
|
+
} = (0, _setupTests.renderWithValidation)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_CollectionPage.default, {
|
|
478
478
|
page: NESTED_PAGE,
|
|
479
479
|
onAction: ON_ACTION
|
|
480
480
|
}));
|