auth0-lock 11.34.2 → 12.0.0-beta.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.
- package/.browserslistrc +1 -0
- package/.circleci/config.yml +4 -2
- package/.eslintrc.json +5 -5
- package/.github/workflows/codeql.yml +41 -0
- package/.shiprc +4 -5
- package/CHANGELOG.md +26 -0
- package/EXAMPLES.md +626 -0
- package/README.md +77 -649
- package/karma.conf.js +1 -1
- package/lib/CSSCore.js +1 -4
- package/lib/__tests__/auth_button.js +12 -22
- package/lib/__tests__/connection/database/actions.js +48 -49
- package/lib/__tests__/connection/database/index.js +22 -28
- package/lib/__tests__/connection/database/login_pane.js +20 -41
- package/lib/__tests__/connection/database/password_reset_confirmation.js +19 -26
- package/lib/__tests__/connection/database/reset_password.js +17 -39
- package/lib/__tests__/connection/database/signed_up_confirmation.js +19 -26
- package/lib/__tests__/connection/enterprise/actions.js +22 -47
- package/lib/__tests__/connection/enterprise/hrd_pane.js +16 -33
- package/lib/__tests__/connection/enterprise/hrd_screen.js +26 -40
- package/lib/__tests__/connection/enterprise/quick_auth_screen.js +27 -68
- package/lib/__tests__/connection/passwordless/ask_vcode.js +29 -51
- package/lib/__tests__/connection/passwordless/email_sent_confirmation.js +19 -26
- package/lib/__tests__/connection/passwordless/passwordless.js +35 -97
- package/lib/__tests__/core/actions.js +23 -46
- package/lib/__tests__/core/client/index.js +10 -13
- package/lib/__tests__/core/index.js +46 -94
- package/lib/__tests__/core/remote_data.js +14 -20
- package/lib/__tests__/core/signed_in_confirmation.js +19 -26
- package/lib/__tests__/core/sso/last_login_screen.js +27 -50
- package/lib/__tests__/core/tenant.js +10 -12
- package/lib/__tests__/core/web_api/helper.js +6 -14
- package/lib/__tests__/core/web_api/p2_api.js +38 -33
- package/lib/__tests__/core/web_api.js +37 -33
- package/lib/__tests__/engine/classic/login.js +20 -41
- package/lib/__tests__/engine/classic/mfa_login_screen.js +6 -19
- package/lib/__tests__/engine/classic/sign_up_pane.js +33 -55
- package/lib/__tests__/engine/classic/sign_up_screen.js +18 -45
- package/lib/__tests__/engine/classic.js +13 -6
- package/lib/__tests__/engine/passwordless.js +2 -5
- package/lib/__tests__/field/captcha/recaptcha_enterprise.js +27 -27
- package/lib/__tests__/field/captcha/recaptchav2.js +27 -27
- package/lib/__tests__/field/captcha.js +39 -51
- package/lib/__tests__/field/custom_input.js +23 -47
- package/lib/__tests__/field/email.js +2 -3
- package/lib/__tests__/field/email_pane.js +25 -48
- package/lib/__tests__/field/field.js +9 -13
- package/lib/__tests__/field/login_pane.js +30 -34
- package/lib/__tests__/field/mfa_code_pane.js +13 -28
- package/lib/__tests__/field/option_selection_pane.js +7 -25
- package/lib/__tests__/field/password.js +6 -12
- package/lib/__tests__/field/password_pane.js +29 -46
- package/lib/__tests__/field/phone_number_pane.js +18 -41
- package/lib/__tests__/field/social_buttons_pane.js +30 -47
- package/lib/__tests__/field/username.js +27 -48
- package/lib/__tests__/field/username_pane.js +30 -47
- package/lib/__tests__/field/vcode.js +5 -13
- package/lib/__tests__/field/vcode_pane.js +20 -44
- package/lib/__tests__/i18n.js +28 -53
- package/lib/__tests__/quick-auth/actions.js +4 -27
- package/lib/__tests__/setup-tests.js +7 -9
- package/lib/__tests__/testUtils.js +41 -58
- package/lib/__tests__/ui/box/chrome.js +24 -49
- package/lib/__tests__/ui/box/confirmation_pane.js +19 -36
- package/lib/__tests__/ui/box/container.js +21 -46
- package/lib/__tests__/ui/box/global_message.js +60 -37
- package/lib/__tests__/ui/input/email_input.js +6 -17
- package/lib/__tests__/ui/input/input_wrap.js +6 -19
- package/lib/__tests__/ui/input/password/password_strength.js +13 -15
- package/lib/__tests__/ui/input/password_input.js +22 -27
- package/lib/__tests__/utils/format.js +10 -17
- package/lib/__tests__/utils/url_utils.js +2 -5
- package/lib/avatar/gravatar_provider.js +13 -28
- package/lib/avatar.js +22 -41
- package/lib/browser.js +372 -23
- package/lib/connection/captcha.js +14 -32
- package/lib/connection/database/actions.js +39 -108
- package/lib/connection/database/index.js +90 -191
- package/lib/connection/database/login_pane.js +107 -147
- package/lib/connection/database/login_sign_up_tabs.js +106 -125
- package/lib/connection/database/mfa_pane.js +50 -69
- package/lib/connection/database/password_reset_confirmation.js +51 -73
- package/lib/connection/database/reset_password.js +116 -132
- package/lib/connection/database/reset_password_pane.js +45 -56
- package/lib/connection/database/sign_up_terms.js +17 -23
- package/lib/connection/database/signed_up_confirmation.js +52 -75
- package/lib/connection/enterprise/actions.js +23 -52
- package/lib/connection/enterprise/hrd_pane.js +60 -76
- package/lib/connection/enterprise/hrd_screen.js +60 -75
- package/lib/connection/enterprise/kerberos_screen.js +46 -60
- package/lib/connection/enterprise/quick_auth_screen.js +46 -64
- package/lib/connection/enterprise/single_sign_on_notice.js +14 -26
- package/lib/connection/enterprise.js +51 -84
- package/lib/connection/passwordless/actions.js +29 -62
- package/lib/connection/passwordless/ask_vcode.js +53 -60
- package/lib/connection/passwordless/email_sent_confirmation.js +129 -179
- package/lib/connection/passwordless/index.js +36 -68
- package/lib/connection/social/index.js +12 -15
- package/lib/core/actions.js +33 -85
- package/lib/core/client/index.js +38 -58
- package/lib/core/client/settings.js +12 -20
- package/lib/core/error_screen.js +38 -52
- package/lib/core/index.js +152 -301
- package/lib/core/loading_screen.js +61 -71
- package/lib/core/pane_separator.js +10 -10
- package/lib/core/remote_data.js +28 -48
- package/lib/core/screen.js +85 -79
- package/lib/core/signed_in_confirmation.js +51 -73
- package/lib/core/sso/data.js +9 -17
- package/lib/core/sso/index.js +5 -6
- package/lib/core/sso/last_login_screen.js +46 -63
- package/lib/core/tenant/index.js +37 -59
- package/lib/core/tenant/settings.js +11 -15
- package/lib/core/web_api/helper.js +24 -30
- package/lib/core/web_api/p2_api.js +156 -165
- package/lib/core/web_api.js +101 -90
- package/lib/core.js +126 -160
- package/lib/engine/classic/login.js +92 -144
- package/lib/engine/classic/mfa_login_screen.js +61 -67
- package/lib/engine/classic/sign_up_pane.js +89 -123
- package/lib/engine/classic/sign_up_screen.js +112 -158
- package/lib/engine/classic.js +122 -183
- package/lib/engine/passwordless/social_or_email_login_screen.js +71 -106
- package/lib/engine/passwordless/social_or_phone_number_login_screen.js +70 -100
- package/lib/engine/passwordless.js +75 -104
- package/lib/field/actions.js +11 -17
- package/lib/field/captcha/captcha_pane.js +82 -102
- package/lib/field/captcha/recaptcha.js +140 -145
- package/lib/field/captcha.js +7 -10
- package/lib/field/custom_input.js +37 -50
- package/lib/field/email/email_pane.js +90 -109
- package/lib/field/email.js +17 -35
- package/lib/field/index.js +51 -88
- package/lib/field/mfa-code/mfa_code_pane.js +57 -71
- package/lib/field/mfa_code.js +15 -21
- package/lib/field/option_selection_pane.js +16 -22
- package/lib/field/password/password_pane.js +79 -91
- package/lib/field/password.js +8 -14
- package/lib/field/phone-number/locations.js +7 -3
- package/lib/field/phone-number/phone_number_pane.js +87 -124
- package/lib/field/phone_number.js +16 -30
- package/lib/field/social/event.js +9 -12
- package/lib/field/social/social_buttons_pane.js +93 -121
- package/lib/field/username/username_pane.js +105 -123
- package/lib/field/username.js +16 -26
- package/lib/field/vcode/vcode_pane.js +67 -93
- package/lib/field/vcode.js +5 -5
- package/lib/i18n/af.js +7 -4
- package/lib/i18n/ar.js +7 -4
- package/lib/i18n/az.js +7 -4
- package/lib/i18n/bg.js +7 -4
- package/lib/i18n/ca.js +7 -4
- package/lib/i18n/cs.js +7 -4
- package/lib/i18n/da.js +7 -4
- package/lib/i18n/de.js +7 -3
- package/lib/i18n/el.js +7 -4
- package/lib/i18n/en.js +9 -4
- package/lib/i18n/es.js +7 -3
- package/lib/i18n/et.js +7 -4
- package/lib/i18n/fa.js +7 -4
- package/lib/i18n/fi.js +7 -4
- package/lib/i18n/fr.js +7 -4
- package/lib/i18n/he.js +7 -4
- package/lib/i18n/hr.js +7 -4
- package/lib/i18n/hu.js +7 -4
- package/lib/i18n/id.js +7 -4
- package/lib/i18n/it.js +7 -3
- package/lib/i18n/ja.js +7 -4
- package/lib/i18n/ko.js +7 -4
- package/lib/i18n/lt.js +7 -4
- package/lib/i18n/lv.js +7 -4
- package/lib/i18n/ms.js +7 -4
- package/lib/i18n/nb.js +7 -4
- package/lib/i18n/nl.js +7 -4
- package/lib/i18n/nn.js +7 -4
- package/lib/i18n/no.js +7 -4
- package/lib/i18n/pl.js +7 -4
- package/lib/i18n/pt-br.js +7 -3
- package/lib/i18n/pt.js +7 -4
- package/lib/i18n/ro.js +7 -4
- package/lib/i18n/ru.js +7 -4
- package/lib/i18n/sk.js +7 -4
- package/lib/i18n/sl.js +7 -4
- package/lib/i18n/sr.js +7 -4
- package/lib/i18n/sv.js +7 -4
- package/lib/i18n/tr.js +7 -4
- package/lib/i18n/ua.js +7 -4
- package/lib/i18n/uk.js +7 -4
- package/lib/i18n/vi.js +7 -4
- package/lib/i18n/zh-tw.js +7 -4
- package/lib/i18n/zh.js +7 -4
- package/lib/i18n.js +38 -75
- package/lib/index.js +14 -17
- package/lib/lock.js +29 -32
- package/lib/passwordless.js +29 -31
- package/lib/quick-auth/actions.js +19 -26
- package/lib/quick_auth.js +8 -10
- package/lib/sanitizer.js +5 -5
- package/lib/store/index.js +22 -42
- package/lib/sync.js +21 -42
- package/lib/ui/box/button.js +85 -105
- package/lib/ui/box/chrome.js +463 -548
- package/lib/ui/box/confirmation_pane.js +34 -48
- package/lib/ui/box/container.js +305 -339
- package/lib/ui/box/global_message.js +51 -60
- package/lib/ui/box/header.js +155 -177
- package/lib/ui/box/multisize_slide.js +233 -229
- package/lib/ui/box/success_pane.js +34 -37
- package/lib/ui/box.js +88 -93
- package/lib/ui/button/auth_button.js +44 -51
- package/lib/ui/input/captcha_input.js +162 -181
- package/lib/ui/input/checkbox_input.js +57 -59
- package/lib/ui/input/email_input.js +117 -124
- package/lib/ui/input/input_wrap.js +65 -80
- package/lib/ui/input/location_input.js +130 -150
- package/lib/ui/input/mfa_code_input.js +98 -98
- package/lib/ui/input/password/password_strength.js +103 -127
- package/lib/ui/input/password_input.js +141 -147
- package/lib/ui/input/phone_number_input.js +101 -109
- package/lib/ui/input/select_input.js +120 -132
- package/lib/ui/input/text_input.js +89 -84
- package/lib/ui/input/username_input.js +109 -115
- package/lib/ui/input/vcode_input.js +110 -118
- package/lib/ui/list.js +224 -247
- package/lib/ui/pane/quick_auth_pane.js +55 -80
- package/lib/utils/atom.js +55 -48
- package/lib/utils/cache.js +54 -43
- package/lib/utils/cdn_utils.js +17 -31
- package/lib/utils/createRef.js +3 -1
- package/lib/utils/data_utils.js +10 -16
- package/lib/utils/fn_utils.js +5 -4
- package/lib/utils/format.js +6 -8
- package/lib/utils/id_utils.js +4 -3
- package/lib/utils/jsonp_utils.js +20 -17
- package/lib/utils/media_utils.js +4 -2
- package/lib/utils/preload_utils.js +4 -3
- package/lib/utils/string_utils.js +4 -4
- package/lib/utils/url_utils.js +4 -3
- package/opslevel.yml +6 -0
- package/package.json +53 -38
- package/webpack.config.js +36 -3
|
@@ -1,52 +1,35 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var _react = require('react');
|
|
4
|
-
|
|
5
|
-
var _react2 = _interopRequireDefault(_react);
|
|
6
|
-
|
|
7
|
-
var _immutable = require('immutable');
|
|
8
|
-
|
|
9
|
-
var _immutable2 = _interopRequireDefault(_immutable);
|
|
10
|
-
|
|
11
|
-
var _testUtils = require('testUtils');
|
|
12
|
-
|
|
13
|
-
var _confirmation_pane = require('../../../ui/box/confirmation_pane');
|
|
14
|
-
|
|
15
|
-
var _confirmation_pane2 = _interopRequireDefault(_confirmation_pane);
|
|
1
|
+
"use strict";
|
|
16
2
|
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
+
var _react = _interopRequireDefault(require("react"));
|
|
5
|
+
var _immutable = _interopRequireDefault(require("immutable"));
|
|
6
|
+
var _testUtils = require("testUtils");
|
|
7
|
+
var _confirmation_pane = _interopRequireDefault(require("../../../ui/box/confirmation_pane"));
|
|
17
8
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
18
|
-
|
|
19
|
-
function
|
|
20
|
-
|
|
9
|
+
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 exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
|
10
|
+
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); } }
|
|
11
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
21
12
|
var defaultProps = {
|
|
22
|
-
lock:
|
|
13
|
+
lock: _immutable.default.fromJS({
|
|
14
|
+
id: '__lock-id__'
|
|
15
|
+
}),
|
|
23
16
|
backHandler: function backHandler() {},
|
|
24
17
|
closeHandler: function closeHandler() {},
|
|
25
|
-
children:
|
|
26
|
-
|
|
27
|
-
null,
|
|
28
|
-
'test'
|
|
29
|
-
),
|
|
30
|
-
svg: _react2.default.createElement(
|
|
31
|
-
'svg',
|
|
32
|
-
null,
|
|
33
|
-
'svg'
|
|
34
|
-
)
|
|
18
|
+
children: /*#__PURE__*/_react.default.createElement("span", null, "test"),
|
|
19
|
+
svg: /*#__PURE__*/_react.default.createElement("svg", null, "svg")
|
|
35
20
|
};
|
|
36
|
-
|
|
37
21
|
describe('ConfirmationPane', function () {
|
|
38
|
-
it('renders correctly', _asyncToGenerator( /*#__PURE__*/
|
|
39
|
-
return
|
|
22
|
+
it('renders correctly', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
23
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
40
24
|
while (1) {
|
|
41
25
|
switch (_context.prev = _context.next) {
|
|
42
26
|
case 0:
|
|
43
|
-
(0, _testUtils.expectComponent)(
|
|
44
|
-
|
|
27
|
+
(0, _testUtils.expectComponent)( /*#__PURE__*/_react.default.createElement(_confirmation_pane.default, defaultProps)).toMatchSnapshot();
|
|
45
28
|
case 1:
|
|
46
|
-
case
|
|
29
|
+
case "end":
|
|
47
30
|
return _context.stop();
|
|
48
31
|
}
|
|
49
32
|
}
|
|
50
|
-
}, _callee
|
|
33
|
+
}, _callee);
|
|
51
34
|
})));
|
|
52
35
|
});
|
|
@@ -1,42 +1,34 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var _react = require('react');
|
|
4
|
-
|
|
5
|
-
var _react2 = _interopRequireDefault(_react);
|
|
6
|
-
|
|
7
|
-
var _immutable = require('immutable');
|
|
8
|
-
|
|
9
|
-
var _immutable2 = _interopRequireDefault(_immutable);
|
|
10
|
-
|
|
11
|
-
var _testUtils = require('../../testUtils');
|
|
1
|
+
"use strict";
|
|
12
2
|
|
|
3
|
+
var _react = _interopRequireDefault(require("react"));
|
|
4
|
+
var _immutable = _interopRequireDefault(require("immutable"));
|
|
5
|
+
var _testUtils = require("../../testUtils");
|
|
13
6
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
|
-
|
|
15
7
|
jest.mock('store/index', function () {
|
|
16
8
|
return {
|
|
17
9
|
swap: jest.fn(),
|
|
18
10
|
updateEntity: 'updateEntity'
|
|
19
11
|
};
|
|
20
12
|
});
|
|
21
|
-
|
|
22
13
|
jest.mock('ui/box/chrome', function () {
|
|
23
14
|
return (0, _testUtils.mockComponent)('chrome');
|
|
24
15
|
});
|
|
25
|
-
|
|
26
16
|
var mockEvent = {
|
|
27
17
|
preventDefault: function preventDefault() {}
|
|
28
18
|
};
|
|
29
|
-
|
|
30
19
|
var getContainer = function getContainer(opts) {
|
|
31
20
|
var Container = require('ui/box/container').default;
|
|
32
|
-
|
|
33
21
|
var props = Object.assign({}, {
|
|
34
22
|
contentProps: {
|
|
35
23
|
i18n: {},
|
|
36
|
-
model:
|
|
24
|
+
model: _immutable.default.fromJS({
|
|
37
25
|
client: {
|
|
38
26
|
connections: {
|
|
39
|
-
database: [{
|
|
27
|
+
database: [{
|
|
28
|
+
name: 'dbA'
|
|
29
|
+
}, {
|
|
30
|
+
name: 'dbB'
|
|
31
|
+
}]
|
|
40
32
|
},
|
|
41
33
|
id: 'alksdkhasd__test-lock__alsdkhalkshd'
|
|
42
34
|
},
|
|
@@ -51,47 +43,40 @@ var getContainer = function getContainer(opts) {
|
|
|
51
43
|
})
|
|
52
44
|
}
|
|
53
45
|
}, opts);
|
|
54
|
-
|
|
55
46
|
return new Container(props);
|
|
56
47
|
};
|
|
57
|
-
|
|
58
48
|
describe('Container', function () {
|
|
59
49
|
it('does not call `connectionResolver` on submit when there is no custom `connectionResolver`', function () {
|
|
60
50
|
var c = getContainer();
|
|
61
|
-
|
|
62
51
|
c.handleSubmit(mockEvent);
|
|
63
|
-
|
|
64
52
|
var mock = require('store/index').swap.mock;
|
|
65
|
-
|
|
66
53
|
expect(mock.calls.length).toBe(0);
|
|
67
54
|
});
|
|
68
|
-
|
|
69
55
|
it('should submit the form when the form is not yet submitting', function () {
|
|
70
|
-
var c = getContainer({
|
|
56
|
+
var c = getContainer({
|
|
57
|
+
isSubmitting: false
|
|
58
|
+
});
|
|
71
59
|
var connectionResolverMock = jest.fn();
|
|
72
60
|
require('core/index').connectionResolver = function () {
|
|
73
61
|
return connectionResolverMock;
|
|
74
62
|
};
|
|
75
|
-
|
|
76
63
|
c.handleSubmit(mockEvent);
|
|
77
64
|
expect(connectionResolverMock).toHaveBeenCalled();
|
|
78
65
|
});
|
|
79
|
-
|
|
80
66
|
it('should not submit the form when the form is already submitting', function () {
|
|
81
|
-
var c = getContainer({
|
|
67
|
+
var c = getContainer({
|
|
68
|
+
isSubmitting: true
|
|
69
|
+
});
|
|
82
70
|
var connectionResolverMock = jest.fn();
|
|
83
71
|
require('core/index').connectionResolver = function () {
|
|
84
72
|
return connectionResolverMock;
|
|
85
73
|
};
|
|
86
|
-
|
|
87
74
|
c.handleSubmit(mockEvent);
|
|
88
75
|
expect(connectionResolverMock).not.toHaveBeenCalled();
|
|
89
76
|
});
|
|
90
|
-
|
|
91
77
|
describe('with a custom `connectionResolver`', function () {
|
|
92
|
-
var connectionResolverMock
|
|
93
|
-
var setResolvedConnectionMock
|
|
94
|
-
|
|
78
|
+
var connectionResolverMock;
|
|
79
|
+
var setResolvedConnectionMock;
|
|
95
80
|
beforeEach(function () {
|
|
96
81
|
connectionResolverMock = jest.fn();
|
|
97
82
|
setResolvedConnectionMock = jest.fn();
|
|
@@ -100,46 +85,36 @@ describe('Container', function () {
|
|
|
100
85
|
};
|
|
101
86
|
require('core/index').setResolvedConnection = setResolvedConnectionMock;
|
|
102
87
|
});
|
|
103
|
-
|
|
104
88
|
it('calls `connectionResolver` onSubmit', function () {
|
|
105
89
|
var c = getContainer();
|
|
106
90
|
c.handleSubmit(mockEvent);
|
|
107
|
-
|
|
108
91
|
var _connectionResolverMo = connectionResolverMock,
|
|
109
|
-
|
|
110
|
-
|
|
92
|
+
mock = _connectionResolverMo.mock;
|
|
111
93
|
expect(mock.calls.length).toBe(1);
|
|
112
94
|
expect(mock.calls[0]).toMatchSnapshot();
|
|
113
95
|
});
|
|
114
96
|
it('calls `swap` in the `connectionResolver` callback', function () {
|
|
115
97
|
var c = getContainer();
|
|
116
98
|
c.handleSubmit(mockEvent);
|
|
117
|
-
|
|
118
99
|
connectionResolverMock.mock.calls[0][2]('resolvedConnection');
|
|
119
|
-
|
|
120
100
|
var mock = require('store/index').swap.mock;
|
|
121
|
-
|
|
122
101
|
expect(mock.calls.length).toBe(1);
|
|
123
102
|
expect(mock.calls[0]).toMatchSnapshot();
|
|
124
103
|
});
|
|
125
104
|
it('calls `setResolvedConnection` in the `swap` callback', function () {
|
|
126
105
|
var c = getContainer();
|
|
127
106
|
c.handleSubmit(mockEvent);
|
|
128
|
-
|
|
129
107
|
connectionResolverMock.mock.calls[0][2]('resolvedConnection');
|
|
130
108
|
require('store/index').swap.mock.calls[0][3]('model');
|
|
131
109
|
var _setResolvedConnectio = setResolvedConnectionMock,
|
|
132
|
-
|
|
133
|
-
|
|
110
|
+
mock = _setResolvedConnectio.mock;
|
|
134
111
|
expect(mock.calls.length).toBe(1);
|
|
135
112
|
expect(mock.calls[0]).toMatchSnapshot();
|
|
136
113
|
});
|
|
137
114
|
});
|
|
138
|
-
|
|
139
115
|
describe('when suppressSubmitOverlay is true', function () {
|
|
140
116
|
it('it does not display the overlay when submitting', function () {
|
|
141
117
|
var Container = require('ui/box/container').default;
|
|
142
|
-
|
|
143
118
|
var props = {
|
|
144
119
|
autoFocus: false,
|
|
145
120
|
badgeLink: 'http://badge.link',
|
|
@@ -158,7 +133,7 @@ describe('Container', function () {
|
|
|
158
133
|
};
|
|
159
134
|
|
|
160
135
|
// Emitted snapshot should not add 'auth0-lock-mode-loading' class to the container div
|
|
161
|
-
(0, _testUtils.expectComponent)(
|
|
136
|
+
(0, _testUtils.expectComponent)( /*#__PURE__*/_react.default.createElement(Container, props)).toMatchSnapshot();
|
|
162
137
|
});
|
|
163
138
|
});
|
|
164
139
|
});
|
|
@@ -1,85 +1,108 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var _react = require('react');
|
|
4
|
-
|
|
5
|
-
var _react2 = _interopRequireDefault(_react);
|
|
6
|
-
|
|
7
|
-
var _enzyme = require('enzyme');
|
|
8
|
-
|
|
9
|
-
var _testUtils = require('../../testUtils');
|
|
10
|
-
|
|
11
|
-
var _global_message = require('ui/box/global_message');
|
|
12
|
-
|
|
13
|
-
var _global_message2 = _interopRequireDefault(_global_message);
|
|
1
|
+
"use strict";
|
|
14
2
|
|
|
3
|
+
var _react = _interopRequireDefault(require("react"));
|
|
4
|
+
var _enzyme = require("enzyme");
|
|
5
|
+
var _testUtils = require("../../testUtils");
|
|
6
|
+
var _global_message = _interopRequireDefault(require("ui/box/global_message"));
|
|
15
7
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
16
|
-
|
|
17
8
|
describe('GlobalMessage', function () {
|
|
18
9
|
it('renders correctly given a success type', function () {
|
|
19
|
-
(0, _testUtils.expectComponent)(
|
|
10
|
+
(0, _testUtils.expectComponent)( /*#__PURE__*/_react.default.createElement(_global_message.default, {
|
|
11
|
+
type: "success",
|
|
12
|
+
message: "Success!"
|
|
13
|
+
})).toMatchSnapshot();
|
|
20
14
|
});
|
|
21
15
|
it('renders correctly given an error type', function () {
|
|
22
|
-
(0, _testUtils.expectComponent)(
|
|
16
|
+
(0, _testUtils.expectComponent)( /*#__PURE__*/_react.default.createElement(_global_message.default, {
|
|
17
|
+
type: "error",
|
|
18
|
+
message: "An error occurred."
|
|
19
|
+
})).toMatchSnapshot();
|
|
23
20
|
});
|
|
24
21
|
it('renders correctly given an info type', function () {
|
|
25
|
-
(0, _testUtils.expectComponent)(
|
|
22
|
+
(0, _testUtils.expectComponent)( /*#__PURE__*/_react.default.createElement(_global_message.default, {
|
|
23
|
+
type: "info",
|
|
24
|
+
message: "Some additional information."
|
|
25
|
+
})).toMatchSnapshot();
|
|
26
26
|
});
|
|
27
27
|
it('should call scrollIntoView if parameter is set and top < 0', function () {
|
|
28
|
-
var wrapper = (0, _enzyme.mount)(
|
|
29
|
-
|
|
28
|
+
var wrapper = (0, _enzyme.mount)( /*#__PURE__*/_react.default.createElement(_global_message.default, {
|
|
29
|
+
type: "success",
|
|
30
|
+
message: "foo",
|
|
31
|
+
scrollIntoView: true
|
|
32
|
+
}));
|
|
33
|
+
var getBoundingClientRectSpy = jest.fn().mockReturnValue({
|
|
34
|
+
top: -1
|
|
35
|
+
});
|
|
30
36
|
var scrollIntoViewSpy = jest.fn();
|
|
31
37
|
wrapper.getDOMNode().getBoundingClientRect = getBoundingClientRectSpy;
|
|
32
38
|
wrapper.getDOMNode().scrollIntoView = scrollIntoViewSpy;
|
|
33
|
-
|
|
34
39
|
wrapper.instance().componentDidMount();
|
|
35
|
-
|
|
36
40
|
expect(getBoundingClientRectSpy).toHaveBeenCalled();
|
|
37
41
|
expect(scrollIntoViewSpy).toHaveBeenCalledWith(true);
|
|
38
42
|
});
|
|
39
43
|
it('should not call scrollIntoView if parameter is set and top >= 0', function () {
|
|
40
|
-
var wrapper = (0, _enzyme.mount)(
|
|
41
|
-
|
|
44
|
+
var wrapper = (0, _enzyme.mount)( /*#__PURE__*/_react.default.createElement(_global_message.default, {
|
|
45
|
+
type: "success",
|
|
46
|
+
message: "foo",
|
|
47
|
+
scrollIntoView: true
|
|
48
|
+
}));
|
|
49
|
+
var getBoundingClientRectSpy = jest.fn().mockReturnValue({
|
|
50
|
+
top: 0
|
|
51
|
+
});
|
|
42
52
|
var scrollIntoViewSpy = jest.fn();
|
|
43
53
|
wrapper.getDOMNode().getBoundingClientRect = getBoundingClientRectSpy;
|
|
44
54
|
wrapper.getDOMNode().scrollIntoView = scrollIntoViewSpy;
|
|
45
|
-
|
|
46
55
|
wrapper.instance().componentDidMount();
|
|
47
|
-
|
|
48
56
|
expect(getBoundingClientRectSpy).toHaveBeenCalled();
|
|
49
57
|
expect(scrollIntoViewSpy).not.toHaveBeenCalled();
|
|
50
58
|
});
|
|
51
59
|
it('should call scrollIntoView if parameter is not set (default is true)', function () {
|
|
52
|
-
var wrapper = (0, _enzyme.mount)(
|
|
53
|
-
|
|
60
|
+
var wrapper = (0, _enzyme.mount)( /*#__PURE__*/_react.default.createElement(_global_message.default, {
|
|
61
|
+
type: "success",
|
|
62
|
+
message: "foo"
|
|
63
|
+
}));
|
|
64
|
+
var getBoundingClientRectSpy = jest.fn().mockReturnValue({
|
|
65
|
+
top: -1
|
|
66
|
+
});
|
|
54
67
|
var scrollIntoViewSpy = jest.fn();
|
|
55
68
|
wrapper.getDOMNode().getBoundingClientRect = getBoundingClientRectSpy;
|
|
56
69
|
wrapper.getDOMNode().scrollIntoView = scrollIntoViewSpy;
|
|
57
|
-
|
|
58
70
|
wrapper.instance().componentDidMount();
|
|
59
|
-
|
|
60
71
|
expect(getBoundingClientRectSpy).toHaveBeenCalled();
|
|
61
72
|
expect(scrollIntoViewSpy).toHaveBeenCalledWith(true);
|
|
62
73
|
});
|
|
63
74
|
it('should not call scrollIntoView if parameter is set to false', function () {
|
|
64
|
-
var wrapper = (0, _enzyme.mount)(
|
|
65
|
-
|
|
75
|
+
var wrapper = (0, _enzyme.mount)( /*#__PURE__*/_react.default.createElement(_global_message.default, {
|
|
76
|
+
type: "success",
|
|
77
|
+
message: "foo",
|
|
78
|
+
scrollIntoView: false
|
|
79
|
+
}));
|
|
80
|
+
var getBoundingClientRectSpy = jest.fn().mockReturnValue({
|
|
81
|
+
top: -1
|
|
82
|
+
});
|
|
66
83
|
var scrollIntoViewSpy = jest.fn();
|
|
67
84
|
wrapper.getDOMNode().getBoundingClientRect = getBoundingClientRectSpy;
|
|
68
85
|
wrapper.getDOMNode().scrollIntoView = scrollIntoViewSpy;
|
|
69
|
-
|
|
70
86
|
wrapper.instance().componentDidMount();
|
|
71
|
-
|
|
72
87
|
expect(scrollIntoViewSpy).not.toHaveBeenCalled();
|
|
73
88
|
});
|
|
74
89
|
it('should NOT strip out HTML tags if given a React node', function () {
|
|
75
|
-
var message =
|
|
76
|
-
dangerouslySetInnerHTML: {
|
|
90
|
+
var message = /*#__PURE__*/_react.default.createElement('span', {
|
|
91
|
+
dangerouslySetInnerHTML: {
|
|
92
|
+
__html: '<b>Success!</b>'
|
|
93
|
+
}
|
|
77
94
|
});
|
|
78
|
-
var wrapper = (0, _enzyme.mount)(
|
|
95
|
+
var wrapper = (0, _enzyme.mount)( /*#__PURE__*/_react.default.createElement(_global_message.default, {
|
|
96
|
+
type: "success",
|
|
97
|
+
message: message
|
|
98
|
+
}));
|
|
79
99
|
expect(wrapper.html()).toBe('<div class="auth0-global-message auth0-global-message-success"><span class="animated fadeInUp">' + '<span><b>Success!</b></span></span></div>');
|
|
80
100
|
});
|
|
81
101
|
it('should strip out HTML tags if given a string', function () {
|
|
82
|
-
var wrapper = (0, _enzyme.mount)(
|
|
102
|
+
var wrapper = (0, _enzyme.mount)( /*#__PURE__*/_react.default.createElement(_global_message.default, {
|
|
103
|
+
type: "success",
|
|
104
|
+
message: "<b>Success!</b>"
|
|
105
|
+
}));
|
|
83
106
|
expect(wrapper.html()).toBe('<div class="auth0-global-message auth0-global-message-success"><span class="animated fadeInUp">' + '<b>Success!</b></span></div>');
|
|
84
107
|
});
|
|
85
108
|
});
|
|
@@ -1,25 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var _react = require('react');
|
|
4
|
-
|
|
5
|
-
var _react2 = _interopRequireDefault(_react);
|
|
6
|
-
|
|
7
|
-
var _enzyme = require('enzyme');
|
|
8
|
-
|
|
9
|
-
var _testUtils = require('testUtils');
|
|
10
|
-
|
|
11
|
-
var _testUtils2 = require('../../testUtils');
|
|
1
|
+
"use strict";
|
|
12
2
|
|
|
3
|
+
var _react = _interopRequireDefault(require("react"));
|
|
4
|
+
var _enzyme = require("enzyme");
|
|
5
|
+
var _testUtils = require("testUtils");
|
|
6
|
+
var _testUtils2 = require("../../testUtils");
|
|
13
7
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
|
-
|
|
15
8
|
jest.mock('ui/input/input_wrap', function () {
|
|
16
9
|
return (0, _testUtils.mockComponent)('input_wrap');
|
|
17
10
|
});
|
|
18
|
-
|
|
19
11
|
var getComponent = function getComponent() {
|
|
20
12
|
return require('ui/input/email_input').default;
|
|
21
13
|
};
|
|
22
|
-
|
|
23
14
|
describe('EmailInput', function () {
|
|
24
15
|
var defaultProps = {
|
|
25
16
|
autoComplete: false,
|
|
@@ -29,11 +20,9 @@ describe('EmailInput', function () {
|
|
|
29
20
|
value: 'value',
|
|
30
21
|
lockId: 1
|
|
31
22
|
};
|
|
32
|
-
|
|
33
23
|
test('renders without issue', function () {
|
|
34
24
|
var Input = getComponent();
|
|
35
|
-
var component = (0, _enzyme.mount)(
|
|
36
|
-
|
|
25
|
+
var component = (0, _enzyme.mount)( /*#__PURE__*/_react.default.createElement(Input, defaultProps));
|
|
37
26
|
expect(component.html()).toMatchSnapshot();
|
|
38
27
|
});
|
|
39
28
|
});
|
|
@@ -1,29 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var _react = require('react');
|
|
4
|
-
|
|
5
|
-
var _react2 = _interopRequireDefault(_react);
|
|
6
|
-
|
|
7
|
-
var _testUtils = require('testUtils');
|
|
8
|
-
|
|
9
|
-
var _input_wrap = require('../../../ui/input/input_wrap');
|
|
10
|
-
|
|
11
|
-
var _input_wrap2 = _interopRequireDefault(_input_wrap);
|
|
1
|
+
"use strict";
|
|
12
2
|
|
|
3
|
+
var _react = _interopRequireDefault(require("react"));
|
|
4
|
+
var _testUtils = require("testUtils");
|
|
5
|
+
var _input_wrap = _interopRequireDefault(require("../../../ui/input/input_wrap"));
|
|
13
6
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
|
-
|
|
15
7
|
describe('InputWrap', function () {
|
|
16
8
|
var defaultProps = {
|
|
17
|
-
after:
|
|
18
|
-
'span',
|
|
19
|
-
null,
|
|
20
|
-
'after'
|
|
21
|
-
),
|
|
9
|
+
after: /*#__PURE__*/_react.default.createElement("span", null, "after"),
|
|
22
10
|
isValid: true,
|
|
23
11
|
name: 'name'
|
|
24
12
|
};
|
|
25
|
-
|
|
26
13
|
test('renders correctly with the `after` prop', function () {
|
|
27
|
-
(0, _testUtils.expectComponent)(
|
|
14
|
+
(0, _testUtils.expectComponent)( /*#__PURE__*/_react.default.createElement(_input_wrap.default, defaultProps)).toMatchSnapshot();
|
|
28
15
|
});
|
|
29
16
|
});
|
|
@@ -1,23 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var _react = require('react');
|
|
4
|
-
|
|
5
|
-
var _react2 = _interopRequireDefault(_react);
|
|
6
|
-
|
|
7
|
-
var _enzyme = require('enzyme');
|
|
8
|
-
|
|
9
|
-
var _password_strength = require('../../../../ui/input/password/password_strength');
|
|
10
|
-
|
|
11
|
-
var _password_strength2 = _interopRequireDefault(_password_strength);
|
|
1
|
+
"use strict";
|
|
12
2
|
|
|
3
|
+
var _react = _interopRequireDefault(require("react"));
|
|
4
|
+
var _enzyme = require("enzyme");
|
|
5
|
+
var _password_strength = _interopRequireDefault(require("../../../../ui/input/password/password_strength"));
|
|
13
6
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
|
-
|
|
15
7
|
describe('PasswordStrength', function () {
|
|
16
8
|
beforeEach(function () {
|
|
17
9
|
jest.resetModules();
|
|
18
10
|
});
|
|
19
11
|
describe('validatePassword()', function () {
|
|
20
|
-
it(
|
|
12
|
+
it("validates password correctly with invalid password", function () {
|
|
21
13
|
var policy = {
|
|
22
14
|
toJS: function toJS() {
|
|
23
15
|
return {
|
|
@@ -27,8 +19,14 @@ describe('PasswordStrength', function () {
|
|
|
27
19
|
};
|
|
28
20
|
}
|
|
29
21
|
};
|
|
30
|
-
var messages = {
|
|
31
|
-
|
|
22
|
+
var messages = {
|
|
23
|
+
foo: 'the-message'
|
|
24
|
+
};
|
|
25
|
+
var wrapper = (0, _enzyme.mount)( /*#__PURE__*/_react.default.createElement(_password_strength.default, {
|
|
26
|
+
policy: policy,
|
|
27
|
+
password: "the-password",
|
|
28
|
+
messages: messages
|
|
29
|
+
}));
|
|
32
30
|
expect(wrapper.html()).toMatchSnapshot();
|
|
33
31
|
});
|
|
34
32
|
});
|
|
@@ -1,28 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var _react = require('react');
|
|
4
|
-
|
|
5
|
-
var _react2 = _interopRequireDefault(_react);
|
|
6
|
-
|
|
7
|
-
var _enzyme = require('enzyme');
|
|
8
|
-
|
|
9
|
-
var _testUtils = require('testUtils');
|
|
10
|
-
|
|
11
|
-
var _testUtils2 = require('../../testUtils');
|
|
12
|
-
|
|
13
|
-
var _input_wrap = require('../../../ui/input/input_wrap');
|
|
14
|
-
|
|
15
|
-
var _input_wrap2 = _interopRequireDefault(_input_wrap);
|
|
1
|
+
"use strict";
|
|
16
2
|
|
|
3
|
+
var _react = _interopRequireDefault(require("react"));
|
|
4
|
+
var _enzyme = require("enzyme");
|
|
5
|
+
var _testUtils = require("testUtils");
|
|
6
|
+
var _testUtils2 = require("../../testUtils");
|
|
7
|
+
var _input_wrap = _interopRequireDefault(require("../../../ui/input/input_wrap"));
|
|
17
8
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
18
|
-
|
|
19
9
|
jest.mock('ui/input/input_wrap', function () {
|
|
20
10
|
return (0, _testUtils.mockComponent)('input_wrap');
|
|
21
11
|
});
|
|
22
12
|
jest.mock('ui/input/password/password_strength', function () {
|
|
23
13
|
return (0, _testUtils.mockComponent)('password_strength');
|
|
24
14
|
});
|
|
25
|
-
|
|
26
15
|
jest.mock('core/index', function () {
|
|
27
16
|
return {
|
|
28
17
|
ui: {
|
|
@@ -35,11 +24,9 @@ jest.mock('core/index', function () {
|
|
|
35
24
|
})
|
|
36
25
|
};
|
|
37
26
|
});
|
|
38
|
-
|
|
39
27
|
var getComponent = function getComponent() {
|
|
40
28
|
return require('ui/input/password_input').default;
|
|
41
29
|
};
|
|
42
|
-
|
|
43
30
|
describe('PasswordInput', function () {
|
|
44
31
|
var defaultProps = {
|
|
45
32
|
invalidHint: 'invalidHint',
|
|
@@ -47,19 +34,27 @@ describe('PasswordInput', function () {
|
|
|
47
34
|
isValid: true,
|
|
48
35
|
onChange: jest.fn(),
|
|
49
36
|
policy: 'policy',
|
|
50
|
-
strengthMessages: {
|
|
37
|
+
strengthMessages: {
|
|
38
|
+
strengthMessages: 'strengthMessages'
|
|
39
|
+
},
|
|
51
40
|
value: 'value',
|
|
52
41
|
showPassword: false,
|
|
53
42
|
lock: {}
|
|
54
43
|
};
|
|
55
44
|
test('sends PasswordStrength as the `after` param', function () {
|
|
56
45
|
var Input = getComponent();
|
|
57
|
-
var wrapper = (0, _enzyme.mount)(
|
|
46
|
+
var wrapper = (0, _enzyme.mount)( /*#__PURE__*/_react.default.createElement(Input, defaultProps));
|
|
58
47
|
wrapper.find('input').simulate('focus');
|
|
59
|
-
wrapper.find('input').simulate('change', {
|
|
48
|
+
wrapper.find('input').simulate('change', {
|
|
49
|
+
target: {
|
|
50
|
+
value: 'pass'
|
|
51
|
+
}
|
|
52
|
+
});
|
|
60
53
|
var props = (0, _testUtils2.extractPropsFromWrapper)(wrapper);
|
|
61
54
|
expect(props.after.props).toEqual({
|
|
62
|
-
messages: {
|
|
55
|
+
messages: {
|
|
56
|
+
strengthMessages: 'strengthMessages'
|
|
57
|
+
},
|
|
63
58
|
password: 'value',
|
|
64
59
|
policy: 'policy'
|
|
65
60
|
});
|
|
@@ -69,7 +64,7 @@ describe('PasswordInput', function () {
|
|
|
69
64
|
return true;
|
|
70
65
|
};
|
|
71
66
|
var Input = getComponent();
|
|
72
|
-
var wrapper = (0, _enzyme.mount)(
|
|
67
|
+
var wrapper = (0, _enzyme.mount)( /*#__PURE__*/_react.default.createElement(Input, defaultProps));
|
|
73
68
|
expect(wrapper.find('input').props().autoComplete).toBe('on');
|
|
74
69
|
});
|
|
75
70
|
test('`allowPasswordAutocomplete=false` sets `autoComplete` as off', function () {
|
|
@@ -77,12 +72,12 @@ describe('PasswordInput', function () {
|
|
|
77
72
|
return false;
|
|
78
73
|
};
|
|
79
74
|
var Input = getComponent();
|
|
80
|
-
var wrapper = (0, _enzyme.mount)(
|
|
75
|
+
var wrapper = (0, _enzyme.mount)( /*#__PURE__*/_react.default.createElement(Input, defaultProps));
|
|
81
76
|
expect(wrapper.find('input').props().autoComplete).toBe('off');
|
|
82
77
|
});
|
|
83
78
|
test('shows invalid Hint', function () {
|
|
84
79
|
var Input = getComponent();
|
|
85
|
-
var wrapper = (0, _enzyme.mount)(
|
|
86
|
-
expect(wrapper.find(
|
|
80
|
+
var wrapper = (0, _enzyme.mount)( /*#__PURE__*/_react.default.createElement(Input, defaultProps));
|
|
81
|
+
expect(wrapper.find(_input_wrap.default).props().invalidHint).toBe('invalidHint');
|
|
87
82
|
});
|
|
88
83
|
});
|