@ukhomeoffice/cop-react-form-renderer 4.64.0-alpha → 4.64.0-charlie

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.
@@ -15,6 +15,8 @@ var _utils = _interopRequireDefault(require("../../utils"));
15
15
 
16
16
  var _FormPage = _interopRequireDefault(require("../FormPage"));
17
17
 
18
+ var _FormPage2 = require("../FormPage/FormPage");
19
+
18
20
  require("../FormPage/FormPage.scss");
19
21
 
20
22
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
@@ -41,7 +43,7 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
41
43
 
42
44
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
43
45
 
44
- var DEFAULT_CLASS = 'hods-form';
46
+ var DEFAULT_CLASS = _FormPage2.DEFAULT_CLASS;
45
47
  exports.DEFAULT_CLASS = DEFAULT_CLASS;
46
48
 
47
49
  var CollectionPage = function CollectionPage(_ref) {
@@ -93,7 +95,7 @@ var CollectionPage = function CollectionPage(_ref) {
93
95
  };
94
96
 
95
97
  var onInnerPageAction = function onInnerPageAction(action) {
96
- onAction(action, patch);
98
+ onAction(action, patch, {});
97
99
  };
98
100
 
99
101
  var onInnerPageChange = function onInnerPageChange(_ref3) {
@@ -236,7 +236,7 @@ describe('components.CollectionPage', function () {
236
236
  })), container = _renderWithValidation.container;
237
237
  page = container.childNodes[0];
238
238
  expect(page.tagName).toEqual('DIV');
239
- expect(page.classList).toContain("".concat(_CollectionPage.DEFAULT_CLASS, "__page"));
239
+ expect(page.classList).toContain(_CollectionPage.DEFAULT_CLASS);
240
240
  heading = page.childNodes[0];
241
241
  expect(heading.classList).toContain('govuk-heading-l');
242
242
  expect(heading.textContent).toEqual(PAGE.title);
@@ -264,7 +264,7 @@ describe('components.CollectionPage', function () {
264
264
  page = container.childNodes[0];
265
265
  FORM_DATA = PAGE_WITH_BUTTON_ACTIONS.formData;
266
266
  expect(page.tagName).toEqual('DIV');
267
- expect(page.classList).toContain("".concat(_CollectionPage.DEFAULT_CLASS, "__page"));
267
+ expect(page.classList).toContain(_CollectionPage.DEFAULT_CLASS);
268
268
  heading = page.childNodes[0];
269
269
  expect(heading.classList).toContain('govuk-heading-l');
270
270
  expect(heading.textContent).toEqual(FORM_DATA.title);
@@ -47,7 +47,7 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
47
47
 
48
48
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
49
49
 
50
- var DEFAULT_CLASS = 'hods-form';
50
+ var DEFAULT_CLASS = 'hods-form__page';
51
51
  exports.DEFAULT_CLASS = DEFAULT_CLASS;
52
52
 
53
53
  var FormPage = function FormPage(_ref) {
@@ -113,7 +113,7 @@ var FormPage = function FormPage(_ref) {
113
113
  });
114
114
  page.formData = _utils.default.Operate.runPageOperations(page, _objectSpread(_objectSpread({}, page.formData), patch), onWrapperChange || onPageChange);
115
115
  return /*#__PURE__*/_react.default.createElement("div", {
116
- className: classes('page'),
116
+ className: classes(),
117
117
  key: page.id
118
118
  }, (errors === null || errors === void 0 ? void 0 : errors.length) > 0 && /*#__PURE__*/_react.default.createElement(_copReactComponents.ErrorSummary, {
119
119
  errors: errors,
@@ -221,7 +221,7 @@ describe('components.FormPage', function () {
221
221
  })), container = _renderWithValidation.container;
222
222
  page = container.childNodes[0];
223
223
  expect(page.tagName).toEqual('DIV');
224
- expect(page.classList).toContain("".concat(_FormPage.DEFAULT_CLASS, "__page"));
224
+ expect(page.classList).toContain(_FormPage.DEFAULT_CLASS);
225
225
  heading = page.childNodes[0];
226
226
  expect(heading.classList).toContain('govuk-heading-l');
227
227
  expect(heading.textContent).toEqual(PAGE.title);
@@ -249,7 +249,7 @@ describe('components.FormPage', function () {
249
249
  page = container.childNodes[0];
250
250
  FORM_DATA = PAGE_WITH_BUTTON_ACTIONS.formData;
251
251
  expect(page.tagName).toEqual('DIV');
252
- expect(page.classList).toContain("".concat(_FormPage.DEFAULT_CLASS, "__page"));
252
+ expect(page.classList).toContain(_FormPage.DEFAULT_CLASS);
253
253
  heading = page.childNodes[0];
254
254
  expect(heading.classList).toContain('govuk-heading-l');
255
255
  expect(heading.textContent).toEqual(FORM_DATA.title);
@@ -428,7 +428,7 @@ var InternalFormRenderer = function InternalFormRenderer(_ref2) {
428
428
  var changedFieldName;
429
429
  var changedFieldValue;
430
430
 
431
- if (type === _models.FormTypes.HUB && Object.keys(patchLabel).length > 0) {
431
+ if (type === _models.FormTypes.HUB && patchLabel && Object.keys(patchLabel).length > 0) {
432
432
  changedFieldName = Object.keys(patchLabel)[0];
433
433
  changedFieldValue = Object.values(patchLabel)[0];
434
434
  } // Now submit the data to the backend...
@@ -149,6 +149,7 @@ describe('utils', function () {
149
149
  item: {
150
150
  value: 'currencyCode',
151
151
  label: 'currencyCode',
152
+ // eslint-disable-next-line no-template-curly-in-string
152
153
  format: '${currencyName} (${currencyCode})'
153
154
  },
154
155
  data: {
@@ -196,6 +197,7 @@ describe('utils', function () {
196
197
  item: {
197
198
  value: 'currencyCode',
198
199
  label: 'currencyCode',
200
+ // eslint-disable-next-line no-template-curly-in-string
199
201
  format: '${currencyName} (${currencyCode})'
200
202
  },
201
203
  data: {
@@ -233,6 +235,7 @@ describe('utils', function () {
233
235
  item: {
234
236
  value: 'currencyCode',
235
237
  label: 'currencyCode',
238
+ // eslint-disable-next-line no-template-curly-in-string
236
239
  format: '${currencyName} (${currencyCode})'
237
240
  },
238
241
  data: {
@@ -270,6 +273,7 @@ describe('utils', function () {
270
273
  item: {
271
274
  value: 'currencyCode',
272
275
  label: 'currencyCode',
276
+ // eslint-disable-next-line no-template-curly-in-string
273
277
  format: '${currencyName} (${currencyCode})'
274
278
  },
275
279
  data: {
@@ -307,6 +311,7 @@ describe('utils', function () {
307
311
  item: {
308
312
  value: 'currencyCode',
309
313
  label: 'currencyCode',
314
+ // eslint-disable-next-line no-template-curly-in-string
310
315
  format: '${currencyName} (${currencyCode})'
311
316
  },
312
317
  data: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ukhomeoffice/cop-react-form-renderer",
3
- "version": "4.64.0-alpha",
3
+ "version": "4.64.0-charlie",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "clean": "rimraf dist",