@ukhomeoffice/cop-react-form-renderer 7.1.1 → 7.2.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.
package/LICENCE.md ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 UKHomeOffice
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -116,7 +116,7 @@ describe('components', () => {
116
116
  const cya = checkCYA(container);
117
117
  const [, cyaChildNode] = cya.childNodes;
118
118
  const names = cyaChildNode.childNodes[0];
119
- expect(names.tagName).toEqual('DL');
119
+ expect(names.tagName).toEqual('DIV');
120
120
  expect(names.classList).toContain("govuk-!-margin-bottom-".concat(_CheckYourAnswers.DEFAULT_MARGIN_BOTTOM));
121
121
  const [firstName, surname] = names.childNodes;
122
122
  checkRow(firstName, 'First name', 'John', false);
@@ -134,7 +134,7 @@ describe('components', () => {
134
134
  const [,, title, cyaChildNode] = cya.childNodes;
135
135
  const civilServant = cyaChildNode.childNodes[0];
136
136
  expect(title.textContent).toEqual('Are you a civil servant?');
137
- expect(civilServant.tagName).toEqual('DL');
137
+ expect(civilServant.tagName).toEqual('DIV');
138
138
  expect(civilServant.classList).toContain("govuk-!-margin-bottom-".concat(_CheckYourAnswers.DEFAULT_MARGIN_BOTTOM));
139
139
  const [status] = civilServant.childNodes;
140
140
  checkRow(status, 'Are you a civil servant?', 'Yes', true);
@@ -151,7 +151,7 @@ describe('components', () => {
151
151
  const cya = checkCYA(container);
152
152
  const [,, cyaChildNode] = cya.childNodes; // The title simply isn't returned
153
153
  const civilServant = cyaChildNode.childNodes[0];
154
- expect(civilServant.tagName).toEqual('DL');
154
+ expect(civilServant.tagName).toEqual('DIV');
155
155
  expect(civilServant.classList).toContain("govuk-!-margin-bottom-0"); // Changed margin if no titles
156
156
  const [status] = civilServant.childNodes;
157
157
  checkRow(status, 'Are you a civil servant?', 'Yes', true);
@@ -184,7 +184,7 @@ describe('components', () => {
184
184
  expect(titleAction.classList).toContain('heading-action');
185
185
  expect(titleAction.textContent).toEqual("Change page details");
186
186
  const civilServant = cyaChildNode.childNodes[0];
187
- expect(civilServant.tagName).toEqual('DL');
187
+ expect(civilServant.tagName).toEqual('DIV');
188
188
  const [status] = civilServant.childNodes;
189
189
  checkRow(status, 'Are you a civil servant?', 'Yes', false);
190
190
  });
@@ -231,7 +231,7 @@ describe('components', () => {
231
231
  expect(titleAction.classList).toContain('heading-action');
232
232
  expect(titleAction.textContent).toEqual("Change page details");
233
233
  const civilServant = cyaChildNode.childNodes[0];
234
- expect(civilServant.tagName).toEqual('DL');
234
+ expect(civilServant.tagName).toEqual('DIV');
235
235
  const [status] = civilServant.childNodes;
236
236
  checkRow(status, 'Are you a civil servant?', 'Yes', false);
237
237
  });
@@ -247,7 +247,7 @@ describe('components', () => {
247
247
  const cya = checkCYA(container);
248
248
  const [cyaChildNode] = cya.childNodes;
249
249
  const names = cyaChildNode.childNodes[0];
250
- expect(names.tagName).toEqual('DL');
250
+ expect(names.tagName).toEqual('DIV');
251
251
  expect(names.classList).toContain("govuk-!-margin-bottom-".concat(_CheckYourAnswers.DEFAULT_MARGIN_BOTTOM));
252
252
  const [firstName, surname] = names.childNodes;
253
253
  checkRow(firstName, 'First name', 'John', false);
@@ -502,7 +502,7 @@ describe('components', () => {
502
502
  const [, cyaTitle, cyaChildNode] = cya.childNodes;
503
503
  expect(cyaTitle.textContent).toEqual('Alpha ID: 123456789');
504
504
  const names = cyaChildNode.childNodes[0];
505
- expect(names.tagName).toEqual('DL');
505
+ expect(names.tagName).toEqual('DIV');
506
506
  expect(names.classList).toContain("govuk-!-margin-bottom-".concat(_CheckYourAnswers.DEFAULT_MARGIN_BOTTOM));
507
507
  const [firstName, surname] = names.childNodes;
508
508
  const [label] = firstName.childNodes;
@@ -528,7 +528,7 @@ describe('components', () => {
528
528
  const cya = checkCYA(container);
529
529
  const [, cyaChildNode] = cya.childNodes;
530
530
  const names = cyaChildNode.childNodes[0];
531
- expect(names.tagName).toEqual('DL');
531
+ expect(names.tagName).toEqual('DIV');
532
532
  expect(names.classList).toContain("govuk-!-margin-bottom-".concat(_CheckYourAnswers.DEFAULT_MARGIN_BOTTOM));
533
533
  const [firstName, surname] = names.childNodes;
534
534
  const [label] = firstName.childNodes;
@@ -46,7 +46,7 @@ const SummaryList = _ref => {
46
46
  }
47
47
  return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
48
48
  className: "group-of-rows",
49
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("dl", _objectSpread(_objectSpread({}, cleanedHtmlAttrs), {}, {
49
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", _objectSpread(_objectSpread({}, cleanedHtmlAttrs), {}, {
50
50
  className: classes(),
51
51
  children: [rows.map(row => {
52
52
  const key = "".concat(row.pageId, "_").concat(row.full_path || row.fieldId);
@@ -14,7 +14,7 @@ describe('components', () => {
14
14
  describe('SummaryList', () => {
15
15
  const checkSummaryList = (container, id) => {
16
16
  const summaryList = (0, _react.getByTestId)(container, id);
17
- expect(summaryList.tagName).toEqual('DL');
17
+ expect(summaryList.tagName).toEqual('DIV');
18
18
  expect(summaryList.classList).toContain(_SummaryList.DEFAULT_CLASS);
19
19
  return summaryList;
20
20
  };
@@ -37,7 +37,7 @@ describe('components', () => {
37
37
  };
38
38
  const checkRow = (summaryList, index) => {
39
39
  const row = summaryList.childNodes[index];
40
- expect(row.tagName).toEqual('DIV');
40
+ expect(row.tagName).toEqual('DL');
41
41
  expect(row.classList).toContain("".concat(_SummaryList.DEFAULT_CLASS, "__row"));
42
42
  const [key, value, actions] = row.childNodes;
43
43
  expect(key.tagName).toEqual('DT');
@@ -61,7 +61,7 @@ describe('components', () => {
61
61
  };
62
62
  const checkRowNoChangeActions = (summaryList, index) => {
63
63
  const row = summaryList.childNodes[index];
64
- expect(row.tagName).toEqual('DIV');
64
+ expect(row.tagName).toEqual('DL');
65
65
  expect(row.classList).toContain("".concat(_SummaryList.DEFAULT_CLASS, "__row"));
66
66
  const [key, value] = row.childNodes;
67
67
  expect(key.tagName).toEqual('DT');
@@ -19,7 +19,7 @@ const SummaryListRow = _ref => {
19
19
  classes,
20
20
  showAction
21
21
  } = _ref;
22
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
22
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)("dl", {
23
23
  className: classes('row'),
24
24
  children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("dt", {
25
25
  className: classes('key'),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ukhomeoffice/cop-react-form-renderer",
3
- "version": "7.1.1",
3
+ "version": "7.2.0",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "build-storybook": "storybook build",