@ukhomeoffice/cop-react-form-renderer 4.22.0 → 4.22.3
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.
|
@@ -102,9 +102,9 @@ var FormPage = function FormPage(_ref) {
|
|
|
102
102
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
103
103
|
className: classes('page'),
|
|
104
104
|
key: page.id
|
|
105
|
-
},
|
|
105
|
+
}, (errors === null || errors === void 0 ? void 0 : errors.length) > 0 && /*#__PURE__*/_react.default.createElement(_copReactComponents.ErrorSummary, {
|
|
106
106
|
errors: errors
|
|
107
|
-
}), page.components.filter(function (c) {
|
|
107
|
+
}), page.title && /*#__PURE__*/_react.default.createElement(_copReactComponents.LargeHeading, null, _utils.default.interpolateString(page.title, page.formData)), page.components.filter(function (c) {
|
|
108
108
|
return _utils.default.Component.show(c, page.formData);
|
|
109
109
|
}).map(function (component, index) {
|
|
110
110
|
return /*#__PURE__*/_react.default.createElement(_FormComponent.default, {
|
|
@@ -395,7 +395,7 @@ describe('components', function () {
|
|
|
395
395
|
|
|
396
396
|
expect(form.childNodes.length).toEqual(1); // Just the page.
|
|
397
397
|
|
|
398
|
-
pageHeading = form.childNodes[0].childNodes[
|
|
398
|
+
pageHeading = form.childNodes[0].childNodes[1];
|
|
399
399
|
expect(pageHeading.tagName).toEqual('H1');
|
|
400
400
|
expect(pageHeading.textContent).toEqual(_userProfile.default.pages[1].title);
|
|
401
401
|
|
|
@@ -44,7 +44,10 @@ var validateContainer = function validateContainer(container, outerData, formDat
|
|
|
44
44
|
if (Array.isArray(container.components)) {
|
|
45
45
|
var containerData = outerData && container.fieldId ? outerData[container.fieldId] : outerData;
|
|
46
46
|
container.components.forEach(function (component) {
|
|
47
|
-
|
|
47
|
+
// It is possible that the container being passed in is a
|
|
48
|
+
// dummy container just for validation. In that scenario we want
|
|
49
|
+
// to ignore the full_path and just use the component's fieldId.
|
|
50
|
+
var full_path = container.full_path || container.fieldId ? "".concat(container.full_path || container.fieldId, ".").concat(component.fieldId) : component.fieldId;
|
|
48
51
|
errors.push((0, _validateComponent.default)(_objectSpread(_objectSpread({}, component), {}, {
|
|
49
52
|
full_path: full_path
|
|
50
53
|
}), containerData, fd));
|