@ukhomeoffice/cop-react-form-renderer 5.15.0 → 5.16.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.
@@ -46,7 +46,7 @@ var getCYARow = function getCYARow(page, component, onAction) {
46
46
  id: component.id,
47
47
  fieldId: component.fieldId,
48
48
  full_path: component.full_path,
49
- key: _copReactComponents.Utils.interpolateString(component.label || component.cya_label, page.formData),
49
+ key: _copReactComponents.Utils.interpolateString(component.cya_label || component.label, page.formData),
50
50
  required: component.required,
51
51
  component: _Component.default.editable(component) ? component : undefined,
52
52
  value: value || '',
@@ -286,6 +286,57 @@ describe('utils', function () {
286
286
  value: 'Bravo'
287
287
  });
288
288
  });
289
+ it('should use the cya_label where there is a label', function () {
290
+ var PAGE = {
291
+ id: 'page',
292
+ formData: {
293
+ a: 'Bravo'
294
+ }
295
+ };
296
+ var COMPONENT = {
297
+ type: 'text',
298
+ readonly: true,
299
+ id: 'a',
300
+ fieldId: 'a',
301
+ cya_label: 'CYA Alpha',
302
+ label: 'Alpha'
303
+ };
304
+ var ON_ACTION = function ON_ACTION() {};
305
+ var ROW = (0, _getCYARow.default)(PAGE, COMPONENT, ON_ACTION);
306
+ (0, _setupTests.expectObjectLike)(ROW, {
307
+ pageId: PAGE.id,
308
+ fieldId: COMPONENT.fieldId,
309
+ key: COMPONENT.cya_label,
310
+ action: null,
311
+ component: COMPONENT,
312
+ value: 'Bravo'
313
+ });
314
+ });
315
+ it('should use the label where there is no cya_label', function () {
316
+ var PAGE = {
317
+ id: 'page',
318
+ formData: {
319
+ a: 'Bravo'
320
+ }
321
+ };
322
+ var COMPONENT = {
323
+ type: 'text',
324
+ readonly: true,
325
+ id: 'a',
326
+ fieldId: 'a',
327
+ label: 'Alpha'
328
+ };
329
+ var ON_ACTION = function ON_ACTION() {};
330
+ var ROW = (0, _getCYARow.default)(PAGE, COMPONENT, ON_ACTION);
331
+ (0, _setupTests.expectObjectLike)(ROW, {
332
+ pageId: PAGE.id,
333
+ fieldId: COMPONENT.fieldId,
334
+ key: COMPONENT.label,
335
+ action: null,
336
+ component: COMPONENT,
337
+ value: 'Bravo'
338
+ });
339
+ });
289
340
  });
290
341
  });
291
342
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ukhomeoffice/cop-react-form-renderer",
3
- "version": "5.15.0",
3
+ "version": "5.16.0",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "clean": "rimraf dist",