@ukhomeoffice/cop-react-form-renderer 5.32.0 → 5.34.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.
- package/dist/components/CollectionSummary/BannerStrip.js +4 -1
- package/dist/components/CollectionSummary/BannerStrip.scss +5 -1
- package/dist/components/CollectionSummary/BannerStrip.test.js +15 -0
- package/dist/components/FormRenderer/FormRenderer.test.js +227 -134
- package/dist/components/FormRenderer/onPageAction.js +1 -1
- package/package.json +2 -2
|
@@ -24,10 +24,13 @@ var BannerStrip = function BannerStrip(_ref) {
|
|
|
24
24
|
formData = _ref.formData,
|
|
25
25
|
classModifiers = _ref.classModifiers;
|
|
26
26
|
var classes = _utils.default.classBuilder(DEFAULT_CLASS, classModifiers, '');
|
|
27
|
+
var filteredBanners = banners.filter(function (banner) {
|
|
28
|
+
return _utils.default.Component.show(banner, formData);
|
|
29
|
+
});
|
|
27
30
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
28
31
|
id: id,
|
|
29
32
|
className: classes()
|
|
30
|
-
},
|
|
33
|
+
}, filteredBanners.map(function (banner, index) {
|
|
31
34
|
var bannerId = "".concat(id, "-banner-").concat(index);
|
|
32
35
|
if (typeof banner === 'string') {
|
|
33
36
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -108,4 +108,19 @@ describe('components.CollectionSummary.BannerStrip', function () {
|
|
|
108
108
|
expect(bannerStripDiv.classList).toContain(_BannerStrip.DEFAULT_CLASS);
|
|
109
109
|
expect(bannerStripDiv.children.length).toEqual(0);
|
|
110
110
|
});
|
|
111
|
+
it('should correctly render a BannerStrip component with a plain string banner', function () {
|
|
112
|
+
var PLAIN_STRING_BANNER = 'banner';
|
|
113
|
+
var _renderWithValidation5 = (0, _setupTests.renderWithValidation)( /*#__PURE__*/_react.default.createElement(_BannerStrip.default, {
|
|
114
|
+
id: ID,
|
|
115
|
+
banners: [PLAIN_STRING_BANNER],
|
|
116
|
+
formData: FORM_DATA
|
|
117
|
+
})),
|
|
118
|
+
container = _renderWithValidation5.container;
|
|
119
|
+
var bannerStripDiv = checkSetup(container);
|
|
120
|
+
expect(bannerStripDiv.children.length).toEqual(1); // One banner provided.
|
|
121
|
+
var plainStringBanner = bannerStripDiv.children[0];
|
|
122
|
+
expect(plainStringBanner.tagName).toEqual('DIV');
|
|
123
|
+
expect(plainStringBanner.classList.contains(classes('banner'))).toBe(true);
|
|
124
|
+
expect(plainStringBanner.textContent).toEqual(PLAIN_STRING_BANNER);
|
|
125
|
+
});
|
|
111
126
|
});
|
|
@@ -21,6 +21,11 @@ var _firstForm = _interopRequireDefault(require("../../json/firstForm.json"));
|
|
|
21
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
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); } }
|
|
@@ -431,10 +436,98 @@ describe('components', function () {
|
|
|
431
436
|
}
|
|
432
437
|
}, _callee12);
|
|
433
438
|
})));
|
|
434
|
-
it('should handle page
|
|
435
|
-
var ON_PAGE_CHANGE_CALLS, ON_PAGE_CHANGE, HOOKS, form, hub, _hub$childNodes4,
|
|
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;
|
|
436
441
|
return _regeneratorRuntime().wrap(function _callee14$(_context14) {
|
|
437
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) {
|
|
438
531
|
case 0:
|
|
439
532
|
ON_PAGE_CHANGE_CALLS = [];
|
|
440
533
|
ON_PAGE_CHANGE = function ON_PAGE_CHANGE(pageId) {
|
|
@@ -443,10 +536,10 @@ describe('components', function () {
|
|
|
443
536
|
HOOKS = {
|
|
444
537
|
onPageChange: ON_PAGE_CHANGE
|
|
445
538
|
};
|
|
446
|
-
|
|
447
|
-
return (0, _testUtils.act)( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
448
|
-
return _regeneratorRuntime().wrap(function
|
|
449
|
-
while (1) switch (
|
|
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) {
|
|
450
543
|
case 0:
|
|
451
544
|
(0, _reactDom.render)( /*#__PURE__*/_react2.default.createElement(_FormRenderer.default, _extends({}, _userProfile.default, {
|
|
452
545
|
data: _userProfileData.default,
|
|
@@ -454,14 +547,14 @@ describe('components', function () {
|
|
|
454
547
|
})), container);
|
|
455
548
|
case 1:
|
|
456
549
|
case "end":
|
|
457
|
-
return
|
|
550
|
+
return _context15.stop();
|
|
458
551
|
}
|
|
459
|
-
},
|
|
552
|
+
}, _callee15);
|
|
460
553
|
})));
|
|
461
554
|
case 5:
|
|
462
555
|
form = checkForm(container); // Navigate to the "Add or change a line manager" page.
|
|
463
556
|
hub = form.childNodes[1]; // Hub = CYA
|
|
464
|
-
_hub$
|
|
557
|
+
_hub$childNodes5 = _slicedToArray(hub.childNodes, 6), lineManagerList = _hub$childNodes5[5];
|
|
465
558
|
link = getChangeLink(lineManagerList);
|
|
466
559
|
expect(ON_PAGE_CHANGE_CALLS.length).toEqual(0);
|
|
467
560
|
_react.fireEvent.click(link, {});
|
|
@@ -484,19 +577,19 @@ describe('components', function () {
|
|
|
484
577
|
expect(newPageHeading.textContent).toEqual(_userProfile.default.pages[5].title);
|
|
485
578
|
case 24:
|
|
486
579
|
case "end":
|
|
487
|
-
return
|
|
580
|
+
return _context16.stop();
|
|
488
581
|
}
|
|
489
|
-
},
|
|
582
|
+
}, _callee16);
|
|
490
583
|
})));
|
|
491
|
-
it('should show no title when hide_title is set to true', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
584
|
+
it('should show no title when hide_title is set to true', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18() {
|
|
492
585
|
var form, hub;
|
|
493
|
-
return _regeneratorRuntime().wrap(function
|
|
494
|
-
while (1) switch (
|
|
586
|
+
return _regeneratorRuntime().wrap(function _callee18$(_context18) {
|
|
587
|
+
while (1) switch (_context18.prev = _context18.next) {
|
|
495
588
|
case 0:
|
|
496
|
-
|
|
497
|
-
return (0, _testUtils.act)( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
498
|
-
return _regeneratorRuntime().wrap(function
|
|
499
|
-
while (1) switch (
|
|
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) {
|
|
500
593
|
case 0:
|
|
501
594
|
(0, _reactDom.render)( /*#__PURE__*/_react2.default.createElement(_FormRenderer.default, _extends({}, _userProfile.default, {
|
|
502
595
|
data: _userProfileData.default,
|
|
@@ -504,9 +597,9 @@ describe('components', function () {
|
|
|
504
597
|
})), container);
|
|
505
598
|
case 1:
|
|
506
599
|
case "end":
|
|
507
|
-
return
|
|
600
|
+
return _context17.stop();
|
|
508
601
|
}
|
|
509
|
-
},
|
|
602
|
+
}, _callee17);
|
|
510
603
|
})));
|
|
511
604
|
case 2:
|
|
512
605
|
form = checkForm(container);
|
|
@@ -516,66 +609,66 @@ describe('components', function () {
|
|
|
516
609
|
expect(hub.classList).toContain(_CheckYourAnswers.DEFAULT_CLASS);
|
|
517
610
|
case 7:
|
|
518
611
|
case "end":
|
|
519
|
-
return
|
|
612
|
+
return _context18.stop();
|
|
520
613
|
}
|
|
521
|
-
},
|
|
614
|
+
}, _callee18);
|
|
522
615
|
})));
|
|
523
|
-
it('should render a task list', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
616
|
+
it('should render a task list', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20() {
|
|
524
617
|
var taskList;
|
|
525
|
-
return _regeneratorRuntime().wrap(function
|
|
526
|
-
while (1) switch (
|
|
618
|
+
return _regeneratorRuntime().wrap(function _callee20$(_context20) {
|
|
619
|
+
while (1) switch (_context20.prev = _context20.next) {
|
|
527
620
|
case 0:
|
|
528
|
-
|
|
529
|
-
return (0, _testUtils.act)( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
530
|
-
return _regeneratorRuntime().wrap(function
|
|
531
|
-
while (1) switch (
|
|
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) {
|
|
532
625
|
case 0:
|
|
533
626
|
(0, _reactDom.render)( /*#__PURE__*/_react2.default.createElement(_FormRenderer.default, _taskList.default), container);
|
|
534
627
|
case 1:
|
|
535
628
|
case "end":
|
|
536
|
-
return
|
|
629
|
+
return _context19.stop();
|
|
537
630
|
}
|
|
538
|
-
},
|
|
631
|
+
}, _callee19);
|
|
539
632
|
})));
|
|
540
633
|
case 2:
|
|
541
634
|
taskList = container.childNodes[0].childNodes[1];
|
|
542
635
|
expect(taskList.classList).toContain(_TaskList.DEFAULT_CLASS);
|
|
543
636
|
case 4:
|
|
544
637
|
case "end":
|
|
545
|
-
return
|
|
638
|
+
return _context20.stop();
|
|
546
639
|
}
|
|
547
|
-
},
|
|
640
|
+
}, _callee20);
|
|
548
641
|
})));
|
|
549
|
-
it('should render a cya page', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
642
|
+
it('should render a cya page', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22() {
|
|
550
643
|
var cya;
|
|
551
|
-
return _regeneratorRuntime().wrap(function
|
|
552
|
-
while (1) switch (
|
|
644
|
+
return _regeneratorRuntime().wrap(function _callee22$(_context22) {
|
|
645
|
+
while (1) switch (_context22.prev = _context22.next) {
|
|
553
646
|
case 0:
|
|
554
|
-
|
|
555
|
-
return (0, _testUtils.act)( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
556
|
-
return _regeneratorRuntime().wrap(function
|
|
557
|
-
while (1) switch (
|
|
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) {
|
|
558
651
|
case 0:
|
|
559
652
|
(0, _reactDom.render)( /*#__PURE__*/_react2.default.createElement(_FormRenderer.default, _firstForm.default), container);
|
|
560
653
|
case 1:
|
|
561
654
|
case "end":
|
|
562
|
-
return
|
|
655
|
+
return _context21.stop();
|
|
563
656
|
}
|
|
564
|
-
},
|
|
657
|
+
}, _callee21);
|
|
565
658
|
})));
|
|
566
659
|
case 2:
|
|
567
660
|
cya = container.childNodes[0];
|
|
568
661
|
expect(cya.classList).toContain('hods-form');
|
|
569
662
|
case 4:
|
|
570
663
|
case "end":
|
|
571
|
-
return
|
|
664
|
+
return _context22.stop();
|
|
572
665
|
}
|
|
573
|
-
},
|
|
666
|
+
}, _callee22);
|
|
574
667
|
})));
|
|
575
|
-
it('should load task list with notes', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
668
|
+
it('should load task list with notes', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24() {
|
|
576
669
|
var ON_SUBMIT_CALLS, ON_SUBMIT, HOOKS, TASK_LIST_WITH_NOTES, taskList;
|
|
577
|
-
return _regeneratorRuntime().wrap(function
|
|
578
|
-
while (1) switch (
|
|
670
|
+
return _regeneratorRuntime().wrap(function _callee24$(_context24) {
|
|
671
|
+
while (1) switch (_context24.prev = _context24.next) {
|
|
579
672
|
case 0:
|
|
580
673
|
ON_SUBMIT_CALLS = [];
|
|
581
674
|
ON_SUBMIT = function ON_SUBMIT(type, payload, onSuccess) {
|
|
@@ -595,10 +688,10 @@ describe('components', function () {
|
|
|
595
688
|
"value": "yes"
|
|
596
689
|
}]
|
|
597
690
|
};
|
|
598
|
-
|
|
599
|
-
return (0, _testUtils.act)( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
600
|
-
return _regeneratorRuntime().wrap(function
|
|
601
|
-
while (1) switch (
|
|
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) {
|
|
602
695
|
case 0:
|
|
603
696
|
(0, _reactDom.render)( /*#__PURE__*/_react2.default.createElement(_FormRenderer.default, _extends({}, TASK_LIST_WITH_NOTES, {
|
|
604
697
|
data: _userProfileData.default,
|
|
@@ -606,9 +699,9 @@ describe('components', function () {
|
|
|
606
699
|
})), container);
|
|
607
700
|
case 1:
|
|
608
701
|
case "end":
|
|
609
|
-
return
|
|
702
|
+
return _context23.stop();
|
|
610
703
|
}
|
|
611
|
-
},
|
|
704
|
+
}, _callee23);
|
|
612
705
|
})));
|
|
613
706
|
case 7:
|
|
614
707
|
taskList = container.childNodes[0].childNodes[1];
|
|
@@ -616,14 +709,14 @@ describe('components', function () {
|
|
|
616
709
|
expect(taskList.childNodes[5].classList).toContain('govuk-textarea');
|
|
617
710
|
case 10:
|
|
618
711
|
case "end":
|
|
619
|
-
return
|
|
712
|
+
return _context24.stop();
|
|
620
713
|
}
|
|
621
|
-
},
|
|
714
|
+
}, _callee24);
|
|
622
715
|
})));
|
|
623
|
-
it('should not load task list with notes', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
716
|
+
it('should not load task list with notes', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26() {
|
|
624
717
|
var ON_SUBMIT_CALLS, ON_SUBMIT, HOOKS, TASK_LIST_WITH_NOTES, taskList;
|
|
625
|
-
return _regeneratorRuntime().wrap(function
|
|
626
|
-
while (1) switch (
|
|
718
|
+
return _regeneratorRuntime().wrap(function _callee26$(_context26) {
|
|
719
|
+
while (1) switch (_context26.prev = _context26.next) {
|
|
627
720
|
case 0:
|
|
628
721
|
ON_SUBMIT_CALLS = [];
|
|
629
722
|
ON_SUBMIT = function ON_SUBMIT(type, payload, onSuccess) {
|
|
@@ -643,10 +736,10 @@ describe('components', function () {
|
|
|
643
736
|
"value": undefined
|
|
644
737
|
}]
|
|
645
738
|
};
|
|
646
|
-
|
|
647
|
-
return (0, _testUtils.act)( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
648
|
-
return _regeneratorRuntime().wrap(function
|
|
649
|
-
while (1) switch (
|
|
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) {
|
|
650
743
|
case 0:
|
|
651
744
|
(0, _reactDom.render)( /*#__PURE__*/_react2.default.createElement(_FormRenderer.default, _extends({}, TASK_LIST_WITH_NOTES, {
|
|
652
745
|
data: _userProfileData.default,
|
|
@@ -654,9 +747,9 @@ describe('components', function () {
|
|
|
654
747
|
})), container);
|
|
655
748
|
case 1:
|
|
656
749
|
case "end":
|
|
657
|
-
return
|
|
750
|
+
return _context25.stop();
|
|
658
751
|
}
|
|
659
|
-
},
|
|
752
|
+
}, _callee25);
|
|
660
753
|
})));
|
|
661
754
|
case 7:
|
|
662
755
|
taskList = container.childNodes[0].childNodes[1];
|
|
@@ -668,14 +761,14 @@ describe('components', function () {
|
|
|
668
761
|
expect(taskList.childNodes[5].classList).not.toContain('govuk-textarea');
|
|
669
762
|
case 11:
|
|
670
763
|
case "end":
|
|
671
|
-
return
|
|
764
|
+
return _context26.stop();
|
|
672
765
|
}
|
|
673
|
-
},
|
|
766
|
+
}, _callee26);
|
|
674
767
|
})));
|
|
675
|
-
it('should handle navigating between task list pages', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
768
|
+
it('should handle navigating between task list pages', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28() {
|
|
676
769
|
var ON_SUBMIT_CALLS, ON_SUBMIT, HOOKS, taskList, firstTaskStatus, secondTaskStatus, firstTask, newPage, fieldset, continueButton, seaButton, cyaPageChange, modeChangeLink, changePage, airButton, cyaPage, finalSubmit;
|
|
677
|
-
return _regeneratorRuntime().wrap(function
|
|
678
|
-
while (1) switch (
|
|
770
|
+
return _regeneratorRuntime().wrap(function _callee28$(_context28) {
|
|
771
|
+
while (1) switch (_context28.prev = _context28.next) {
|
|
679
772
|
case 0:
|
|
680
773
|
ON_SUBMIT_CALLS = [];
|
|
681
774
|
ON_SUBMIT = function ON_SUBMIT(type, payload, onSuccess) {
|
|
@@ -685,19 +778,19 @@ describe('components', function () {
|
|
|
685
778
|
HOOKS = {
|
|
686
779
|
onSubmit: ON_SUBMIT
|
|
687
780
|
};
|
|
688
|
-
|
|
689
|
-
return (0, _testUtils.act)( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
690
|
-
return _regeneratorRuntime().wrap(function
|
|
691
|
-
while (1) switch (
|
|
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) {
|
|
692
785
|
case 0:
|
|
693
786
|
(0, _reactDom.render)( /*#__PURE__*/_react2.default.createElement(_FormRenderer.default, _extends({}, _taskList.default, {
|
|
694
787
|
hooks: HOOKS
|
|
695
788
|
})), container);
|
|
696
789
|
case 1:
|
|
697
790
|
case "end":
|
|
698
|
-
return
|
|
791
|
+
return _context27.stop();
|
|
699
792
|
}
|
|
700
|
-
},
|
|
793
|
+
}, _callee27);
|
|
701
794
|
})));
|
|
702
795
|
case 5:
|
|
703
796
|
taskList = container.childNodes[0].childNodes[1]; // Check statuses are correct
|
|
@@ -768,14 +861,14 @@ describe('components', function () {
|
|
|
768
861
|
expect(finalSubmit.formStatus.tasks['Date, location and mode details'].complete).toEqual(true);
|
|
769
862
|
case 53:
|
|
770
863
|
case "end":
|
|
771
|
-
return
|
|
864
|
+
return _context28.stop();
|
|
772
865
|
}
|
|
773
|
-
},
|
|
866
|
+
}, _callee28);
|
|
774
867
|
})));
|
|
775
|
-
it('should go straight to CYA page if a complete task is selected', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
868
|
+
it('should go straight to CYA page if a complete task is selected', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30() {
|
|
776
869
|
var ON_SUBMIT, HOOKS, taskList, newPage, fieldset;
|
|
777
|
-
return _regeneratorRuntime().wrap(function
|
|
778
|
-
while (1) switch (
|
|
870
|
+
return _regeneratorRuntime().wrap(function _callee30$(_context30) {
|
|
871
|
+
while (1) switch (_context30.prev = _context30.next) {
|
|
779
872
|
case 0:
|
|
780
873
|
ON_SUBMIT = function ON_SUBMIT(type, payload, onSuccess) {
|
|
781
874
|
onSuccess();
|
|
@@ -783,19 +876,19 @@ describe('components', function () {
|
|
|
783
876
|
HOOKS = {
|
|
784
877
|
onSubmit: ON_SUBMIT
|
|
785
878
|
};
|
|
786
|
-
|
|
787
|
-
return (0, _testUtils.act)( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
788
|
-
return _regeneratorRuntime().wrap(function
|
|
789
|
-
while (1) switch (
|
|
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) {
|
|
790
883
|
case 0:
|
|
791
884
|
(0, _reactDom.render)( /*#__PURE__*/_react2.default.createElement(_FormRenderer.default, _extends({}, _taskList.default, {
|
|
792
885
|
hooks: HOOKS
|
|
793
886
|
})), container);
|
|
794
887
|
case 1:
|
|
795
888
|
case "end":
|
|
796
|
-
return
|
|
889
|
+
return _context29.stop();
|
|
797
890
|
}
|
|
798
|
-
},
|
|
891
|
+
}, _callee29);
|
|
799
892
|
})));
|
|
800
893
|
case 4:
|
|
801
894
|
taskList = container.childNodes[0].childNodes[1]; // Launch first task
|
|
@@ -824,14 +917,14 @@ describe('components', function () {
|
|
|
824
917
|
expect(container.childNodes[0].childNodes[0].childNodes[0].textContent).toEqual('Check your answers');
|
|
825
918
|
case 16:
|
|
826
919
|
case "end":
|
|
827
|
-
return
|
|
920
|
+
return _context30.stop();
|
|
828
921
|
}
|
|
829
|
-
},
|
|
922
|
+
}, _callee30);
|
|
830
923
|
})));
|
|
831
|
-
it('should go to incomplete page when selecting in-progress task', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
924
|
+
it('should go to incomplete page when selecting in-progress task', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32() {
|
|
832
925
|
var ON_SUBMIT, HOOKS, DATA, taskList;
|
|
833
|
-
return _regeneratorRuntime().wrap(function
|
|
834
|
-
while (1) switch (
|
|
926
|
+
return _regeneratorRuntime().wrap(function _callee32$(_context32) {
|
|
927
|
+
while (1) switch (_context32.prev = _context32.next) {
|
|
835
928
|
case 0:
|
|
836
929
|
ON_SUBMIT = function ON_SUBMIT(type, payload, onSuccess) {
|
|
837
930
|
onSuccess();
|
|
@@ -851,10 +944,10 @@ describe('components', function () {
|
|
|
851
944
|
"taskPage": "eventMode"
|
|
852
945
|
}
|
|
853
946
|
};
|
|
854
|
-
|
|
855
|
-
return (0, _testUtils.act)( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
856
|
-
return _regeneratorRuntime().wrap(function
|
|
857
|
-
while (1) switch (
|
|
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) {
|
|
858
951
|
case 0:
|
|
859
952
|
(0, _reactDom.render)( /*#__PURE__*/_react2.default.createElement(_FormRenderer.default, _extends({}, _taskList.default, {
|
|
860
953
|
hooks: HOOKS,
|
|
@@ -862,9 +955,9 @@ describe('components', function () {
|
|
|
862
955
|
})), container);
|
|
863
956
|
case 1:
|
|
864
957
|
case "end":
|
|
865
|
-
return
|
|
958
|
+
return _context31.stop();
|
|
866
959
|
}
|
|
867
|
-
},
|
|
960
|
+
}, _callee31);
|
|
868
961
|
})));
|
|
869
962
|
case 5:
|
|
870
963
|
taskList = container.childNodes[0].childNodes[1]; // Launch first task
|
|
@@ -874,14 +967,14 @@ describe('components', function () {
|
|
|
874
967
|
expect(container.childNodes[0].childNodes[0].childNodes[0].textContent).toEqual('Event Mode');
|
|
875
968
|
case 8:
|
|
876
969
|
case "end":
|
|
877
|
-
return
|
|
970
|
+
return _context32.stop();
|
|
878
971
|
}
|
|
879
|
-
},
|
|
972
|
+
}, _callee32);
|
|
880
973
|
})));
|
|
881
|
-
it('should go to the first page of a complete task if noTaskCYAs specified', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
974
|
+
it('should go to the first page of a complete task if noTaskCYAs specified', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34() {
|
|
882
975
|
var ON_SUBMIT, HOOKS, TASK_LIST_WITH_NO_TASK_CYAS, taskList, newPage, fieldset;
|
|
883
|
-
return _regeneratorRuntime().wrap(function
|
|
884
|
-
while (1) switch (
|
|
976
|
+
return _regeneratorRuntime().wrap(function _callee34$(_context34) {
|
|
977
|
+
while (1) switch (_context34.prev = _context34.next) {
|
|
885
978
|
case 0:
|
|
886
979
|
ON_SUBMIT = function ON_SUBMIT(type, payload, onSuccess) {
|
|
887
980
|
onSuccess();
|
|
@@ -895,19 +988,19 @@ describe('components', function () {
|
|
|
895
988
|
type: 'save',
|
|
896
989
|
complete: true
|
|
897
990
|
};
|
|
898
|
-
|
|
899
|
-
return (0, _testUtils.act)( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
900
|
-
return _regeneratorRuntime().wrap(function
|
|
901
|
-
while (1) switch (
|
|
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) {
|
|
902
995
|
case 0:
|
|
903
996
|
(0, _reactDom.render)( /*#__PURE__*/_react2.default.createElement(_FormRenderer.default, _extends({}, TASK_LIST_WITH_NO_TASK_CYAS, {
|
|
904
997
|
hooks: HOOKS
|
|
905
998
|
})), container);
|
|
906
999
|
case 1:
|
|
907
1000
|
case "end":
|
|
908
|
-
return
|
|
1001
|
+
return _context33.stop();
|
|
909
1002
|
}
|
|
910
|
-
},
|
|
1003
|
+
}, _callee33);
|
|
911
1004
|
})));
|
|
912
1005
|
case 7:
|
|
913
1006
|
taskList = container.childNodes[0].childNodes[1]; // Launch first task
|
|
@@ -932,14 +1025,14 @@ describe('components', function () {
|
|
|
932
1025
|
expect(container.childNodes[0].childNodes[0].childNodes[0].textContent).toEqual('Event Date');
|
|
933
1026
|
case 18:
|
|
934
1027
|
case "end":
|
|
935
|
-
return
|
|
1028
|
+
return _context34.stop();
|
|
936
1029
|
}
|
|
937
|
-
},
|
|
1030
|
+
}, _callee34);
|
|
938
1031
|
})));
|
|
939
|
-
it('should handle cancellation from a page', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
940
|
-
var ON_CANCEL_CALLS, ON_CANCEL, HOOKS, form, hub, _hub$
|
|
941
|
-
return _regeneratorRuntime().wrap(function
|
|
942
|
-
while (1) switch (
|
|
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) {
|
|
943
1036
|
case 0:
|
|
944
1037
|
ON_CANCEL_CALLS = [];
|
|
945
1038
|
ON_CANCEL = function ON_CANCEL() {
|
|
@@ -948,10 +1041,10 @@ describe('components', function () {
|
|
|
948
1041
|
HOOKS = {
|
|
949
1042
|
onCancel: ON_CANCEL
|
|
950
1043
|
};
|
|
951
|
-
|
|
952
|
-
return (0, _testUtils.act)( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
953
|
-
return _regeneratorRuntime().wrap(function
|
|
954
|
-
while (1) switch (
|
|
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) {
|
|
955
1048
|
case 0:
|
|
956
1049
|
(0, _reactDom.render)( /*#__PURE__*/_react2.default.createElement(_FormRenderer.default, _extends({}, _userProfile.default, {
|
|
957
1050
|
data: _userProfileData.default,
|
|
@@ -959,14 +1052,14 @@ describe('components', function () {
|
|
|
959
1052
|
})), container);
|
|
960
1053
|
case 1:
|
|
961
1054
|
case "end":
|
|
962
|
-
return
|
|
1055
|
+
return _context35.stop();
|
|
963
1056
|
}
|
|
964
|
-
},
|
|
1057
|
+
}, _callee35);
|
|
965
1058
|
})));
|
|
966
1059
|
case 5:
|
|
967
1060
|
form = checkForm(container); // Navigate to the "Are you a civil servant?" page.
|
|
968
1061
|
hub = form.childNodes[1]; // Hub = CYA
|
|
969
|
-
_hub$
|
|
1062
|
+
_hub$childNodes6 = _slicedToArray(hub.childNodes, 3), civilServantList = _hub$childNodes6[2];
|
|
970
1063
|
link = getChangeLink(civilServantList);
|
|
971
1064
|
_react.fireEvent.click(link, {});
|
|
972
1065
|
|
|
@@ -978,14 +1071,14 @@ describe('components', function () {
|
|
|
978
1071
|
expect(ON_CANCEL_CALLS.length).toEqual(1);
|
|
979
1072
|
case 15:
|
|
980
1073
|
case "end":
|
|
981
|
-
return
|
|
1074
|
+
return _context36.stop();
|
|
982
1075
|
}
|
|
983
|
-
},
|
|
1076
|
+
}, _callee36);
|
|
984
1077
|
})));
|
|
985
|
-
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
|
|
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() {
|
|
986
1079
|
var ON_SUBMIT_CALLS, ON_SUBMIT, HOOKS, TASK_LIST_NON_SEQUENTIAL, taskList, firstTask, newPage;
|
|
987
|
-
return _regeneratorRuntime().wrap(function
|
|
988
|
-
while (1) switch (
|
|
1080
|
+
return _regeneratorRuntime().wrap(function _callee38$(_context38) {
|
|
1081
|
+
while (1) switch (_context38.prev = _context38.next) {
|
|
989
1082
|
case 0:
|
|
990
1083
|
ON_SUBMIT_CALLS = [];
|
|
991
1084
|
ON_SUBMIT = function ON_SUBMIT(type, payload, onSuccess) {
|
|
@@ -997,19 +1090,19 @@ describe('components', function () {
|
|
|
997
1090
|
};
|
|
998
1091
|
TASK_LIST_NON_SEQUENTIAL = JSON.parse(JSON.stringify(_taskList.default));
|
|
999
1092
|
TASK_LIST_NON_SEQUENTIAL.hub.nonSequential = true;
|
|
1000
|
-
|
|
1001
|
-
return (0, _testUtils.act)( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1002
|
-
return _regeneratorRuntime().wrap(function
|
|
1003
|
-
while (1) switch (
|
|
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) {
|
|
1004
1097
|
case 0:
|
|
1005
1098
|
(0, _reactDom.render)( /*#__PURE__*/_react2.default.createElement(_FormRenderer.default, _extends({}, TASK_LIST_NON_SEQUENTIAL, {
|
|
1006
1099
|
hooks: HOOKS
|
|
1007
1100
|
})), container);
|
|
1008
1101
|
case 1:
|
|
1009
1102
|
case "end":
|
|
1010
|
-
return
|
|
1103
|
+
return _context37.stop();
|
|
1011
1104
|
}
|
|
1012
|
-
},
|
|
1105
|
+
}, _callee37);
|
|
1013
1106
|
})));
|
|
1014
1107
|
case 7:
|
|
1015
1108
|
taskList = container.childNodes[0].childNodes[1]; // Launch first task of second section
|
|
@@ -1022,9 +1115,9 @@ describe('components', function () {
|
|
|
1022
1115
|
expect(newPage.childNodes[0].textContent).toEqual('Surname');
|
|
1023
1116
|
case 13:
|
|
1024
1117
|
case "end":
|
|
1025
|
-
return
|
|
1118
|
+
return _context38.stop();
|
|
1026
1119
|
}
|
|
1027
|
-
},
|
|
1120
|
+
}, _callee38);
|
|
1028
1121
|
})));
|
|
1029
1122
|
});
|
|
1030
1123
|
});
|
|
@@ -42,7 +42,7 @@ var onPageAction = function onPageAction(action, patch, patchLabel, hooks, data,
|
|
|
42
42
|
|
|
43
43
|
// Check to see whether the action is able to proceed, which in
|
|
44
44
|
// in the case of a submission will validate the fields in the page.
|
|
45
|
-
if (_helpers.default.canActionProceed(action, form.page, validate.page) && !submitting) {
|
|
45
|
+
if (_helpers.default.canActionProceed(action, form.page, validate.page) && (!submitting || action.ignoreSubmittingFlag)) {
|
|
46
46
|
_patch = _helpers.default.cleanHiddenNestedData(_patch, form.page);
|
|
47
47
|
setSubmitting(true);
|
|
48
48
|
if (action.addToFormData) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ukhomeoffice/cop-react-form-renderer",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.34.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"scripts": {
|
|
6
6
|
"clean": "rimraf dist",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"post-compile": "rimraf dist/*.test.* dist/**/*.test.* dist/**/*.stories.* dist/docs dist/assets"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@ukhomeoffice/cop-react-components": "
|
|
19
|
+
"@ukhomeoffice/cop-react-components": "3.15.4",
|
|
20
20
|
"axios": "^0.23.0",
|
|
21
21
|
"dayjs": "^1.11.0",
|
|
22
22
|
"govuk-frontend": "^4.3.1",
|