@ukhomeoffice/cop-react-form-renderer 5.29.0 → 5.33.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.
Files changed (47) hide show
  1. package/dist/components/CheckYourAnswers/CheckYourAnswers.js +2 -2
  2. package/dist/components/CheckYourAnswers/CheckYourAnswers.test.js +2 -2
  3. package/dist/components/CollectionPage/CollectionPage.js +2 -2
  4. package/dist/components/CollectionPage/CollectionPage.test.js +2 -2
  5. package/dist/components/CollectionSummary/BannerStrip.test.js +2 -2
  6. package/dist/components/CollectionSummary/CollectionSummary.js +4 -3
  7. package/dist/components/CollectionSummary/CollectionSummary.test.js +51 -2
  8. package/dist/components/CollectionSummary/Confirmation.js +4 -2
  9. package/dist/components/CollectionSummary/Confirmation.scss +1 -1
  10. package/dist/components/CollectionSummary/Confirmation.test.js +2 -2
  11. package/dist/components/CollectionSummary/SummaryCard.js +2 -2
  12. package/dist/components/CollectionSummary/SummaryCard.scss +4 -0
  13. package/dist/components/CollectionSummary/SummaryCard.test.js +2 -2
  14. package/dist/components/FormComponent/Collection.js +2 -2
  15. package/dist/components/FormComponent/FormComponent.js +4 -3
  16. package/dist/components/FormComponent/FormComponent.test.js +66 -34
  17. package/dist/components/FormPage/FormPage.js +2 -2
  18. package/dist/components/FormPage/FormPage.test.js +2 -2
  19. package/dist/components/FormRenderer/FormRenderer.js +9 -5
  20. package/dist/components/FormRenderer/FormRenderer.test.js +314 -136
  21. package/dist/components/FormRenderer/onCYAAction.js +20 -9
  22. package/dist/components/FormRenderer/onCYAAction.test.js +8 -1
  23. package/dist/components/FormRenderer/onPageAction.js +7 -2
  24. package/dist/components/FormRenderer/onPageAction.test.js +8 -1
  25. package/dist/components/PageActions/ActionButton.test.js +2 -2
  26. package/dist/components/SummaryList/GroupAction.js +2 -2
  27. package/dist/components/SummaryList/RowAction.js +2 -2
  28. package/dist/components/SummaryList/SummaryList.test.js +2 -2
  29. package/dist/components/TaskList/Task.js +2 -2
  30. package/dist/components/TaskList/TaskList.js +2 -2
  31. package/dist/components/TaskList/TaskList.test.js +2 -2
  32. package/dist/context/HooksContext/HooksContext.js +2 -2
  33. package/dist/context/HooksContext/HooksContext.test.js +2 -2
  34. package/dist/context/HooksContext/index.js +2 -2
  35. package/dist/context/ValidationContext/ValidationContext.js +2 -2
  36. package/dist/context/ValidationContext/ValidationContext.test.js +2 -2
  37. package/dist/context/ValidationContext/index.js +2 -2
  38. package/dist/hooks/index.js +2 -2
  39. package/dist/hooks/useRefData.js +2 -2
  40. package/dist/index.js +2 -2
  41. package/dist/utils/Component/cleanAttributes.test.js +2 -2
  42. package/dist/utils/Component/isEditable.test.js +2 -2
  43. package/dist/utils/Format/formatDataForComponent.test.js +2 -2
  44. package/dist/utils/Format/formatDataForPage.test.js +2 -2
  45. package/dist/utils/Validate/validateDate.test.js +2 -2
  46. package/dist/utils/Validate/validateMultifile.test.js +2 -2
  47. package/package.json +1 -1
@@ -18,9 +18,14 @@ var _userProfileData = _interopRequireDefault(require("../../json/userProfile.da
18
18
  var _userProfile = _interopRequireDefault(require("../../json/userProfile.json"));
19
19
  var _taskList = _interopRequireDefault(require("../../json/taskList.json"));
20
20
  var _firstForm = _interopRequireDefault(require("../../json/firstForm.json"));
21
- 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); }
22
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
21
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
22
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
23
23
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
24
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
25
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
26
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
27
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
28
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
24
29
  function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
25
30
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
26
31
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
@@ -54,6 +59,11 @@ var setDate = function setDate(element, date) {
54
59
  }
55
60
  });
56
61
  };
62
+ var sleep = function sleep(ms) {
63
+ return new Promise(function (resolve) {
64
+ setTimeout(resolve, ms);
65
+ });
66
+ };
57
67
  describe('components', function () {
58
68
  describe('FormRenderer', function () {
59
69
  var mockAxios = new _axiosMockAdapter.default(_axios.default);
@@ -346,10 +356,178 @@ describe('components', function () {
346
356
  }
347
357
  }, _callee10);
348
358
  })));
349
- it('should handle page navigation', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12() {
350
- var ON_PAGE_CHANGE_CALLS, ON_PAGE_CHANGE, HOOKS, form, hub, _hub$childNodes4, lineManagerList, link, page, pageHeading, continueButton, newPageHeading;
359
+ it('should handle a page submission once regardless of how many times page action is clicked', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12() {
360
+ var ON_PAGE_CHANGE_CALLS, ON_PAGE_CHANGE, ON_SUBMIT_CALLS, ON_SUBMIT, HOOKS, _container$childNodes, continueButtonGroup, continueFormButton, innerDiv, firstNameInput, EVENT, submitButton;
351
361
  return _regeneratorRuntime().wrap(function _callee12$(_context12) {
352
362
  while (1) switch (_context12.prev = _context12.next) {
363
+ case 0:
364
+ ON_PAGE_CHANGE_CALLS = [];
365
+ ON_PAGE_CHANGE = function ON_PAGE_CHANGE(pageId) {
366
+ ON_PAGE_CHANGE_CALLS.push(pageId);
367
+ };
368
+ ON_SUBMIT_CALLS = [];
369
+ ON_SUBMIT = /*#__PURE__*/function () {
370
+ var _ref12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(type, payload, onSuccess, onError, fieldName, fieldValue) {
371
+ return _regeneratorRuntime().wrap(function _callee11$(_context11) {
372
+ while (1) switch (_context11.prev = _context11.next) {
373
+ case 0:
374
+ ON_SUBMIT_CALLS.push({
375
+ type: type,
376
+ payload: payload,
377
+ onSuccess: onSuccess,
378
+ onError: onError,
379
+ fieldName: fieldName,
380
+ fieldValue: fieldValue
381
+ });
382
+
383
+ // mock a delay when submitting to the backend
384
+ _context11.next = 3;
385
+ return sleep(2000);
386
+ case 3:
387
+ onSuccess();
388
+ case 4:
389
+ case "end":
390
+ return _context11.stop();
391
+ }
392
+ }, _callee11);
393
+ }));
394
+ return function ON_SUBMIT(_x, _x2, _x3, _x4, _x5, _x6) {
395
+ return _ref12.apply(this, arguments);
396
+ };
397
+ }();
398
+ HOOKS = {
399
+ onSubmit: ON_SUBMIT,
400
+ onPageChange: ON_PAGE_CHANGE
401
+ };
402
+ (0, _testUtils.act)(function () {
403
+ (0, _reactDom.render)( /*#__PURE__*/_react2.default.createElement(_FormRenderer.default, _extends({}, _firstForm.default, {
404
+ hooks: HOOKS,
405
+ type: _models.FormTypes.CYA
406
+ })), container);
407
+ });
408
+ _container$childNodes = _slicedToArray(container.childNodes[0].childNodes[0].childNodes, 6), continueButtonGroup = _container$childNodes[5]; // go to first question page
409
+ continueFormButton = continueButtonGroup.childNodes[0];
410
+ _react.fireEvent.click(continueFormButton);
411
+ innerDiv = container.childNodes[0].childNodes[0]; // enter a value in the input field
412
+ firstNameInput = innerDiv.childNodes[1].childNodes[2];
413
+ EVENT = {
414
+ target: {
415
+ name: firstNameInput.id,
416
+ value: 'abc'
417
+ }
418
+ };
419
+ _react.fireEvent.change(firstNameInput, EVENT);
420
+ submitButton = innerDiv.childNodes[2].childNodes[0]; // click on save and continue
421
+ _react.fireEvent.click(submitButton);
422
+
423
+ // click on save and continue again
424
+ _react.fireEvent.click(submitButton);
425
+
426
+ // click on save and continue a third time
427
+ _react.fireEvent.click(submitButton);
428
+
429
+ // only expect one submit call to be made
430
+ expect(ON_SUBMIT_CALLS.length).toEqual(1);
431
+ expect(ON_PAGE_CHANGE_CALLS.length).toEqual(1);
432
+ expect(ON_SUBMIT_CALLS[0].type).toEqual(_models.PageAction.TYPES.SAVE_AND_CONTINUE);
433
+ case 20:
434
+ case "end":
435
+ return _context12.stop();
436
+ }
437
+ }, _callee12);
438
+ })));
439
+ it('should handle a page submission repeatedly if ignoreSubmittingFlag is true', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14() {
440
+ var ON_PAGE_CHANGE_CALLS, ON_PAGE_CHANGE, ON_SUBMIT_CALLS, ON_SUBMIT, HOOKS, formDefinition, form, hub, _hub$childNodes4, civilServantList, link, page, continueButton;
441
+ return _regeneratorRuntime().wrap(function _callee14$(_context14) {
442
+ while (1) switch (_context14.prev = _context14.next) {
443
+ case 0:
444
+ ON_PAGE_CHANGE_CALLS = [];
445
+ ON_PAGE_CHANGE = function ON_PAGE_CHANGE(pageId) {
446
+ ON_PAGE_CHANGE_CALLS.push(pageId);
447
+ };
448
+ ON_SUBMIT_CALLS = [];
449
+ ON_SUBMIT = /*#__PURE__*/function () {
450
+ var _ref14 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(type, payload, onSuccess, onError, fieldName, fieldValue) {
451
+ return _regeneratorRuntime().wrap(function _callee13$(_context13) {
452
+ while (1) switch (_context13.prev = _context13.next) {
453
+ case 0:
454
+ ON_SUBMIT_CALLS.push({
455
+ type: type,
456
+ payload: payload,
457
+ onSuccess: onSuccess,
458
+ onError: onError,
459
+ fieldName: fieldName,
460
+ fieldValue: fieldValue
461
+ });
462
+
463
+ // mock a delay when submitting to the backend
464
+ _context13.next = 3;
465
+ return sleep(2000);
466
+ case 3:
467
+ onSuccess();
468
+ case 4:
469
+ case "end":
470
+ return _context13.stop();
471
+ }
472
+ }, _callee13);
473
+ }));
474
+ return function ON_SUBMIT(_x7, _x8, _x9, _x10, _x11, _x12) {
475
+ return _ref14.apply(this, arguments);
476
+ };
477
+ }();
478
+ HOOKS = {
479
+ onSubmit: ON_SUBMIT,
480
+ onPageChange: ON_PAGE_CHANGE
481
+ };
482
+ formDefinition = _objectSpread({}, _userProfile.default);
483
+ formDefinition.pages[1].actions = [{
484
+ type: 'saveAndContinue',
485
+ page: 'test',
486
+ ignoreSubmittingFlag: true
487
+ }, {
488
+ type: 'cancel'
489
+ }];
490
+ (0, _testUtils.act)(function () {
491
+ (0, _reactDom.render)( /*#__PURE__*/_react2.default.createElement(_FormRenderer.default, _extends({}, formDefinition, {
492
+ data: _userProfileData.default,
493
+ hooks: HOOKS
494
+ })), container);
495
+ });
496
+ form = checkForm(container); // Navigate to the "Are you a civil servant?" page.
497
+ hub = form.childNodes[1]; // Hub = CYA
498
+ _hub$childNodes4 = _slicedToArray(hub.childNodes, 3), civilServantList = _hub$childNodes4[2];
499
+ link = getChangeLink(civilServantList);
500
+ _react.fireEvent.click(link, {});
501
+
502
+ // Should already be answered "Yes", so simply click "Continue".
503
+ page = form.childNodes[0];
504
+ continueButton = getContinueButton(page);
505
+ expect(ON_SUBMIT_CALLS.length).toEqual(0);
506
+ _react.fireEvent.click(continueButton, {});
507
+ expect(ON_SUBMIT_CALLS.length).toEqual(1);
508
+ expect(ON_SUBMIT_CALLS[0].type).toEqual(_models.PageAction.TYPES.SAVE_AND_CONTINUE);
509
+
510
+ // click on save and continue
511
+ _react.fireEvent.click(continueButton);
512
+
513
+ // click on save and continue again
514
+ _react.fireEvent.click(continueButton);
515
+
516
+ // click on save and continue a third time
517
+ _react.fireEvent.click(continueButton);
518
+
519
+ // expect all submit calls to be made
520
+ expect(ON_SUBMIT_CALLS.length).toEqual(4);
521
+ case 23:
522
+ case "end":
523
+ return _context14.stop();
524
+ }
525
+ }, _callee14);
526
+ })));
527
+ it('should handle page navigation', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16() {
528
+ var ON_PAGE_CHANGE_CALLS, ON_PAGE_CHANGE, HOOKS, form, hub, _hub$childNodes5, lineManagerList, link, page, pageHeading, continueButton, newPageHeading;
529
+ return _regeneratorRuntime().wrap(function _callee16$(_context16) {
530
+ while (1) switch (_context16.prev = _context16.next) {
353
531
  case 0:
354
532
  ON_PAGE_CHANGE_CALLS = [];
355
533
  ON_PAGE_CHANGE = function ON_PAGE_CHANGE(pageId) {
@@ -358,10 +536,10 @@ describe('components', function () {
358
536
  HOOKS = {
359
537
  onPageChange: ON_PAGE_CHANGE
360
538
  };
361
- _context12.next = 5;
362
- return (0, _testUtils.act)( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {
363
- return _regeneratorRuntime().wrap(function _callee11$(_context11) {
364
- while (1) switch (_context11.prev = _context11.next) {
539
+ _context16.next = 5;
540
+ return (0, _testUtils.act)( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15() {
541
+ return _regeneratorRuntime().wrap(function _callee15$(_context15) {
542
+ while (1) switch (_context15.prev = _context15.next) {
365
543
  case 0:
366
544
  (0, _reactDom.render)( /*#__PURE__*/_react2.default.createElement(_FormRenderer.default, _extends({}, _userProfile.default, {
367
545
  data: _userProfileData.default,
@@ -369,14 +547,14 @@ describe('components', function () {
369
547
  })), container);
370
548
  case 1:
371
549
  case "end":
372
- return _context11.stop();
550
+ return _context15.stop();
373
551
  }
374
- }, _callee11);
552
+ }, _callee15);
375
553
  })));
376
554
  case 5:
377
555
  form = checkForm(container); // Navigate to the "Add or change a line manager" page.
378
556
  hub = form.childNodes[1]; // Hub = CYA
379
- _hub$childNodes4 = _slicedToArray(hub.childNodes, 6), lineManagerList = _hub$childNodes4[5];
557
+ _hub$childNodes5 = _slicedToArray(hub.childNodes, 6), lineManagerList = _hub$childNodes5[5];
380
558
  link = getChangeLink(lineManagerList);
381
559
  expect(ON_PAGE_CHANGE_CALLS.length).toEqual(0);
382
560
  _react.fireEvent.click(link, {});
@@ -399,19 +577,19 @@ describe('components', function () {
399
577
  expect(newPageHeading.textContent).toEqual(_userProfile.default.pages[5].title);
400
578
  case 24:
401
579
  case "end":
402
- return _context12.stop();
580
+ return _context16.stop();
403
581
  }
404
- }, _callee12);
582
+ }, _callee16);
405
583
  })));
406
- it('should show no title when hide_title is set to true', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14() {
584
+ it('should show no title when hide_title is set to true', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18() {
407
585
  var form, hub;
408
- return _regeneratorRuntime().wrap(function _callee14$(_context14) {
409
- while (1) switch (_context14.prev = _context14.next) {
586
+ return _regeneratorRuntime().wrap(function _callee18$(_context18) {
587
+ while (1) switch (_context18.prev = _context18.next) {
410
588
  case 0:
411
- _context14.next = 2;
412
- return (0, _testUtils.act)( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13() {
413
- return _regeneratorRuntime().wrap(function _callee13$(_context13) {
414
- while (1) switch (_context13.prev = _context13.next) {
589
+ _context18.next = 2;
590
+ return (0, _testUtils.act)( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17() {
591
+ return _regeneratorRuntime().wrap(function _callee17$(_context17) {
592
+ while (1) switch (_context17.prev = _context17.next) {
415
593
  case 0:
416
594
  (0, _reactDom.render)( /*#__PURE__*/_react2.default.createElement(_FormRenderer.default, _extends({}, _userProfile.default, {
417
595
  data: _userProfileData.default,
@@ -419,9 +597,9 @@ describe('components', function () {
419
597
  })), container);
420
598
  case 1:
421
599
  case "end":
422
- return _context13.stop();
600
+ return _context17.stop();
423
601
  }
424
- }, _callee13);
602
+ }, _callee17);
425
603
  })));
426
604
  case 2:
427
605
  form = checkForm(container);
@@ -431,66 +609,66 @@ describe('components', function () {
431
609
  expect(hub.classList).toContain(_CheckYourAnswers.DEFAULT_CLASS);
432
610
  case 7:
433
611
  case "end":
434
- return _context14.stop();
612
+ return _context18.stop();
435
613
  }
436
- }, _callee14);
614
+ }, _callee18);
437
615
  })));
438
- it('should render a task list', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16() {
616
+ it('should render a task list', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20() {
439
617
  var taskList;
440
- return _regeneratorRuntime().wrap(function _callee16$(_context16) {
441
- while (1) switch (_context16.prev = _context16.next) {
618
+ return _regeneratorRuntime().wrap(function _callee20$(_context20) {
619
+ while (1) switch (_context20.prev = _context20.next) {
442
620
  case 0:
443
- _context16.next = 2;
444
- return (0, _testUtils.act)( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15() {
445
- return _regeneratorRuntime().wrap(function _callee15$(_context15) {
446
- while (1) switch (_context15.prev = _context15.next) {
621
+ _context20.next = 2;
622
+ return (0, _testUtils.act)( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19() {
623
+ return _regeneratorRuntime().wrap(function _callee19$(_context19) {
624
+ while (1) switch (_context19.prev = _context19.next) {
447
625
  case 0:
448
626
  (0, _reactDom.render)( /*#__PURE__*/_react2.default.createElement(_FormRenderer.default, _taskList.default), container);
449
627
  case 1:
450
628
  case "end":
451
- return _context15.stop();
629
+ return _context19.stop();
452
630
  }
453
- }, _callee15);
631
+ }, _callee19);
454
632
  })));
455
633
  case 2:
456
634
  taskList = container.childNodes[0].childNodes[1];
457
635
  expect(taskList.classList).toContain(_TaskList.DEFAULT_CLASS);
458
636
  case 4:
459
637
  case "end":
460
- return _context16.stop();
638
+ return _context20.stop();
461
639
  }
462
- }, _callee16);
640
+ }, _callee20);
463
641
  })));
464
- it('should render a cya page', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18() {
642
+ it('should render a cya page', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22() {
465
643
  var cya;
466
- return _regeneratorRuntime().wrap(function _callee18$(_context18) {
467
- while (1) switch (_context18.prev = _context18.next) {
644
+ return _regeneratorRuntime().wrap(function _callee22$(_context22) {
645
+ while (1) switch (_context22.prev = _context22.next) {
468
646
  case 0:
469
- _context18.next = 2;
470
- return (0, _testUtils.act)( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17() {
471
- return _regeneratorRuntime().wrap(function _callee17$(_context17) {
472
- while (1) switch (_context17.prev = _context17.next) {
647
+ _context22.next = 2;
648
+ return (0, _testUtils.act)( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21() {
649
+ return _regeneratorRuntime().wrap(function _callee21$(_context21) {
650
+ while (1) switch (_context21.prev = _context21.next) {
473
651
  case 0:
474
652
  (0, _reactDom.render)( /*#__PURE__*/_react2.default.createElement(_FormRenderer.default, _firstForm.default), container);
475
653
  case 1:
476
654
  case "end":
477
- return _context17.stop();
655
+ return _context21.stop();
478
656
  }
479
- }, _callee17);
657
+ }, _callee21);
480
658
  })));
481
659
  case 2:
482
660
  cya = container.childNodes[0];
483
661
  expect(cya.classList).toContain('hods-form');
484
662
  case 4:
485
663
  case "end":
486
- return _context18.stop();
664
+ return _context22.stop();
487
665
  }
488
- }, _callee18);
666
+ }, _callee22);
489
667
  })));
490
- it('should load task list with notes', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20() {
668
+ it('should load task list with notes', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24() {
491
669
  var ON_SUBMIT_CALLS, ON_SUBMIT, HOOKS, TASK_LIST_WITH_NOTES, taskList;
492
- return _regeneratorRuntime().wrap(function _callee20$(_context20) {
493
- while (1) switch (_context20.prev = _context20.next) {
670
+ return _regeneratorRuntime().wrap(function _callee24$(_context24) {
671
+ while (1) switch (_context24.prev = _context24.next) {
494
672
  case 0:
495
673
  ON_SUBMIT_CALLS = [];
496
674
  ON_SUBMIT = function ON_SUBMIT(type, payload, onSuccess) {
@@ -510,10 +688,10 @@ describe('components', function () {
510
688
  "value": "yes"
511
689
  }]
512
690
  };
513
- _context20.next = 7;
514
- return (0, _testUtils.act)( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19() {
515
- return _regeneratorRuntime().wrap(function _callee19$(_context19) {
516
- while (1) switch (_context19.prev = _context19.next) {
691
+ _context24.next = 7;
692
+ return (0, _testUtils.act)( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23() {
693
+ return _regeneratorRuntime().wrap(function _callee23$(_context23) {
694
+ while (1) switch (_context23.prev = _context23.next) {
517
695
  case 0:
518
696
  (0, _reactDom.render)( /*#__PURE__*/_react2.default.createElement(_FormRenderer.default, _extends({}, TASK_LIST_WITH_NOTES, {
519
697
  data: _userProfileData.default,
@@ -521,9 +699,9 @@ describe('components', function () {
521
699
  })), container);
522
700
  case 1:
523
701
  case "end":
524
- return _context19.stop();
702
+ return _context23.stop();
525
703
  }
526
- }, _callee19);
704
+ }, _callee23);
527
705
  })));
528
706
  case 7:
529
707
  taskList = container.childNodes[0].childNodes[1];
@@ -531,14 +709,14 @@ describe('components', function () {
531
709
  expect(taskList.childNodes[5].classList).toContain('govuk-textarea');
532
710
  case 10:
533
711
  case "end":
534
- return _context20.stop();
712
+ return _context24.stop();
535
713
  }
536
- }, _callee20);
714
+ }, _callee24);
537
715
  })));
538
- it('should not load task list with notes', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22() {
716
+ it('should not load task list with notes', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26() {
539
717
  var ON_SUBMIT_CALLS, ON_SUBMIT, HOOKS, TASK_LIST_WITH_NOTES, taskList;
540
- return _regeneratorRuntime().wrap(function _callee22$(_context22) {
541
- while (1) switch (_context22.prev = _context22.next) {
718
+ return _regeneratorRuntime().wrap(function _callee26$(_context26) {
719
+ while (1) switch (_context26.prev = _context26.next) {
542
720
  case 0:
543
721
  ON_SUBMIT_CALLS = [];
544
722
  ON_SUBMIT = function ON_SUBMIT(type, payload, onSuccess) {
@@ -558,10 +736,10 @@ describe('components', function () {
558
736
  "value": undefined
559
737
  }]
560
738
  };
561
- _context22.next = 7;
562
- return (0, _testUtils.act)( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21() {
563
- return _regeneratorRuntime().wrap(function _callee21$(_context21) {
564
- while (1) switch (_context21.prev = _context21.next) {
739
+ _context26.next = 7;
740
+ return (0, _testUtils.act)( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25() {
741
+ return _regeneratorRuntime().wrap(function _callee25$(_context25) {
742
+ while (1) switch (_context25.prev = _context25.next) {
565
743
  case 0:
566
744
  (0, _reactDom.render)( /*#__PURE__*/_react2.default.createElement(_FormRenderer.default, _extends({}, TASK_LIST_WITH_NOTES, {
567
745
  data: _userProfileData.default,
@@ -569,9 +747,9 @@ describe('components', function () {
569
747
  })), container);
570
748
  case 1:
571
749
  case "end":
572
- return _context21.stop();
750
+ return _context25.stop();
573
751
  }
574
- }, _callee21);
752
+ }, _callee25);
575
753
  })));
576
754
  case 7:
577
755
  taskList = container.childNodes[0].childNodes[1];
@@ -583,14 +761,14 @@ describe('components', function () {
583
761
  expect(taskList.childNodes[5].classList).not.toContain('govuk-textarea');
584
762
  case 11:
585
763
  case "end":
586
- return _context22.stop();
764
+ return _context26.stop();
587
765
  }
588
- }, _callee22);
766
+ }, _callee26);
589
767
  })));
590
- it('should handle navigating between task list pages', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24() {
768
+ it('should handle navigating between task list pages', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28() {
591
769
  var ON_SUBMIT_CALLS, ON_SUBMIT, HOOKS, taskList, firstTaskStatus, secondTaskStatus, firstTask, newPage, fieldset, continueButton, seaButton, cyaPageChange, modeChangeLink, changePage, airButton, cyaPage, finalSubmit;
592
- return _regeneratorRuntime().wrap(function _callee24$(_context24) {
593
- while (1) switch (_context24.prev = _context24.next) {
770
+ return _regeneratorRuntime().wrap(function _callee28$(_context28) {
771
+ while (1) switch (_context28.prev = _context28.next) {
594
772
  case 0:
595
773
  ON_SUBMIT_CALLS = [];
596
774
  ON_SUBMIT = function ON_SUBMIT(type, payload, onSuccess) {
@@ -600,19 +778,19 @@ describe('components', function () {
600
778
  HOOKS = {
601
779
  onSubmit: ON_SUBMIT
602
780
  };
603
- _context24.next = 5;
604
- return (0, _testUtils.act)( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23() {
605
- return _regeneratorRuntime().wrap(function _callee23$(_context23) {
606
- while (1) switch (_context23.prev = _context23.next) {
781
+ _context28.next = 5;
782
+ return (0, _testUtils.act)( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27() {
783
+ return _regeneratorRuntime().wrap(function _callee27$(_context27) {
784
+ while (1) switch (_context27.prev = _context27.next) {
607
785
  case 0:
608
786
  (0, _reactDom.render)( /*#__PURE__*/_react2.default.createElement(_FormRenderer.default, _extends({}, _taskList.default, {
609
787
  hooks: HOOKS
610
788
  })), container);
611
789
  case 1:
612
790
  case "end":
613
- return _context23.stop();
791
+ return _context27.stop();
614
792
  }
615
- }, _callee23);
793
+ }, _callee27);
616
794
  })));
617
795
  case 5:
618
796
  taskList = container.childNodes[0].childNodes[1]; // Check statuses are correct
@@ -683,14 +861,14 @@ describe('components', function () {
683
861
  expect(finalSubmit.formStatus.tasks['Date, location and mode details'].complete).toEqual(true);
684
862
  case 53:
685
863
  case "end":
686
- return _context24.stop();
864
+ return _context28.stop();
687
865
  }
688
- }, _callee24);
866
+ }, _callee28);
689
867
  })));
690
- it('should go straight to CYA page if a complete task is selected', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26() {
868
+ it('should go straight to CYA page if a complete task is selected', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30() {
691
869
  var ON_SUBMIT, HOOKS, taskList, newPage, fieldset;
692
- return _regeneratorRuntime().wrap(function _callee26$(_context26) {
693
- while (1) switch (_context26.prev = _context26.next) {
870
+ return _regeneratorRuntime().wrap(function _callee30$(_context30) {
871
+ while (1) switch (_context30.prev = _context30.next) {
694
872
  case 0:
695
873
  ON_SUBMIT = function ON_SUBMIT(type, payload, onSuccess) {
696
874
  onSuccess();
@@ -698,19 +876,19 @@ describe('components', function () {
698
876
  HOOKS = {
699
877
  onSubmit: ON_SUBMIT
700
878
  };
701
- _context26.next = 4;
702
- return (0, _testUtils.act)( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25() {
703
- return _regeneratorRuntime().wrap(function _callee25$(_context25) {
704
- while (1) switch (_context25.prev = _context25.next) {
879
+ _context30.next = 4;
880
+ return (0, _testUtils.act)( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29() {
881
+ return _regeneratorRuntime().wrap(function _callee29$(_context29) {
882
+ while (1) switch (_context29.prev = _context29.next) {
705
883
  case 0:
706
884
  (0, _reactDom.render)( /*#__PURE__*/_react2.default.createElement(_FormRenderer.default, _extends({}, _taskList.default, {
707
885
  hooks: HOOKS
708
886
  })), container);
709
887
  case 1:
710
888
  case "end":
711
- return _context25.stop();
889
+ return _context29.stop();
712
890
  }
713
- }, _callee25);
891
+ }, _callee29);
714
892
  })));
715
893
  case 4:
716
894
  taskList = container.childNodes[0].childNodes[1]; // Launch first task
@@ -739,14 +917,14 @@ describe('components', function () {
739
917
  expect(container.childNodes[0].childNodes[0].childNodes[0].textContent).toEqual('Check your answers');
740
918
  case 16:
741
919
  case "end":
742
- return _context26.stop();
920
+ return _context30.stop();
743
921
  }
744
- }, _callee26);
922
+ }, _callee30);
745
923
  })));
746
- it('should go to incomplete page when selecting in-progress task', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28() {
924
+ it('should go to incomplete page when selecting in-progress task', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32() {
747
925
  var ON_SUBMIT, HOOKS, DATA, taskList;
748
- return _regeneratorRuntime().wrap(function _callee28$(_context28) {
749
- while (1) switch (_context28.prev = _context28.next) {
926
+ return _regeneratorRuntime().wrap(function _callee32$(_context32) {
927
+ while (1) switch (_context32.prev = _context32.next) {
750
928
  case 0:
751
929
  ON_SUBMIT = function ON_SUBMIT(type, payload, onSuccess) {
752
930
  onSuccess();
@@ -766,10 +944,10 @@ describe('components', function () {
766
944
  "taskPage": "eventMode"
767
945
  }
768
946
  };
769
- _context28.next = 5;
770
- return (0, _testUtils.act)( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27() {
771
- return _regeneratorRuntime().wrap(function _callee27$(_context27) {
772
- while (1) switch (_context27.prev = _context27.next) {
947
+ _context32.next = 5;
948
+ return (0, _testUtils.act)( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31() {
949
+ return _regeneratorRuntime().wrap(function _callee31$(_context31) {
950
+ while (1) switch (_context31.prev = _context31.next) {
773
951
  case 0:
774
952
  (0, _reactDom.render)( /*#__PURE__*/_react2.default.createElement(_FormRenderer.default, _extends({}, _taskList.default, {
775
953
  hooks: HOOKS,
@@ -777,9 +955,9 @@ describe('components', function () {
777
955
  })), container);
778
956
  case 1:
779
957
  case "end":
780
- return _context27.stop();
958
+ return _context31.stop();
781
959
  }
782
- }, _callee27);
960
+ }, _callee31);
783
961
  })));
784
962
  case 5:
785
963
  taskList = container.childNodes[0].childNodes[1]; // Launch first task
@@ -789,14 +967,14 @@ describe('components', function () {
789
967
  expect(container.childNodes[0].childNodes[0].childNodes[0].textContent).toEqual('Event Mode');
790
968
  case 8:
791
969
  case "end":
792
- return _context28.stop();
970
+ return _context32.stop();
793
971
  }
794
- }, _callee28);
972
+ }, _callee32);
795
973
  })));
796
- it('should go to the first page of a complete task if noTaskCYAs specified', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30() {
974
+ it('should go to the first page of a complete task if noTaskCYAs specified', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34() {
797
975
  var ON_SUBMIT, HOOKS, TASK_LIST_WITH_NO_TASK_CYAS, taskList, newPage, fieldset;
798
- return _regeneratorRuntime().wrap(function _callee30$(_context30) {
799
- while (1) switch (_context30.prev = _context30.next) {
976
+ return _regeneratorRuntime().wrap(function _callee34$(_context34) {
977
+ while (1) switch (_context34.prev = _context34.next) {
800
978
  case 0:
801
979
  ON_SUBMIT = function ON_SUBMIT(type, payload, onSuccess) {
802
980
  onSuccess();
@@ -810,19 +988,19 @@ describe('components', function () {
810
988
  type: 'save',
811
989
  complete: true
812
990
  };
813
- _context30.next = 7;
814
- return (0, _testUtils.act)( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29() {
815
- return _regeneratorRuntime().wrap(function _callee29$(_context29) {
816
- while (1) switch (_context29.prev = _context29.next) {
991
+ _context34.next = 7;
992
+ return (0, _testUtils.act)( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33() {
993
+ return _regeneratorRuntime().wrap(function _callee33$(_context33) {
994
+ while (1) switch (_context33.prev = _context33.next) {
817
995
  case 0:
818
996
  (0, _reactDom.render)( /*#__PURE__*/_react2.default.createElement(_FormRenderer.default, _extends({}, TASK_LIST_WITH_NO_TASK_CYAS, {
819
997
  hooks: HOOKS
820
998
  })), container);
821
999
  case 1:
822
1000
  case "end":
823
- return _context29.stop();
1001
+ return _context33.stop();
824
1002
  }
825
- }, _callee29);
1003
+ }, _callee33);
826
1004
  })));
827
1005
  case 7:
828
1006
  taskList = container.childNodes[0].childNodes[1]; // Launch first task
@@ -847,14 +1025,14 @@ describe('components', function () {
847
1025
  expect(container.childNodes[0].childNodes[0].childNodes[0].textContent).toEqual('Event Date');
848
1026
  case 18:
849
1027
  case "end":
850
- return _context30.stop();
1028
+ return _context34.stop();
851
1029
  }
852
- }, _callee30);
1030
+ }, _callee34);
853
1031
  })));
854
- it('should handle cancellation from a page', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32() {
855
- var ON_CANCEL_CALLS, ON_CANCEL, HOOKS, form, hub, _hub$childNodes5, civilServantList, link, page, cancel;
856
- return _regeneratorRuntime().wrap(function _callee32$(_context32) {
857
- while (1) switch (_context32.prev = _context32.next) {
1032
+ it('should handle cancellation from a page', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36() {
1033
+ var ON_CANCEL_CALLS, ON_CANCEL, HOOKS, form, hub, _hub$childNodes6, civilServantList, link, page, cancel;
1034
+ return _regeneratorRuntime().wrap(function _callee36$(_context36) {
1035
+ while (1) switch (_context36.prev = _context36.next) {
858
1036
  case 0:
859
1037
  ON_CANCEL_CALLS = [];
860
1038
  ON_CANCEL = function ON_CANCEL() {
@@ -863,10 +1041,10 @@ describe('components', function () {
863
1041
  HOOKS = {
864
1042
  onCancel: ON_CANCEL
865
1043
  };
866
- _context32.next = 5;
867
- return (0, _testUtils.act)( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31() {
868
- return _regeneratorRuntime().wrap(function _callee31$(_context31) {
869
- while (1) switch (_context31.prev = _context31.next) {
1044
+ _context36.next = 5;
1045
+ return (0, _testUtils.act)( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35() {
1046
+ return _regeneratorRuntime().wrap(function _callee35$(_context35) {
1047
+ while (1) switch (_context35.prev = _context35.next) {
870
1048
  case 0:
871
1049
  (0, _reactDom.render)( /*#__PURE__*/_react2.default.createElement(_FormRenderer.default, _extends({}, _userProfile.default, {
872
1050
  data: _userProfileData.default,
@@ -874,14 +1052,14 @@ describe('components', function () {
874
1052
  })), container);
875
1053
  case 1:
876
1054
  case "end":
877
- return _context31.stop();
1055
+ return _context35.stop();
878
1056
  }
879
- }, _callee31);
1057
+ }, _callee35);
880
1058
  })));
881
1059
  case 5:
882
1060
  form = checkForm(container); // Navigate to the "Are you a civil servant?" page.
883
1061
  hub = form.childNodes[1]; // Hub = CYA
884
- _hub$childNodes5 = _slicedToArray(hub.childNodes, 3), civilServantList = _hub$childNodes5[2];
1062
+ _hub$childNodes6 = _slicedToArray(hub.childNodes, 3), civilServantList = _hub$childNodes6[2];
885
1063
  link = getChangeLink(civilServantList);
886
1064
  _react.fireEvent.click(link, {});
887
1065
 
@@ -893,14 +1071,14 @@ describe('components', function () {
893
1071
  expect(ON_CANCEL_CALLS.length).toEqual(1);
894
1072
  case 15:
895
1073
  case "end":
896
- return _context32.stop();
1074
+ return _context36.stop();
897
1075
  }
898
- }, _callee32);
1076
+ }, _callee36);
899
1077
  })));
900
- it('should navigate to a specific page at the beginning of a task if it is set as the firstPage of a task', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34() {
1078
+ it('should navigate to a specific page at the beginning of a task if it is set as the firstPage of a task', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38() {
901
1079
  var ON_SUBMIT_CALLS, ON_SUBMIT, HOOKS, TASK_LIST_NON_SEQUENTIAL, taskList, firstTask, newPage;
902
- return _regeneratorRuntime().wrap(function _callee34$(_context34) {
903
- while (1) switch (_context34.prev = _context34.next) {
1080
+ return _regeneratorRuntime().wrap(function _callee38$(_context38) {
1081
+ while (1) switch (_context38.prev = _context38.next) {
904
1082
  case 0:
905
1083
  ON_SUBMIT_CALLS = [];
906
1084
  ON_SUBMIT = function ON_SUBMIT(type, payload, onSuccess) {
@@ -912,19 +1090,19 @@ describe('components', function () {
912
1090
  };
913
1091
  TASK_LIST_NON_SEQUENTIAL = JSON.parse(JSON.stringify(_taskList.default));
914
1092
  TASK_LIST_NON_SEQUENTIAL.hub.nonSequential = true;
915
- _context34.next = 7;
916
- return (0, _testUtils.act)( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33() {
917
- return _regeneratorRuntime().wrap(function _callee33$(_context33) {
918
- while (1) switch (_context33.prev = _context33.next) {
1093
+ _context38.next = 7;
1094
+ return (0, _testUtils.act)( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37() {
1095
+ return _regeneratorRuntime().wrap(function _callee37$(_context37) {
1096
+ while (1) switch (_context37.prev = _context37.next) {
919
1097
  case 0:
920
1098
  (0, _reactDom.render)( /*#__PURE__*/_react2.default.createElement(_FormRenderer.default, _extends({}, TASK_LIST_NON_SEQUENTIAL, {
921
1099
  hooks: HOOKS
922
1100
  })), container);
923
1101
  case 1:
924
1102
  case "end":
925
- return _context33.stop();
1103
+ return _context37.stop();
926
1104
  }
927
- }, _callee33);
1105
+ }, _callee37);
928
1106
  })));
929
1107
  case 7:
930
1108
  taskList = container.childNodes[0].childNodes[1]; // Launch first task of second section
@@ -937,9 +1115,9 @@ describe('components', function () {
937
1115
  expect(newPage.childNodes[0].textContent).toEqual('Surname');
938
1116
  case 13:
939
1117
  case "end":
940
- return _context34.stop();
1118
+ return _context38.stop();
941
1119
  }
942
- }, _callee34);
1120
+ }, _callee38);
943
1121
  })));
944
1122
  });
945
1123
  });