@ukhomeoffice/cop-react-form-renderer 4.7.0 → 4.8.0
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.
|
@@ -71,8 +71,10 @@ var Container = function Container(_ref) {
|
|
|
71
71
|
return _utils.default.Component.show(options, formData);
|
|
72
72
|
};
|
|
73
73
|
|
|
74
|
+
var classes = _utils.default.classBuilder(DEFAULT_CLASS, [], container.className);
|
|
75
|
+
|
|
74
76
|
return /*#__PURE__*/_react.default.createElement("div", _extends({}, attrs, {
|
|
75
|
-
className:
|
|
77
|
+
className: classes(),
|
|
76
78
|
id: container.id
|
|
77
79
|
}), container.components && container.components.filter(shouldShow).map(function (component, index) {
|
|
78
80
|
var defaultValue = component.type === _models.ComponentTypes.FILE ? {} : '';
|
|
@@ -326,4 +326,37 @@ describe('components.FormComponent.Container', function () {
|
|
|
326
326
|
}
|
|
327
327
|
}, _callee5);
|
|
328
328
|
})));
|
|
329
|
+
it('should handle a className attribute appropriately', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee6() {
|
|
330
|
+
var CLASS_NAME, CONTAINER, _renderWithValidation6, container, c;
|
|
331
|
+
|
|
332
|
+
return regeneratorRuntime.wrap(function _callee6$(_context6) {
|
|
333
|
+
while (1) {
|
|
334
|
+
switch (_context6.prev = _context6.next) {
|
|
335
|
+
case 0:
|
|
336
|
+
CLASS_NAME = 'alpha-bravo';
|
|
337
|
+
CONTAINER = {
|
|
338
|
+
id: ID,
|
|
339
|
+
fieldId: ID,
|
|
340
|
+
type: _models.ComponentTypes.CONTAINER,
|
|
341
|
+
components: [TEXT_COMPONENT],
|
|
342
|
+
className: CLASS_NAME
|
|
343
|
+
};
|
|
344
|
+
_renderWithValidation6 = (0, _setupTests.renderWithValidation)( /*#__PURE__*/_react2.default.createElement(_FormComponent.default, {
|
|
345
|
+
component: CONTAINER,
|
|
346
|
+
value: FORM_DATA[ID],
|
|
347
|
+
formData: FORM_DATA
|
|
348
|
+
})), container = _renderWithValidation6.container; // Check the container itself.
|
|
349
|
+
|
|
350
|
+
c = container.childNodes[0];
|
|
351
|
+
expect(c.tagName).toEqual('DIV');
|
|
352
|
+
expect(c.classList).toContain(_Container.DEFAULT_CLASS);
|
|
353
|
+
expect(c.classList).toContain(CLASS_NAME);
|
|
354
|
+
|
|
355
|
+
case 7:
|
|
356
|
+
case "end":
|
|
357
|
+
return _context6.stop();
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
}, _callee6);
|
|
361
|
+
})));
|
|
329
362
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ukhomeoffice/cop-react-form-renderer",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.8.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"scripts": {
|
|
6
6
|
"clean": "rimraf dist",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"post-compile": "rimraf dist/*.test.* dist/**/*.test.* dist/**/*.stories.* dist/docs dist/assets"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@ukhomeoffice/cop-react-components": "2.2.
|
|
19
|
+
"@ukhomeoffice/cop-react-components": "2.2.2",
|
|
20
20
|
"axios": "^0.23.0",
|
|
21
21
|
"dayjs": "^1.11.0",
|
|
22
22
|
"govuk-frontend": "^4.3.1",
|