@ukhomeoffice/cop-react-form-renderer 5.74.3 → 5.74.4
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.
|
@@ -55,6 +55,7 @@ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input ==
|
|
|
55
55
|
* @returns Page suitble for rendering in a QuickEdit
|
|
56
56
|
*/
|
|
57
57
|
var getQuickEditPage = function getQuickEditPage(masterPage, formData, entryData) {
|
|
58
|
+
var _masterPage$collectio;
|
|
58
59
|
if (!masterPage) {
|
|
59
60
|
return null;
|
|
60
61
|
}
|
|
@@ -113,7 +114,7 @@ var getQuickEditPage = function getQuickEditPage(masterPage, formData, entryData
|
|
|
113
114
|
// Remove ID to stop overwriting top-level form ID.
|
|
114
115
|
var id = entryData.id,
|
|
115
116
|
entryWithNoId = _objectWithoutProperties(entryData, _excluded);
|
|
116
|
-
pageToReturn.formData = _objectSpread(_objectSpread({}, pageToReturn.formData), entryWithNoId);
|
|
117
|
+
pageToReturn.formData = _objectSpread(_objectSpread(_objectSpread({}, pageToReturn.formData), entryWithNoId), {}, _defineProperty({}, "".concat((_masterPage$collectio = masterPage.collection) === null || _masterPage$collectio === void 0 || (_masterPage$collectio = _masterPage$collectio.name) === null || _masterPage$collectio === void 0 ? void 0 : _masterPage$collectio.split('.').pop(), "ActiveId"), entryData.id));
|
|
117
118
|
delete pageToReturn.title;
|
|
118
119
|
delete pageToReturn.collection;
|
|
119
120
|
return pageToReturn;
|
|
@@ -19,6 +19,9 @@ describe('Utils.CollectionPage.getQuickEditPage', function () {
|
|
|
19
19
|
}]
|
|
20
20
|
};
|
|
21
21
|
var MASTER_PAGE = {
|
|
22
|
+
collection: {
|
|
23
|
+
name: 'entries'
|
|
24
|
+
},
|
|
22
25
|
childPages: [{
|
|
23
26
|
id: 'firstPage',
|
|
24
27
|
name: 'firstPage',
|
|
@@ -132,4 +135,9 @@ describe('Utils.CollectionPage.getQuickEditPage', function () {
|
|
|
132
135
|
var createdPage = (0, _getQuickEditPage.default)(MASTER_PAGE, FORM_DATA, CUSTOM_ENTRY_DATA);
|
|
133
136
|
expect(createdPage).toMatchObject(CUSTOM_OUTPUT);
|
|
134
137
|
});
|
|
138
|
+
it('should return a quick edit page with the activeId for the current collection correctly set', function () {
|
|
139
|
+
var createdPage = (0, _getQuickEditPage.default)(MASTER_PAGE, FORM_DATA, ENTRY_DATA);
|
|
140
|
+
expect(createdPage.formData.entriesActiveId).toEqual('123');
|
|
141
|
+
expect(createdPage).toMatchObject(EXPECTED_OUTPUT);
|
|
142
|
+
});
|
|
135
143
|
});
|