@ukhomeoffice/cop-react-form-renderer 5.82.0 → 5.83.1

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.
@@ -165,7 +165,7 @@ var CheckYourAnswers = function CheckYourAnswers(_ref) {
165
165
  });
166
166
  return /*#__PURE__*/_react.default.createElement(_react.Fragment, {
167
167
  key: taskIndex
168
- }, /*#__PURE__*/_react.default.createElement(_copReactComponents.MediumHeading, null, filterPages.length > 0 && task.displayName || task.name), filterPages.map(function (page, pageIndex) {
168
+ }, /*#__PURE__*/_react.default.createElement(_copReactComponents.MediumHeading, null, filterPages.length > 0 && (task.displayName || task.name)), filterPages.map(function (page, pageIndex) {
169
169
  var hideActionButtons = isGroup(page.id) || noChangeAction;
170
170
  var showHeading = !hide_page_titles && page.title && !isGroup(page.id);
171
171
  return /*#__PURE__*/_react.default.createElement(_react.Fragment, {
@@ -527,23 +527,37 @@ describe('components', function () {
527
527
  }
528
528
  }, _callee20);
529
529
  })));
530
- it('Show answers from multiple address fields into in one DL', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22() {
531
- var ADDRESS_DATA, GROUP_PAGES, cya, groupedComponent, keyGroup, valueGroup, changeButtonDiv, changeButton;
530
+ it('should show task list in CYA style and not show sections without any pages', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22() {
531
+ var sections, taskHeading1, taskHeading2;
532
532
  return _regeneratorRuntime().wrap(function _callee22$(_context22) {
533
533
  while (1) switch (_context22.prev = _context22.next) {
534
534
  case 0:
535
- ADDRESS_DATA = _utils.default.Data.setupForm(_group.default.pages, _group.default.components, _groupData.default);
536
- GROUP_PAGES = _utils.default.FormPage.getAll(_group.default.pages, _group.default.components, _objectSpread({}, ADDRESS_DATA));
537
- _context22.next = 4;
535
+ sections = [{
536
+ name: 'These are your tasks',
537
+ tasks: [{
538
+ name: 'Task 1',
539
+ displayName: 'Blue',
540
+ state: 'complete',
541
+ pages: []
542
+ }, {
543
+ name: 'Task 2',
544
+ displayName: 'Red',
545
+ state: 'complete',
546
+ pages: ['grade']
547
+ }]
548
+ }];
549
+ _context22.next = 3;
538
550
  return (0, _testUtils.act)( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21() {
539
551
  return _regeneratorRuntime().wrap(function _callee21$(_context21) {
540
552
  while (1) switch (_context21.prev = _context21.next) {
541
553
  case 0:
542
554
  (0, _setupTests.renderDomWithValidation)( /*#__PURE__*/_react.default.createElement(_CheckYourAnswers.default, {
543
- pages: GROUP_PAGES,
555
+ pages: PAGES,
544
556
  onRowAction: ON_ROW_ACTION,
545
557
  onAction: ON_ACTION,
546
- hide_title: true
558
+ hide_title: true,
559
+ sections: sections,
560
+ type: "task-list-cya"
547
561
  }), container);
548
562
  case 1:
549
563
  case "end":
@@ -551,6 +565,41 @@ describe('components', function () {
551
565
  }
552
566
  }, _callee21);
553
567
  })));
568
+ case 3:
569
+ taskHeading1 = container.childNodes[0].childNodes[0];
570
+ expect(taskHeading1.textContent).toEqual('');
571
+ taskHeading2 = container.childNodes[0].childNodes[1];
572
+ expect(taskHeading2.textContent).toEqual('Red');
573
+ case 7:
574
+ case "end":
575
+ return _context22.stop();
576
+ }
577
+ }, _callee22);
578
+ })));
579
+ it('Show answers from multiple address fields into in one DL', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24() {
580
+ var ADDRESS_DATA, GROUP_PAGES, cya, groupedComponent, keyGroup, valueGroup, changeButtonDiv, changeButton;
581
+ return _regeneratorRuntime().wrap(function _callee24$(_context24) {
582
+ while (1) switch (_context24.prev = _context24.next) {
583
+ case 0:
584
+ ADDRESS_DATA = _utils.default.Data.setupForm(_group.default.pages, _group.default.components, _groupData.default);
585
+ GROUP_PAGES = _utils.default.FormPage.getAll(_group.default.pages, _group.default.components, _objectSpread({}, ADDRESS_DATA));
586
+ _context24.next = 4;
587
+ return (0, _testUtils.act)( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23() {
588
+ return _regeneratorRuntime().wrap(function _callee23$(_context23) {
589
+ while (1) switch (_context23.prev = _context23.next) {
590
+ case 0:
591
+ (0, _setupTests.renderDomWithValidation)( /*#__PURE__*/_react.default.createElement(_CheckYourAnswers.default, {
592
+ pages: GROUP_PAGES,
593
+ onRowAction: ON_ROW_ACTION,
594
+ onAction: ON_ACTION,
595
+ hide_title: true
596
+ }), container);
597
+ case 1:
598
+ case "end":
599
+ return _context23.stop();
600
+ }
601
+ }, _callee23);
602
+ })));
554
603
  case 4:
555
604
  cya = checkCYA(container);
556
605
  groupedComponent = cya.childNodes[10];
@@ -571,20 +620,20 @@ describe('components', function () {
571
620
  expect(changeButton.textContent).toEqual('Change address details');
572
621
  case 21:
573
622
  case "end":
574
- return _context22.stop();
623
+ return _context24.stop();
575
624
  }
576
- }, _callee22);
625
+ }, _callee24);
577
626
  })));
578
- it('should render a group with one action button', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24() {
627
+ it('should render a group with one action button', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26() {
579
628
  var GROUP_PAGES, cya, namesGroup, firstNameRow, surname, changeButtonDiv, changeButton;
580
- return _regeneratorRuntime().wrap(function _callee24$(_context24) {
581
- while (1) switch (_context24.prev = _context24.next) {
629
+ return _regeneratorRuntime().wrap(function _callee26$(_context26) {
630
+ while (1) switch (_context26.prev = _context26.next) {
582
631
  case 0:
583
632
  GROUP_PAGES = _utils.default.FormPage.getAll(_groupOfRow.default.pages, _groupOfRow.default.components, _objectSpread({}, DATA));
584
- _context24.next = 3;
585
- return (0, _testUtils.act)( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23() {
586
- return _regeneratorRuntime().wrap(function _callee23$(_context23) {
587
- while (1) switch (_context23.prev = _context23.next) {
633
+ _context26.next = 3;
634
+ return (0, _testUtils.act)( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25() {
635
+ return _regeneratorRuntime().wrap(function _callee25$(_context25) {
636
+ while (1) switch (_context25.prev = _context25.next) {
588
637
  case 0:
589
638
  (0, _setupTests.renderDomWithValidation)( /*#__PURE__*/_react.default.createElement(_CheckYourAnswers.default, {
590
639
  pages: GROUP_PAGES,
@@ -594,9 +643,9 @@ describe('components', function () {
594
643
  }), container);
595
644
  case 1:
596
645
  case "end":
597
- return _context23.stop();
646
+ return _context25.stop();
598
647
  }
599
- }, _callee23);
648
+ }, _callee25);
600
649
  })));
601
650
  case 3:
602
651
  cya = checkCYA(container);
@@ -620,14 +669,14 @@ describe('components', function () {
620
669
  expect(changeButton.textContent).toEqual('Change names');
621
670
  case 22:
622
671
  case "end":
623
- return _context24.stop();
672
+ return _context26.stop();
624
673
  }
625
- }, _callee24);
674
+ }, _callee26);
626
675
  })));
627
- it('should show page components corrently with interpolated title and cya_label, if label is missing', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26() {
676
+ it('should show page components corrently with interpolated title and cya_label, if label is missing', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28() {
628
677
  var _PAGES, _COMPONENTS, T_PAGES, cya, _cya$childNodes7, cyaTitle, cyaChildNode, names, _names$childNodes3, firstName, surname, _firstName$childNodes, label;
629
- return _regeneratorRuntime().wrap(function _callee26$(_context26) {
630
- while (1) switch (_context26.prev = _context26.next) {
678
+ return _regeneratorRuntime().wrap(function _callee28$(_context28) {
679
+ while (1) switch (_context28.prev = _context28.next) {
631
680
  case 0:
632
681
  _PAGES = [].concat(_userProfile.default.pages); // eslint-disable-next-line no-template-curly-in-string
633
682
  _PAGES[0] = _objectSpread(_objectSpread({}, _PAGES[0]), {}, {
@@ -641,10 +690,10 @@ describe('components', function () {
641
690
  cya_label: "Text ${currentUser.familyName}"
642
691
  });
643
692
  T_PAGES = _utils.default.FormPage.getAll(_PAGES, _COMPONENTS, DATA);
644
- _context26.next = 7;
645
- return (0, _testUtils.act)( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25() {
646
- return _regeneratorRuntime().wrap(function _callee25$(_context25) {
647
- while (1) switch (_context25.prev = _context25.next) {
693
+ _context28.next = 7;
694
+ return (0, _testUtils.act)( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27() {
695
+ return _regeneratorRuntime().wrap(function _callee27$(_context27) {
696
+ while (1) switch (_context27.prev = _context27.next) {
648
697
  case 0:
649
698
  (0, _setupTests.renderDomWithValidation)( /*#__PURE__*/_react.default.createElement(_CheckYourAnswers.default, {
650
699
  pages: T_PAGES,
@@ -653,9 +702,9 @@ describe('components', function () {
653
702
  }), container);
654
703
  case 1:
655
704
  case "end":
656
- return _context25.stop();
705
+ return _context27.stop();
657
706
  }
658
- }, _callee25);
707
+ }, _callee27);
659
708
  })));
660
709
  case 7:
661
710
  cya = checkCYA(container);
@@ -670,14 +719,14 @@ describe('components', function () {
670
719
  checkRow(surname, 'Last name', 'Smith', false);
671
720
  case 17:
672
721
  case "end":
673
- return _context26.stop();
722
+ return _context28.stop();
674
723
  }
675
- }, _callee26);
724
+ }, _callee28);
676
725
  })));
677
- it('should show page components corrently with no label, if label and cya_label are missing', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28() {
726
+ it('should show page components corrently with no label, if label and cya_label are missing', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30() {
678
727
  var _PAGES, _COMPONENTS, T_PAGES, cya, _cya$childNodes8, cyaChildNode, names, _names$childNodes4, firstName, surname, _firstName$childNodes2, label;
679
- return _regeneratorRuntime().wrap(function _callee28$(_context28) {
680
- while (1) switch (_context28.prev = _context28.next) {
728
+ return _regeneratorRuntime().wrap(function _callee30$(_context30) {
729
+ while (1) switch (_context30.prev = _context30.next) {
681
730
  case 0:
682
731
  _PAGES = [].concat(_userProfile.default.pages);
683
732
  _COMPONENTS = [].concat(_userProfile.default.components);
@@ -687,10 +736,10 @@ describe('components', function () {
687
736
  cya_label: undefined
688
737
  });
689
738
  T_PAGES = _utils.default.FormPage.getAll(_PAGES, _COMPONENTS, _objectSpread({}, DATA));
690
- _context28.next = 6;
691
- return (0, _testUtils.act)( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27() {
692
- return _regeneratorRuntime().wrap(function _callee27$(_context27) {
693
- while (1) switch (_context27.prev = _context27.next) {
739
+ _context30.next = 6;
740
+ return (0, _testUtils.act)( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29() {
741
+ return _regeneratorRuntime().wrap(function _callee29$(_context29) {
742
+ while (1) switch (_context29.prev = _context29.next) {
694
743
  case 0:
695
744
  (0, _setupTests.renderDomWithValidation)( /*#__PURE__*/_react.default.createElement(_CheckYourAnswers.default, {
696
745
  pages: T_PAGES,
@@ -699,9 +748,9 @@ describe('components', function () {
699
748
  }), container);
700
749
  case 1:
701
750
  case "end":
702
- return _context27.stop();
751
+ return _context29.stop();
703
752
  }
704
- }, _callee27);
753
+ }, _callee29);
705
754
  })));
706
755
  case 6:
707
756
  cya = checkCYA(container);
@@ -715,14 +764,14 @@ describe('components', function () {
715
764
  checkRow(surname, 'Last name', 'Smith', false);
716
765
  case 15:
717
766
  case "end":
718
- return _context28.stop();
767
+ return _context30.stop();
719
768
  }
720
- }, _callee28);
769
+ }, _callee30);
721
770
  })));
722
- it('should show task list in CYA style and hide pages from skipped tasks', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30() {
771
+ it('should show task list in CYA style and hide pages from skipped tasks', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32() {
723
772
  var sections, taskHeading1, namesPageHeading;
724
- return _regeneratorRuntime().wrap(function _callee30$(_context30) {
725
- while (1) switch (_context30.prev = _context30.next) {
773
+ return _regeneratorRuntime().wrap(function _callee32$(_context32) {
774
+ while (1) switch (_context32.prev = _context32.next) {
726
775
  case 0:
727
776
  sections = [{
728
777
  name: 'These are your tasks',
@@ -736,10 +785,10 @@ describe('components', function () {
736
785
  pages: ['grade']
737
786
  }]
738
787
  }];
739
- _context30.next = 3;
740
- return (0, _testUtils.act)( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29() {
741
- return _regeneratorRuntime().wrap(function _callee29$(_context29) {
742
- while (1) switch (_context29.prev = _context29.next) {
788
+ _context32.next = 3;
789
+ return (0, _testUtils.act)( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31() {
790
+ return _regeneratorRuntime().wrap(function _callee31$(_context31) {
791
+ while (1) switch (_context31.prev = _context31.next) {
743
792
  case 0:
744
793
  (0, _setupTests.renderDomWithValidation)( /*#__PURE__*/_react.default.createElement(_CheckYourAnswers.default, {
745
794
  pages: PAGES,
@@ -751,9 +800,9 @@ describe('components', function () {
751
800
  }), container);
752
801
  case 1:
753
802
  case "end":
754
- return _context29.stop();
803
+ return _context31.stop();
755
804
  }
756
- }, _callee29);
805
+ }, _callee31);
757
806
  })));
758
807
  case 3:
759
808
  taskHeading1 = container.childNodes[0].childNodes[0];
@@ -767,21 +816,21 @@ describe('components', function () {
767
816
  expect(container.childNodes[0].childNodes.length).toEqual(2); // second task skipped so not shown
768
817
  case 12:
769
818
  case "end":
770
- return _context30.stop();
819
+ return _context32.stop();
771
820
  }
772
- }, _callee30);
821
+ }, _callee32);
773
822
  })));
774
- it('Show answers from multiple address fields into in one DL correctly when hideBlankRows is true', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32() {
823
+ it('Show answers from multiple address fields into in one DL correctly when hideBlankRows is true', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34() {
775
824
  var ADDRESS_DATA, GROUP_PAGES, cya, groupedComponent, keyGroup, valueGroup, changeButtonDiv, changeButton;
776
- return _regeneratorRuntime().wrap(function _callee32$(_context32) {
777
- while (1) switch (_context32.prev = _context32.next) {
825
+ return _regeneratorRuntime().wrap(function _callee34$(_context34) {
826
+ while (1) switch (_context34.prev = _context34.next) {
778
827
  case 0:
779
828
  ADDRESS_DATA = _utils.default.Data.setupForm(_group.default.pages, _group.default.components, _groupData.default);
780
829
  GROUP_PAGES = _utils.default.FormPage.getAll(_group.default.pages, _group.default.components, _objectSpread({}, ADDRESS_DATA));
781
- _context32.next = 4;
782
- return (0, _testUtils.act)( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31() {
783
- return _regeneratorRuntime().wrap(function _callee31$(_context31) {
784
- while (1) switch (_context31.prev = _context31.next) {
830
+ _context34.next = 4;
831
+ return (0, _testUtils.act)( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33() {
832
+ return _regeneratorRuntime().wrap(function _callee33$(_context33) {
833
+ while (1) switch (_context33.prev = _context33.next) {
785
834
  case 0:
786
835
  (0, _setupTests.renderDomWithValidation)( /*#__PURE__*/_react.default.createElement(_CheckYourAnswers.default, {
787
836
  pages: GROUP_PAGES,
@@ -792,9 +841,9 @@ describe('components', function () {
792
841
  }), container);
793
842
  case 1:
794
843
  case "end":
795
- return _context31.stop();
844
+ return _context33.stop();
796
845
  }
797
- }, _callee31);
846
+ }, _callee33);
798
847
  })));
799
848
  case 4:
800
849
  cya = checkCYA(container);
@@ -816,9 +865,9 @@ describe('components', function () {
816
865
  expect(changeButton.textContent).toEqual('Change address details');
817
866
  case 21:
818
867
  case "end":
819
- return _context32.stop();
868
+ return _context34.stop();
820
869
  }
821
- }, _callee32);
870
+ }, _callee34);
822
871
  })));
823
872
  });
824
873
  });
@@ -12,7 +12,7 @@ var _models = require("../../models");
12
12
  var _Task = _interopRequireDefault(require("./Task"));
13
13
  var _showComponent = _interopRequireDefault(require("../../utils/Component/showComponent"));
14
14
  require("./TaskList.scss");
15
- var _excluded = ["id", "refTitle", "refNumber", "notes", "incompleteTitle", "sections", "fieldId", "onTaskAction", "classBlock", "classModifiers", "className", "formData", "annotations"];
15
+ var _excluded = ["id", "refTitle", "refNumber", "notes", "incompleteTitle", "showCompletionOverview", "sections", "fieldId", "onTaskAction", "classBlock", "classModifiers", "className", "formData", "annotations"];
16
16
  /* eslint-disable import/no-duplicates */
17
17
  // Global Imports
18
18
  // Local Imports
@@ -36,6 +36,7 @@ var TaskList = function TaskList(_ref) {
36
36
  refNumber = _ref.refNumber,
37
37
  notes = _ref.notes,
38
38
  incompleteTitle = _ref.incompleteTitle,
39
+ showCompletionOverview = _ref.showCompletionOverview,
39
40
  sections = _ref.sections,
40
41
  fieldId = _ref.fieldId,
41
42
  onTaskAction = _ref.onTaskAction,
@@ -87,11 +88,11 @@ var TaskList = function TaskList(_ref) {
87
88
  }, _copReactComponents.Utils.interpolateString(annotation.key, formData)), /*#__PURE__*/_react.default.createElement("p", {
88
89
  className: "".concat(classes('annotation-value'), " govuk-body")
89
90
  }, _copReactComponents.Utils.interpolateString(annotation.value, formData)));
90
- }), totalSections !== completeSections && /*#__PURE__*/_react.default.createElement("p", {
91
+ }), showCompletionOverview && totalSections !== completeSections && /*#__PURE__*/_react.default.createElement("p", {
91
92
  className: "govuk-body govuk-!-margin-bottom-0"
92
93
  }, /*#__PURE__*/_react.default.createElement("strong", {
93
94
  className: "tasklist-summary"
94
- }, incompleteTitle)), /*#__PURE__*/_react.default.createElement("p", {
95
+ }, incompleteTitle)), showCompletionOverview && /*#__PURE__*/_react.default.createElement("p", {
95
96
  className: "govuk-body govuk-!-margin-bottom-7"
96
97
  }, "You have completed ".concat(completeSections, " of ").concat(totalSections, " sections")), notesTitle && notesText && (0, _showComponent.default)(notes, formData) && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("p", {
97
98
  className: "govuk-body govuk-!-margin-bottom-0"
@@ -130,6 +131,7 @@ TaskList.propTypes = {
130
131
  formData: _propTypes.default.shape({}),
131
132
  id: _propTypes.default.string,
132
133
  incompleteTitle: _propTypes.default.string,
134
+ showCompletionOverview: _propTypes.default.bool,
133
135
  notes: _propTypes.default.shape({
134
136
  title: _propTypes.default.string,
135
137
  text: _propTypes.default.string
@@ -162,6 +164,7 @@ TaskList.defaultProps = {
162
164
  formData: {},
163
165
  id: '',
164
166
  incompleteTitle: DEFAULT_INCOMPLETE_TITLE,
167
+ showCompletionOverview: true,
165
168
  notes: {},
166
169
  onTaskAction: undefined,
167
170
  refNumber: undefined,
@@ -78,6 +78,10 @@
78
78
 
79
79
  }
80
80
 
81
+ .hods-task-list__annotation:last-of-type {
82
+ margin-bottom: govuk-spacing(7)
83
+ }
84
+
81
85
  .hods-task-list__task-name {
82
86
  display: block;
83
87
  cursor: auto;
@@ -101,6 +101,83 @@ describe('components', function () {
101
101
  expect(subSectionTwoLabel.textContent).toEqual('This is the label for your extra tasks');
102
102
  expect(subSectionTwoList.childNodes.length).toEqual(3);
103
103
  });
104
+ it('should not render the incomplete title and message when showCompletionOverview is false', function () {
105
+ var COP_REF = '123';
106
+ var REF_TITLE = 'COP reference number';
107
+ var sections = [{
108
+ name: 'These are your tasks',
109
+ label: 'This is the label for your first tasks',
110
+ tasks: [{
111
+ name: 'Nice task',
112
+ state: 'complete',
113
+ pages: ['pageOne']
114
+ }, {
115
+ name: 'Ok task',
116
+ state: 'inProgress',
117
+ pages: ['pageTwo']
118
+ }, {
119
+ name: 'Terrible task',
120
+ state: 'notStarted',
121
+ pages: ['pageThree']
122
+ }]
123
+ }, {
124
+ name: 'These are your extra bonus tasks',
125
+ label: 'This is the label for your extra tasks',
126
+ tasks: [{
127
+ name: 'Nice task',
128
+ state: 'complete',
129
+ pages: ['pageFour']
130
+ }, {
131
+ name: 'Ok task',
132
+ state: 'cannotStartYet',
133
+ pages: ['pageFive']
134
+ }, {
135
+ name: 'Terrible task',
136
+ state: 'cannotStartYet',
137
+ pages: ['pageSix']
138
+ }]
139
+ }];
140
+ var _render2 = (0, _react.render)( /*#__PURE__*/_react2.default.createElement(_TaskList.default, {
141
+ refNumber: COP_REF,
142
+ refTitle: REF_TITLE,
143
+ sections: sections,
144
+ showCompletionOverview: false
145
+ })),
146
+ container = _render2.container;
147
+ var childNodes = container.childNodes;
148
+ expect(childNodes.length).toEqual(1);
149
+ expect(childNodes[0].childNodes.length).toEqual(8); // Without incomplete heading and message.
150
+
151
+ var _childNodes$0$childNo2 = _slicedToArray(childNodes[0].childNodes, 8),
152
+ referenceHeading = _childNodes$0$childNo2[0],
153
+ referenceNumber = _childNodes$0$childNo2[1],
154
+ subSectionOneHeading = _childNodes$0$childNo2[2],
155
+ subSectionOneLabel = _childNodes$0$childNo2[3],
156
+ subSectionOneList = _childNodes$0$childNo2[4],
157
+ subSectionTwoHeading = _childNodes$0$childNo2[5],
158
+ subSectionTwoLabel = _childNodes$0$childNo2[6],
159
+ subSectionTwoList = _childNodes$0$childNo2[7];
160
+ expect(referenceHeading).toMatchObject({
161
+ tagName: 'P',
162
+ textContent: 'COP reference number'
163
+ });
164
+ expect(referenceNumber).toMatchObject({
165
+ tagName: 'P',
166
+ textContent: '123'
167
+ });
168
+ expect(subSectionOneHeading).toMatchObject({
169
+ tagName: 'H2',
170
+ textContent: '1. These are your tasks'
171
+ });
172
+ expect(subSectionOneLabel.textContent).toEqual('This is the label for your first tasks');
173
+ expect(subSectionOneList.childNodes.length).toEqual(3);
174
+ expect(subSectionTwoHeading).toMatchObject({
175
+ tagName: 'H2',
176
+ textContent: '2. These are your extra bonus tasks'
177
+ });
178
+ expect(subSectionTwoLabel.textContent).toEqual('This is the label for your extra tasks');
179
+ expect(subSectionTwoList.childNodes.length).toEqual(3);
180
+ });
104
181
  it('should render any provided annotations', function () {
105
182
  var COP_REF = '123';
106
183
  var REF_TITLE = 'COP reference number';
@@ -147,14 +224,14 @@ describe('components', function () {
147
224
  // eslint-disable-next-line no-template-curly-in-string
148
225
  value: '${port.name}'
149
226
  }];
150
- var _render2 = (0, _react.render)( /*#__PURE__*/_react2.default.createElement(_TaskList.default, {
227
+ var _render3 = (0, _react.render)( /*#__PURE__*/_react2.default.createElement(_TaskList.default, {
151
228
  refNumber: COP_REF,
152
229
  refTitle: REF_TITLE,
153
230
  sections: sections,
154
231
  annotations: ANNOTATIONS,
155
232
  formData: FORM_DATA
156
233
  })),
157
- container = _render2.container;
234
+ container = _render3.container;
158
235
  var childNodes = container.childNodes;
159
236
  expect(childNodes.length).toEqual(1);
160
237
  expect(childNodes[0].childNodes.length).toEqual(11);
@@ -202,18 +279,18 @@ describe('components', function () {
202
279
  pages: ['pageSix']
203
280
  }]
204
281
  }];
205
- var _render3 = (0, _react.render)( /*#__PURE__*/_react2.default.createElement(_TaskList.default, {
282
+ var _render4 = (0, _react.render)( /*#__PURE__*/_react2.default.createElement(_TaskList.default, {
206
283
  refNumber: COP_REF,
207
284
  refTitle: REF_TITLE,
208
285
  sections: sections
209
286
  })),
210
- container = _render3.container;
287
+ container = _render4.container;
211
288
  var childNodes = container.childNodes;
212
289
  expect(childNodes[0].childNodes.length).toEqual(7);
213
- var _childNodes$0$childNo2 = _slicedToArray(childNodes[0].childNodes, 3),
214
- referenceHeading = _childNodes$0$childNo2[0],
215
- referenceNumber = _childNodes$0$childNo2[1],
216
- numComplete = _childNodes$0$childNo2[2];
290
+ var _childNodes$0$childNo3 = _slicedToArray(childNodes[0].childNodes, 3),
291
+ referenceHeading = _childNodes$0$childNo3[0],
292
+ referenceNumber = _childNodes$0$childNo3[1],
293
+ numComplete = _childNodes$0$childNo3[2];
217
294
  expect(referenceHeading).toMatchObject({
218
295
  tagName: 'P',
219
296
  textContent: 'COP reference number'
@@ -246,12 +323,12 @@ describe('components', function () {
246
323
  pages: ['pageThree']
247
324
  }]
248
325
  }];
249
- var _render4 = (0, _react.render)( /*#__PURE__*/_react2.default.createElement(_TaskList.default, {
326
+ var _render5 = (0, _react.render)( /*#__PURE__*/_react2.default.createElement(_TaskList.default, {
250
327
  refNumber: COP_REF,
251
328
  refTitle: REF_TITLE,
252
329
  sections: sections
253
330
  })),
254
- container = _render4.container;
331
+ container = _render5.container;
255
332
  var childNodes = container.childNodes;
256
333
  var subSectionOne = childNodes[0].childNodes[4];
257
334
  expect(subSectionOne.childNodes[0].textContent).toEqual('');
@@ -290,11 +367,11 @@ describe('components', function () {
290
367
  pages: ['pageSix']
291
368
  }]
292
369
  }];
293
- var _render5 = (0, _react.render)( /*#__PURE__*/_react2.default.createElement(_TaskList.default, {
370
+ var _render6 = (0, _react.render)( /*#__PURE__*/_react2.default.createElement(_TaskList.default, {
294
371
  refNumber: COP_REF,
295
372
  sections: sections
296
373
  })),
297
- container = _render5.container;
374
+ container = _render6.container;
298
375
  var childNodes = container.childNodes;
299
376
  expect(childNodes.length).toEqual(1);
300
377
  expect(childNodes[0].childNodes.length).toEqual(6);
@@ -340,12 +417,12 @@ describe('components', function () {
340
417
  pages: ['pageSix']
341
418
  }]
342
419
  }];
343
- var _render6 = (0, _react.render)( /*#__PURE__*/_react2.default.createElement(_TaskList.default, {
420
+ var _render7 = (0, _react.render)( /*#__PURE__*/_react2.default.createElement(_TaskList.default, {
344
421
  refNumber: COP_REF,
345
422
  sections: sections,
346
423
  incompleteTitle: INCOMPLETE_TITLE
347
424
  })),
348
- container = _render6.container;
425
+ container = _render7.container;
349
426
  var childNodes = container.childNodes;
350
427
  // The first child is now the incomplete text.
351
428
  var incompleteForm = childNodes[0].childNodes[0];
@@ -386,12 +463,12 @@ describe('components', function () {
386
463
  pages: ['pageSix']
387
464
  }]
388
465
  }];
389
- var _render7 = (0, _react.render)( /*#__PURE__*/_react2.default.createElement(_TaskList.default, {
466
+ var _render8 = (0, _react.render)( /*#__PURE__*/_react2.default.createElement(_TaskList.default, {
390
467
  refNumber: COP_REF,
391
468
  sections: sections,
392
469
  incompleteTitle: INCOMPLETE_TITLE
393
470
  })),
394
- container = _render7.container;
471
+ container = _render8.container;
395
472
  var childNodes = container.childNodes;
396
473
  expect(childNodes.length).toEqual(1);
397
474
  var children = childNodes[0].childNodes;
@@ -424,13 +501,13 @@ describe('components', function () {
424
501
  pages: ['pageThree']
425
502
  }]
426
503
  }];
427
- var _render8 = (0, _react.render)( /*#__PURE__*/_react2.default.createElement(_TaskList.default, {
504
+ var _render9 = (0, _react.render)( /*#__PURE__*/_react2.default.createElement(_TaskList.default, {
428
505
  refNumber: COP_REF,
429
506
  refTitle: REF_TITLE,
430
507
  sections: sections,
431
508
  onTaskAction: ON_CLICK
432
509
  })),
433
- container = _render8.container;
510
+ container = _render9.container;
434
511
  var taskList = container.childNodes[0].childNodes[5].childNodes;
435
512
  var firstTask = taskList[0].childNodes[0].childNodes[0];
436
513
  var secondTask = taskList[1].childNodes[0].childNodes[0];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ukhomeoffice/cop-react-form-renderer",
3
- "version": "5.82.0",
3
+ "version": "5.83.1",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "clean": "rimraf dist",