auth0-lock 12.5.1 → 14.0.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/.github/CODEOWNERS +1 -1
- package/.github/workflows/semgrep.yml +1 -10
- package/.github/workflows/snyk.yml +1 -10
- package/.github/workflows/test.yml +3 -2
- package/.version +1 -1
- package/CHANGELOG.md +23 -0
- package/README.md +2 -2
- package/karma.conf.js +5 -1
- package/lib/__tests__/auth_button.js +5 -5
- package/lib/__tests__/connection/database/actions.js +2 -3
- package/lib/__tests__/connection/database/index.js +1 -2
- package/lib/__tests__/connection/database/login_pane.js +9 -9
- package/lib/__tests__/connection/database/password_reset_confirmation.js +6 -6
- package/lib/__tests__/connection/database/reset_password.js +3 -3
- package/lib/__tests__/connection/database/signed_up_confirmation.js +6 -6
- package/lib/__tests__/connection/enterprise/actions.js +2 -3
- package/lib/__tests__/connection/enterprise/hrd_pane.js +4 -5
- package/lib/__tests__/connection/enterprise/hrd_screen.js +4 -5
- package/lib/__tests__/connection/enterprise/quick_auth_screen.js +10 -10
- package/lib/__tests__/connection/passwordless/ask_vcode.js +4 -5
- package/lib/__tests__/connection/passwordless/email_sent_confirmation.js +6 -6
- package/lib/__tests__/connection/passwordless/passwordless.js +7 -7
- package/lib/__tests__/core/actions.js +3 -4
- package/lib/__tests__/core/client/index.js +1 -1
- package/lib/__tests__/core/index.js +5 -5
- package/lib/__tests__/core/remote_data.js +5 -6
- package/lib/__tests__/core/signed_in_confirmation.js +6 -6
- package/lib/__tests__/core/sso/last_login_screen.js +11 -11
- package/lib/__tests__/core/tenant.js +1 -1
- package/lib/__tests__/core/web_api.js +2 -2
- package/lib/__tests__/engine/classic/login.js +9 -9
- package/lib/__tests__/engine/classic/mfa_login_screen.js +2 -2
- package/lib/__tests__/engine/classic/sign_up_pane.js +17 -15
- package/lib/__tests__/engine/classic/sign_up_screen.js +8 -8
- package/lib/__tests__/engine/classic.js +1 -1
- package/lib/__tests__/engine/passwordless/social_or_email_login_screen.js +3 -3
- package/lib/__tests__/engine/passwordless/social_or_phone_number_login_screen.js +3 -3
- package/lib/__tests__/field/captcha/arkose.js +6 -6
- package/lib/__tests__/field/captcha/auth0_v2.js +6 -6
- package/lib/__tests__/field/captcha/friendlyCaptcha.js +6 -6
- package/lib/__tests__/field/captcha/hcaptcha.js +6 -6
- package/lib/__tests__/field/captcha/recaptcha_enterprise.js +6 -6
- package/lib/__tests__/field/captcha/recaptchav2.js +6 -6
- package/lib/__tests__/field/captcha/third_party_captcha.js +22 -14
- package/lib/__tests__/field/captcha.js +8 -8
- package/lib/__tests__/field/custom_input.js +13 -13
- package/lib/__tests__/field/email_pane.js +8 -8
- package/lib/__tests__/field/field.js +2 -2
- package/lib/__tests__/field/login_pane.js +12 -12
- package/lib/__tests__/field/mfa_code_pane.js +4 -4
- package/lib/__tests__/field/option_selection_pane.js +4 -4
- package/lib/__tests__/field/password.js +1 -1
- package/lib/__tests__/field/password_pane.js +12 -12
- package/lib/__tests__/field/phone_number_pane.js +8 -8
- package/lib/__tests__/field/social_buttons_pane.js +8 -8
- package/lib/__tests__/field/username.js +1 -1
- package/lib/__tests__/field/username_pane.js +10 -10
- package/lib/__tests__/field/vcode.js +1 -1
- package/lib/__tests__/field/vcode_pane.js +9 -9
- package/lib/__tests__/i18n.js +2 -3
- package/lib/__tests__/setup-tests.js +1 -1
- package/lib/__tests__/testUtils.js +4 -4
- package/lib/__tests__/ui/box/chrome.js +8 -8
- package/lib/__tests__/ui/box/confirmation_pane.js +6 -6
- package/lib/__tests__/ui/box/container.js +2 -2
- package/lib/__tests__/ui/box/global_message.js +10 -10
- package/lib/__tests__/ui/input/email_input.js +2 -2
- package/lib/__tests__/ui/input/input_wrap.js +2 -2
- package/lib/__tests__/ui/input/password/password_strength.js +2 -2
- package/lib/__tests__/ui/input/password_input.js +5 -5
- package/lib/__tests__/utils/format.js +1 -1
- package/lib/avatar/gravatar_provider.js +1 -1
- package/lib/avatar.js +1 -2
- package/lib/browser.js +1 -2
- package/lib/connection/captcha.js +15 -4
- package/lib/connection/database/actions.js +10 -11
- package/lib/connection/database/index.js +2 -3
- package/lib/connection/database/login_pane.js +11 -12
- package/lib/connection/database/login_sign_up_tabs.js +11 -12
- package/lib/connection/database/mfa_pane.js +9 -9
- package/lib/connection/database/password_reset_confirmation.js +10 -11
- package/lib/connection/database/reset_password.js +10 -11
- package/lib/connection/database/reset_password_pane.js +11 -12
- package/lib/connection/database/sign_up_terms.js +1 -1
- package/lib/connection/database/signed_up_confirmation.js +10 -11
- package/lib/connection/enterprise/actions.js +2 -3
- package/lib/connection/enterprise/hrd_pane.js +10 -11
- package/lib/connection/enterprise/hrd_screen.js +10 -11
- package/lib/connection/enterprise/kerberos_screen.js +10 -11
- package/lib/connection/enterprise/quick_auth_screen.js +10 -11
- package/lib/connection/enterprise/single_sign_on_notice.js +1 -1
- package/lib/connection/enterprise.js +6 -7
- package/lib/connection/passwordless/actions.js +3 -4
- package/lib/connection/passwordless/ask_vcode.js +9 -9
- package/lib/connection/passwordless/email_sent_confirmation.js +11 -12
- package/lib/connection/passwordless/index.js +12 -4
- package/lib/connection/social/index.js +2 -2
- package/lib/core/actions.js +3 -4
- package/lib/core/client/index.js +8 -9
- package/lib/core/client/settings.js +2 -3
- package/lib/core/error_screen.js +10 -11
- package/lib/core/index.js +12 -4
- package/lib/core/loading_screen.js +10 -11
- package/lib/core/pane_separator.js +1 -1
- package/lib/core/remote_data.js +2 -19
- package/lib/core/screen.js +4 -5
- package/lib/core/signed_in_confirmation.js +10 -11
- package/lib/core/sso/data.js +1 -1
- package/lib/core/sso/last_login_screen.js +10 -11
- package/lib/core/tenant/index.js +8 -9
- package/lib/core/tenant/settings.js +1 -2
- package/lib/core/web_api/helper.js +5 -5
- package/lib/core/web_api/p2_api.js +13 -7
- package/lib/core/web_api.js +9 -4
- package/lib/core.js +11 -12
- package/lib/engine/classic/login.js +10 -11
- package/lib/engine/classic/mfa_login_screen.js +10 -11
- package/lib/engine/classic/sign_up_pane.js +13 -13
- package/lib/engine/classic/sign_up_screen.js +10 -11
- package/lib/engine/classic.js +6 -7
- package/lib/engine/passwordless/social_or_email_login_screen.js +10 -11
- package/lib/engine/passwordless/social_or_phone_number_login_screen.js +10 -11
- package/lib/engine/passwordless.js +5 -6
- package/lib/field/captcha/captcha_pane.js +10 -11
- package/lib/field/captcha/third_party_captcha.js +22 -10
- package/lib/field/custom_input.js +3 -4
- package/lib/field/email/email_pane.js +10 -11
- package/lib/field/email.js +2 -3
- package/lib/field/index.js +2 -3
- package/lib/field/mfa-code/mfa_code_pane.js +10 -11
- package/lib/field/mfa_code.js +1 -1
- package/lib/field/option_selection_pane.js +1 -1
- package/lib/field/password/password_pane.js +11 -12
- package/lib/field/password.js +1 -1
- package/lib/field/phone-number/phone_number_pane.js +10 -11
- package/lib/field/phone_number.js +1 -1
- package/lib/field/social/event.js +1 -2
- package/lib/field/social/social_buttons_pane.js +10 -11
- package/lib/field/username/username_pane.js +10 -11
- package/lib/field/username.js +1 -1
- package/lib/field/vcode/vcode_pane.js +11 -12
- package/lib/i18n.js +5 -6
- package/lib/index.js +1 -1
- package/lib/lock.js +11 -12
- package/lib/passwordless.js +11 -12
- package/lib/quick-auth/actions.js +2 -3
- package/lib/sanitizer.js +3 -2
- package/lib/store/index.js +1 -1
- package/lib/sync.js +6 -7
- package/lib/ui/box/button.js +1 -1
- package/lib/ui/box/chrome.js +13 -14
- package/lib/ui/box/confirmation_pane.js +2 -3
- package/lib/ui/box/container.js +10 -11
- package/lib/ui/box/global_message.js +9 -9
- package/lib/ui/box/header.js +10 -10
- package/lib/ui/box/multisize_slide.js +11 -11
- package/lib/ui/box/success_pane.js +2 -2
- package/lib/ui/box.js +6 -6
- package/lib/ui/button/auth_button.js +1 -1
- package/lib/ui/input/captcha_input.js +13 -13
- package/lib/ui/input/checkbox_input.js +9 -9
- package/lib/ui/input/email_input.js +12 -12
- package/lib/ui/input/input_wrap.js +9 -9
- package/lib/ui/input/location_input.js +9 -9
- package/lib/ui/input/mfa_code_input.js +13 -13
- package/lib/ui/input/password/password_strength.js +18 -18
- package/lib/ui/input/password_input.js +14 -15
- package/lib/ui/input/phone_number_input.js +12 -12
- package/lib/ui/input/select_input.js +9 -9
- package/lib/ui/input/text_input.js +12 -12
- package/lib/ui/input/username_input.js +12 -12
- package/lib/ui/input/vcode_input.js +12 -12
- package/lib/ui/list.js +12 -13
- package/lib/ui/pane/quick_auth_pane.js +1 -1
- package/lib/utils/atom.js +3 -3
- package/lib/utils/cache.js +8 -8
- package/lib/utils/cdn_utils.js +1 -1
- package/lib/utils/createRef.js +3 -3
- package/lib/utils/jsonp_utils.js +4 -4
- package/package.json +11 -11
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
var _react = _interopRequireDefault(require("react"));
|
|
4
4
|
var _testUtils = require("testUtils");
|
|
5
5
|
var _third_party_captcha = require("../../../field/captcha/third_party_captcha");
|
|
6
|
-
function _interopRequireDefault(
|
|
7
|
-
function _toConsumableArray(
|
|
6
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
7
|
+
function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
|
|
8
8
|
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
9
|
-
function _unsupportedIterableToArray(
|
|
10
|
-
function _iterableToArray(
|
|
11
|
-
function _arrayWithoutHoles(
|
|
12
|
-
function _arrayLikeToArray(
|
|
9
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
10
|
+
function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
|
|
11
|
+
function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
|
|
12
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
13
13
|
describe('Recaptcha v2', function () {
|
|
14
14
|
var component = /*#__PURE__*/_react.default.createElement(_third_party_captcha.ThirdPartyCaptcha, {
|
|
15
15
|
provider: 'recaptcha_v2',
|
|
@@ -7,15 +7,14 @@ var _testUtils = require("react-dom/test-utils");
|
|
|
7
7
|
var _immutable = _interopRequireDefault(require("immutable"));
|
|
8
8
|
var l = _interopRequireWildcard(require("../../../core/index"));
|
|
9
9
|
var _third_party_captcha = require("../../../field/captcha/third_party_captcha");
|
|
10
|
-
function
|
|
11
|
-
function
|
|
12
|
-
function
|
|
13
|
-
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
10
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
11
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
|
+
function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
|
|
14
13
|
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
15
|
-
function _unsupportedIterableToArray(
|
|
16
|
-
function _iterableToArray(
|
|
17
|
-
function _arrayWithoutHoles(
|
|
18
|
-
function _arrayLikeToArray(
|
|
14
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
15
|
+
function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
|
|
16
|
+
function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
|
|
17
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
19
18
|
var createLockMock = function createLockMock() {
|
|
20
19
|
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
21
20
|
_ref$provider = _ref.provider,
|
|
@@ -78,7 +77,7 @@ describe('ThirdPartyCaptcha', function () {
|
|
|
78
77
|
siteKey: 'mySiteKey'
|
|
79
78
|
});
|
|
80
79
|
var captcha = l.captcha(lockMock);
|
|
81
|
-
wrapper = (0, _enzyme.mount)(
|
|
80
|
+
wrapper = (0, _enzyme.mount)(/*#__PURE__*/_react.default.createElement(_third_party_captcha.ThirdPartyCaptcha, {
|
|
82
81
|
provider: captcha.get('provider'),
|
|
83
82
|
sitekey: captcha.get('siteKey'),
|
|
84
83
|
clientSubdomain: captcha.get('clientSubdomain'),
|
|
@@ -110,7 +109,7 @@ describe('ThirdPartyCaptcha', function () {
|
|
|
110
109
|
siteKey: 'mySiteKey'
|
|
111
110
|
});
|
|
112
111
|
var captcha = l.captcha(lockMock);
|
|
113
|
-
wrapper = (0, _enzyme.mount)(
|
|
112
|
+
wrapper = (0, _enzyme.mount)(/*#__PURE__*/_react.default.createElement(_third_party_captcha.ThirdPartyCaptcha, {
|
|
114
113
|
provider: captcha.get('provider'),
|
|
115
114
|
sitekey: captcha.get('siteKey'),
|
|
116
115
|
clientSubdomain: captcha.get('clientSubdomain'),
|
|
@@ -143,7 +142,7 @@ describe('ThirdPartyCaptcha', function () {
|
|
|
143
142
|
siteKey: 'mySiteKey'
|
|
144
143
|
});
|
|
145
144
|
var captcha = l.captcha(lockMock);
|
|
146
|
-
wrapper = (0, _enzyme.mount)(
|
|
145
|
+
wrapper = (0, _enzyme.mount)(/*#__PURE__*/_react.default.createElement(_third_party_captcha.ThirdPartyCaptcha, {
|
|
147
146
|
provider: captcha.get('provider'),
|
|
148
147
|
sitekey: captcha.get('siteKey'),
|
|
149
148
|
clientSubdomain: captcha.get('clientSubdomain'),
|
|
@@ -158,13 +157,22 @@ describe('ThirdPartyCaptcha', function () {
|
|
|
158
157
|
});
|
|
159
158
|
});
|
|
160
159
|
it('should call render with the correct renderParams', function () {
|
|
161
|
-
var
|
|
160
|
+
var renderCalls = global.window.hcaptcha.render.mock.calls;
|
|
161
|
+
var renderParams = renderCalls[0][1];
|
|
162
162
|
expect(renderParams).toEqual({
|
|
163
163
|
sitekey: 'mySiteKey',
|
|
164
164
|
callback: expect.any(Function),
|
|
165
165
|
'expired-callback': expect.any(Function),
|
|
166
166
|
'error-callback': expect.any(Function)
|
|
167
167
|
});
|
|
168
|
+
expect(renderCalls.length).toEqual(1);
|
|
169
|
+
});
|
|
170
|
+
it('should call render on update', function () {
|
|
171
|
+
(0, _testUtils.act)(function () {
|
|
172
|
+
wrapper.setState();
|
|
173
|
+
var renderCalls = global.window.hcaptcha.render.mock.calls;
|
|
174
|
+
expect(renderCalls.length).toEqual(1);
|
|
175
|
+
});
|
|
168
176
|
});
|
|
169
177
|
});
|
|
170
178
|
describe('auth0_v2', function () {
|
|
@@ -175,7 +183,7 @@ describe('ThirdPartyCaptcha', function () {
|
|
|
175
183
|
siteKey: 'mySiteKey'
|
|
176
184
|
});
|
|
177
185
|
var captcha = l.captcha(lockMock);
|
|
178
|
-
wrapper = (0, _enzyme.mount)(
|
|
186
|
+
wrapper = (0, _enzyme.mount)(/*#__PURE__*/_react.default.createElement(_third_party_captcha.ThirdPartyCaptcha, {
|
|
179
187
|
provider: captcha.get('provider'),
|
|
180
188
|
sitekey: captcha.get('siteKey'),
|
|
181
189
|
clientSubdomain: captcha.get('clientSubdomain'),
|
|
@@ -234,7 +242,7 @@ describe('ThirdPartyCaptcha', function () {
|
|
|
234
242
|
siteKey: 'mySiteKey'
|
|
235
243
|
});
|
|
236
244
|
var captcha = l.captcha(lockMock);
|
|
237
|
-
wrapper = (0, _enzyme.mount)(
|
|
245
|
+
wrapper = (0, _enzyme.mount)(/*#__PURE__*/_react.default.createElement(_third_party_captcha.ThirdPartyCaptcha, {
|
|
238
246
|
provider: captcha.get('provider'),
|
|
239
247
|
sitekey: captcha.get('siteKey'),
|
|
240
248
|
clientSubdomain: captcha.get('clientSubdomain'),
|
|
@@ -6,7 +6,7 @@ var _immutable = _interopRequireDefault(require("immutable"));
|
|
|
6
6
|
var _captcha_pane = _interopRequireDefault(require("../../field/captcha/captcha_pane"));
|
|
7
7
|
var _third_party_captcha = require("../../field/captcha/third_party_captcha");
|
|
8
8
|
var _captcha_input = _interopRequireDefault(require("../../ui/input/captcha_input"));
|
|
9
|
-
function _interopRequireDefault(
|
|
9
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
10
|
var createLockMock = function createLockMock() {
|
|
11
11
|
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
12
12
|
_ref$provider = _ref.provider,
|
|
@@ -41,7 +41,7 @@ describe('CaptchaPane', function () {
|
|
|
41
41
|
var lockMock = createLockMock();
|
|
42
42
|
var i8nMock = createI18nMock();
|
|
43
43
|
var onReloadMock = jest.fn();
|
|
44
|
-
wrapper = (0, _enzyme.mount)(
|
|
44
|
+
wrapper = (0, _enzyme.mount)(/*#__PURE__*/_react.default.createElement(_captcha_pane.default, {
|
|
45
45
|
lock: lockMock,
|
|
46
46
|
onReload: onReloadMock,
|
|
47
47
|
i18n: i8nMock
|
|
@@ -60,7 +60,7 @@ describe('CaptchaPane', function () {
|
|
|
60
60
|
});
|
|
61
61
|
var i8nMock = createI18nMock();
|
|
62
62
|
var onReloadMock = jest.fn();
|
|
63
|
-
wrapper = (0, _enzyme.mount)(
|
|
63
|
+
wrapper = (0, _enzyme.mount)(/*#__PURE__*/_react.default.createElement(_captcha_pane.default, {
|
|
64
64
|
lock: lockMock,
|
|
65
65
|
onReload: onReloadMock,
|
|
66
66
|
i18n: i8nMock
|
|
@@ -82,7 +82,7 @@ describe('CaptchaPane', function () {
|
|
|
82
82
|
});
|
|
83
83
|
var i8nMock = createI18nMock();
|
|
84
84
|
var onReloadMock = jest.fn();
|
|
85
|
-
wrapper = (0, _enzyme.mount)(
|
|
85
|
+
wrapper = (0, _enzyme.mount)(/*#__PURE__*/_react.default.createElement(_captcha_pane.default, {
|
|
86
86
|
lock: lockMock,
|
|
87
87
|
onReload: onReloadMock,
|
|
88
88
|
i18n: i8nMock
|
|
@@ -104,7 +104,7 @@ describe('CaptchaPane', function () {
|
|
|
104
104
|
});
|
|
105
105
|
var i8nMock = createI18nMock();
|
|
106
106
|
var onReloadMock = jest.fn();
|
|
107
|
-
wrapper = (0, _enzyme.mount)(
|
|
107
|
+
wrapper = (0, _enzyme.mount)(/*#__PURE__*/_react.default.createElement(_captcha_pane.default, {
|
|
108
108
|
lock: lockMock,
|
|
109
109
|
onReload: onReloadMock,
|
|
110
110
|
i18n: i8nMock
|
|
@@ -126,7 +126,7 @@ describe('CaptchaPane', function () {
|
|
|
126
126
|
});
|
|
127
127
|
var i8nMock = createI18nMock();
|
|
128
128
|
var onReloadMock = jest.fn();
|
|
129
|
-
wrapper = (0, _enzyme.mount)(
|
|
129
|
+
wrapper = (0, _enzyme.mount)(/*#__PURE__*/_react.default.createElement(_captcha_pane.default, {
|
|
130
130
|
lock: lockMock,
|
|
131
131
|
onReload: onReloadMock,
|
|
132
132
|
i18n: i8nMock
|
|
@@ -148,7 +148,7 @@ describe('CaptchaPane', function () {
|
|
|
148
148
|
});
|
|
149
149
|
var i8nMock = createI18nMock();
|
|
150
150
|
var onReloadMock = jest.fn();
|
|
151
|
-
wrapper = (0, _enzyme.mount)(
|
|
151
|
+
wrapper = (0, _enzyme.mount)(/*#__PURE__*/_react.default.createElement(_captcha_pane.default, {
|
|
152
152
|
lock: lockMock,
|
|
153
153
|
onReload: onReloadMock,
|
|
154
154
|
i18n: i8nMock
|
|
@@ -171,7 +171,7 @@ describe('CaptchaPane', function () {
|
|
|
171
171
|
});
|
|
172
172
|
var i8nMock = createI18nMock();
|
|
173
173
|
var onReloadMock = jest.fn();
|
|
174
|
-
wrapper = (0, _enzyme.mount)(
|
|
174
|
+
wrapper = (0, _enzyme.mount)(/*#__PURE__*/_react.default.createElement(_captcha_pane.default, {
|
|
175
175
|
lock: lockMock,
|
|
176
176
|
onReload: onReloadMock,
|
|
177
177
|
i18n: i8nMock
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
var _react = _interopRequireDefault(require("react"));
|
|
4
4
|
var _enzyme = require("enzyme");
|
|
5
5
|
var _testUtils = require("testUtils");
|
|
6
|
-
function _interopRequireDefault(
|
|
7
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (
|
|
6
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
7
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
8
8
|
jest.mock('ui/input/text_input', function () {
|
|
9
9
|
return (0, _testUtils.mockComponent)('text_input');
|
|
10
10
|
});
|
|
@@ -65,18 +65,18 @@ describe('CustomInput', function () {
|
|
|
65
65
|
});
|
|
66
66
|
it('renders correctly as a SelectInput', function () {
|
|
67
67
|
var CustomInput = getComponent();
|
|
68
|
-
(0, _testUtils.expectComponent)(
|
|
68
|
+
(0, _testUtils.expectComponent)(/*#__PURE__*/_react.default.createElement(CustomInput, defaultProps)).toMatchSnapshot();
|
|
69
69
|
});
|
|
70
70
|
it('sets isValid as true when `isFieldVisiblyInvalid` is false', function () {
|
|
71
71
|
require('field/index').isFieldVisiblyInvalid = function () {
|
|
72
72
|
return false;
|
|
73
73
|
};
|
|
74
74
|
var CustomInput = getComponent();
|
|
75
|
-
(0, _testUtils.expectComponent)(
|
|
75
|
+
(0, _testUtils.expectComponent)(/*#__PURE__*/_react.default.createElement(CustomInput, defaultProps)).toMatchSnapshot();
|
|
76
76
|
});
|
|
77
77
|
it('calls `startOptionSelection` when clicked', function () {
|
|
78
78
|
var CustomInput = getComponent();
|
|
79
|
-
var wrapper = (0, _enzyme.mount)(
|
|
79
|
+
var wrapper = (0, _enzyme.mount)(/*#__PURE__*/_react.default.createElement(CustomInput, defaultProps));
|
|
80
80
|
var props = (0, _testUtils.extractPropsFromWrapper)(wrapper);
|
|
81
81
|
props.onClick();
|
|
82
82
|
var mock = require('field/actions').startOptionSelection.mock;
|
|
@@ -90,18 +90,18 @@ describe('CustomInput', function () {
|
|
|
90
90
|
});
|
|
91
91
|
it('renders correctly as a TextInput', function () {
|
|
92
92
|
var CustomInput = getComponent();
|
|
93
|
-
(0, _testUtils.expectComponent)(
|
|
93
|
+
(0, _testUtils.expectComponent)(/*#__PURE__*/_react.default.createElement(CustomInput, defaultProps)).toMatchSnapshot();
|
|
94
94
|
});
|
|
95
95
|
it('sets isValid as true when `isFieldVisiblyInvalid` is false', function () {
|
|
96
96
|
require('field/index').isFieldVisiblyInvalid = function () {
|
|
97
97
|
return false;
|
|
98
98
|
};
|
|
99
99
|
var CustomInput = getComponent();
|
|
100
|
-
(0, _testUtils.expectComponent)(
|
|
100
|
+
(0, _testUtils.expectComponent)(/*#__PURE__*/_react.default.createElement(CustomInput, defaultProps)).toMatchSnapshot();
|
|
101
101
|
});
|
|
102
102
|
it('calls `changeField` when changed', function () {
|
|
103
103
|
var CustomInput = getComponent();
|
|
104
|
-
var wrapper = (0, _enzyme.mount)(
|
|
104
|
+
var wrapper = (0, _enzyme.mount)(/*#__PURE__*/_react.default.createElement(CustomInput, defaultProps));
|
|
105
105
|
var props = (0, _testUtils.extractPropsFromWrapper)(wrapper);
|
|
106
106
|
props.onChange({
|
|
107
107
|
target: {
|
|
@@ -122,7 +122,7 @@ describe('CustomInput', function () {
|
|
|
122
122
|
return false;
|
|
123
123
|
};
|
|
124
124
|
var CustomInput = getComponent();
|
|
125
|
-
(0, _testUtils.expectComponent)(
|
|
125
|
+
(0, _testUtils.expectComponent)(/*#__PURE__*/_react.default.createElement(CustomInput, defaultProps)).toMatchSnapshot();
|
|
126
126
|
});
|
|
127
127
|
describe('and when placeholderHTML is set', function () {
|
|
128
128
|
it('renders correctly as a CheckBoxInput', function () {
|
|
@@ -130,14 +130,14 @@ describe('CustomInput', function () {
|
|
|
130
130
|
return false;
|
|
131
131
|
};
|
|
132
132
|
var CustomInput = getComponent();
|
|
133
|
-
(0, _testUtils.expectComponent)(
|
|
133
|
+
(0, _testUtils.expectComponent)(/*#__PURE__*/_react.default.createElement(CustomInput, _extends({}, defaultProps, {
|
|
134
134
|
placeholderHTML: '<b>Placeholder</b>'
|
|
135
135
|
}))).toMatchSnapshot();
|
|
136
136
|
});
|
|
137
137
|
});
|
|
138
138
|
it('shows an error when value is incorrect', function () {
|
|
139
139
|
var CustomInput = getComponent();
|
|
140
|
-
(0, _testUtils.expectComponent)(
|
|
140
|
+
(0, _testUtils.expectComponent)(/*#__PURE__*/_react.default.createElement(CustomInput, _extends({}, defaultProps, {
|
|
141
141
|
placeholderHTML: '<b>Placeholder</b>'
|
|
142
142
|
}))).toMatchSnapshot();
|
|
143
143
|
});
|
|
@@ -146,7 +146,7 @@ describe('CustomInput', function () {
|
|
|
146
146
|
return undefined;
|
|
147
147
|
};
|
|
148
148
|
var CustomInput = getComponent();
|
|
149
|
-
(0, _testUtils.expectComponent)(
|
|
149
|
+
(0, _testUtils.expectComponent)(/*#__PURE__*/_react.default.createElement(CustomInput, _extends({}, defaultProps, {
|
|
150
150
|
placeholderHTML: '<b>Placeholder</b>'
|
|
151
151
|
}))).toMatchSnapshot();
|
|
152
152
|
});
|
|
@@ -158,7 +158,7 @@ describe('CustomInput', function () {
|
|
|
158
158
|
});
|
|
159
159
|
it('renders correctly as a input[type=hidden]', function () {
|
|
160
160
|
var CustomInput = getComponent();
|
|
161
|
-
(0, _testUtils.expectComponent)(
|
|
161
|
+
(0, _testUtils.expectComponent)(/*#__PURE__*/_react.default.createElement(CustomInput, defaultProps)).toMatchSnapshot();
|
|
162
162
|
});
|
|
163
163
|
});
|
|
164
164
|
});
|
|
@@ -4,7 +4,7 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
4
4
|
var _immutable = _interopRequireDefault(require("immutable"));
|
|
5
5
|
var _enzyme = require("enzyme");
|
|
6
6
|
var _testUtils = require("testUtils");
|
|
7
|
-
function _interopRequireDefault(
|
|
7
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
8
8
|
jest.mock('ui/input/email_input', function () {
|
|
9
9
|
return (0, _testUtils.mockComponent)('email_input');
|
|
10
10
|
});
|
|
@@ -85,7 +85,7 @@ describe('EmailPane', function () {
|
|
|
85
85
|
});
|
|
86
86
|
it('renders correctly', function () {
|
|
87
87
|
var EmailPane = getComponent();
|
|
88
|
-
(0, _testUtils.expectComponent)(
|
|
88
|
+
(0, _testUtils.expectComponent)(/*#__PURE__*/_react.default.createElement(EmailPane, defaultProps)).toMatchSnapshot();
|
|
89
89
|
});
|
|
90
90
|
it('sets `blankErrorHint` when username is empty', function () {
|
|
91
91
|
var fieldIndexMock = require('field/index');
|
|
@@ -101,28 +101,28 @@ describe('EmailPane', function () {
|
|
|
101
101
|
});
|
|
102
102
|
};
|
|
103
103
|
var EmailPane = getComponent();
|
|
104
|
-
(0, _testUtils.expectComponent)(
|
|
104
|
+
(0, _testUtils.expectComponent)(/*#__PURE__*/_react.default.createElement(EmailPane, defaultProps)).toMatchSnapshot();
|
|
105
105
|
});
|
|
106
106
|
it('sets isValid as true when `isFieldVisiblyInvalid` is false', function () {
|
|
107
107
|
require('field/index').isFieldVisiblyInvalid = function () {
|
|
108
108
|
return false;
|
|
109
109
|
};
|
|
110
110
|
var EmailPane = getComponent();
|
|
111
|
-
(0, _testUtils.expectComponent)(
|
|
111
|
+
(0, _testUtils.expectComponent)(/*#__PURE__*/_react.default.createElement(EmailPane, defaultProps)).toMatchSnapshot();
|
|
112
112
|
});
|
|
113
113
|
it('sets autoComplete to true when `allowAutocomplete` is true', function () {
|
|
114
114
|
require('core/index').ui.allowAutocomplete = function () {
|
|
115
115
|
return true;
|
|
116
116
|
};
|
|
117
117
|
var EmailPane = getComponent();
|
|
118
|
-
(0, _testUtils.expectComponent)(
|
|
118
|
+
(0, _testUtils.expectComponent)(/*#__PURE__*/_react.default.createElement(EmailPane, defaultProps)).toMatchSnapshot();
|
|
119
119
|
});
|
|
120
120
|
it('fetches the avatar on componentDidMount if ui.avatar is true and there is a username', function () {
|
|
121
121
|
require('core/index').ui.avatar = function () {
|
|
122
122
|
return true;
|
|
123
123
|
};
|
|
124
124
|
var EmailPane = getComponent();
|
|
125
|
-
(0, _enzyme.mount)(
|
|
125
|
+
(0, _enzyme.mount)(/*#__PURE__*/_react.default.createElement(EmailPane, defaultProps));
|
|
126
126
|
var mock = require('avatar').requestAvatar.mock;
|
|
127
127
|
expect(mock.calls.length).toBe(1);
|
|
128
128
|
});
|
|
@@ -131,7 +131,7 @@ describe('EmailPane', function () {
|
|
|
131
131
|
return true;
|
|
132
132
|
};
|
|
133
133
|
var EmailPane = getComponent();
|
|
134
|
-
var wrapper = (0, _enzyme.mount)(
|
|
134
|
+
var wrapper = (0, _enzyme.mount)(/*#__PURE__*/_react.default.createElement(EmailPane, defaultProps));
|
|
135
135
|
var props = (0, _testUtils.extractPropsFromWrapper)(wrapper);
|
|
136
136
|
props.onChange({
|
|
137
137
|
target: {
|
|
@@ -143,7 +143,7 @@ describe('EmailPane', function () {
|
|
|
143
143
|
});
|
|
144
144
|
it('calls `swap` onChange', function () {
|
|
145
145
|
var EmailPane = getComponent();
|
|
146
|
-
var wrapper = (0, _enzyme.mount)(
|
|
146
|
+
var wrapper = (0, _enzyme.mount)(/*#__PURE__*/_react.default.createElement(EmailPane, defaultProps));
|
|
147
147
|
var props = (0, _testUtils.extractPropsFromWrapper)(wrapper);
|
|
148
148
|
props.onChange({
|
|
149
149
|
target: {
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
var _immutable = _interopRequireDefault(require("immutable"));
|
|
4
4
|
var _field2 = require("../../field");
|
|
5
|
-
function _interopRequireDefault(
|
|
5
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
6
6
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
7
|
-
function _defineProperty(
|
|
7
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
8
8
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
9
9
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
10
10
|
var createModel = function createModel(field) {
|
|
@@ -4,8 +4,8 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
4
4
|
var _enzyme = require("enzyme");
|
|
5
5
|
var _testUtils = require("testUtils");
|
|
6
6
|
var _login_pane = _interopRequireDefault(require("connection/database/login_pane"));
|
|
7
|
-
function _interopRequireDefault(
|
|
8
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (
|
|
7
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
8
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
9
9
|
jest.mock('field/email/email_pane', function () {
|
|
10
10
|
return (0, _testUtils.mockComponent)('email_pane');
|
|
11
11
|
});
|
|
@@ -54,15 +54,15 @@ describe('LoginPane', function () {
|
|
|
54
54
|
jest.resetAllMocks();
|
|
55
55
|
});
|
|
56
56
|
it('renders correctly', function () {
|
|
57
|
-
(0, _testUtils.expectComponent)(
|
|
57
|
+
(0, _testUtils.expectComponent)(/*#__PURE__*/_react.default.createElement(_login_pane.default, defaultProps)).toMatchSnapshot();
|
|
58
58
|
});
|
|
59
59
|
it('shows header when instructions is not empty', function () {
|
|
60
|
-
(0, _testUtils.expectComponent)(
|
|
60
|
+
(0, _testUtils.expectComponent)(/*#__PURE__*/_react.default.createElement(_login_pane.default, _extends({}, defaultProps, {
|
|
61
61
|
instructions: "instructions"
|
|
62
62
|
}))).toMatchSnapshot();
|
|
63
63
|
});
|
|
64
64
|
it('shows email pane when user usernameStyle === email', function () {
|
|
65
|
-
(0, _testUtils.expectComponent)(
|
|
65
|
+
(0, _testUtils.expectComponent)(/*#__PURE__*/_react.default.createElement(_login_pane.default, _extends({}, defaultProps, {
|
|
66
66
|
usernameStyle: "email"
|
|
67
67
|
}))).toMatchSnapshot();
|
|
68
68
|
});
|
|
@@ -72,26 +72,26 @@ describe('LoginPane', function () {
|
|
|
72
72
|
return true;
|
|
73
73
|
};
|
|
74
74
|
});
|
|
75
|
-
(0, _testUtils.expectComponent)(
|
|
75
|
+
(0, _testUtils.expectComponent)(/*#__PURE__*/_react.default.createElement(_login_pane.default, _extends({}, defaultProps, {
|
|
76
76
|
usernameStyle: "email"
|
|
77
77
|
}))).toMatchSnapshot();
|
|
78
78
|
});
|
|
79
79
|
it('shows username pane when user usernameStyle !== email', function () {
|
|
80
|
-
(0, _testUtils.expectComponent)(
|
|
80
|
+
(0, _testUtils.expectComponent)(/*#__PURE__*/_react.default.createElement(_login_pane.default, _extends({}, defaultProps, {
|
|
81
81
|
usernameStyle: "any"
|
|
82
82
|
}))).toMatchSnapshot();
|
|
83
|
-
(0, _testUtils.expectComponent)(
|
|
83
|
+
(0, _testUtils.expectComponent)(/*#__PURE__*/_react.default.createElement(_login_pane.default, _extends({}, defaultProps, {
|
|
84
84
|
usernameStyle: "username"
|
|
85
85
|
}))).toMatchSnapshot();
|
|
86
86
|
});
|
|
87
87
|
it('hides password pane when showPassword===false', function () {
|
|
88
|
-
(0, _testUtils.expectComponent)(
|
|
88
|
+
(0, _testUtils.expectComponent)(/*#__PURE__*/_react.default.createElement(_login_pane.default, _extends({}, defaultProps, {
|
|
89
89
|
showPassword: false
|
|
90
90
|
}))).toMatchSnapshot();
|
|
91
91
|
});
|
|
92
92
|
describe('hides password link', function () {
|
|
93
93
|
it('when showForgotPasswordLink === false', function () {
|
|
94
|
-
(0, _testUtils.expectComponent)(
|
|
94
|
+
(0, _testUtils.expectComponent)(/*#__PURE__*/_react.default.createElement(_login_pane.default, _extends({}, defaultProps, {
|
|
95
95
|
showForgotPasswordLink: false
|
|
96
96
|
}))).toMatchSnapshot();
|
|
97
97
|
});
|
|
@@ -99,14 +99,14 @@ describe('LoginPane', function () {
|
|
|
99
99
|
databaseIndexMock.hasScreen.mockImplementation(function (l, screenName) {
|
|
100
100
|
return screenName === 'forgotPassword' ? false : true;
|
|
101
101
|
});
|
|
102
|
-
(0, _testUtils.expectComponent)(
|
|
102
|
+
(0, _testUtils.expectComponent)(/*#__PURE__*/_react.default.createElement(_login_pane.default, defaultProps)).toMatchSnapshot();
|
|
103
103
|
});
|
|
104
104
|
});
|
|
105
105
|
it('clicking password forgot link calls showResetPasswordActivity() when forgotPasswordLink() is undefined', function () {
|
|
106
106
|
databaseIndexMock.forgotPasswordLink.mockImplementation(function () {
|
|
107
107
|
return undefined;
|
|
108
108
|
});
|
|
109
|
-
var wrapper = (0, _enzyme.mount)(
|
|
109
|
+
var wrapper = (0, _enzyme.mount)(/*#__PURE__*/_react.default.createElement(_login_pane.default, defaultProps));
|
|
110
110
|
wrapper.find('a.auth0-lock-alternative-link').simulate('click');
|
|
111
111
|
var actions = require('connection/database/actions');
|
|
112
112
|
var calls = actions.showResetPasswordActivity.mock.calls;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
var _react = _interopRequireDefault(require("react"));
|
|
4
4
|
var _enzyme = require("enzyme");
|
|
5
5
|
var _testUtils = require("testUtils");
|
|
6
|
-
function _interopRequireDefault(
|
|
6
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
7
7
|
jest.mock('ui/input/mfa_code_input', function () {
|
|
8
8
|
return (0, _testUtils.mockComponent)('mfa_code_input');
|
|
9
9
|
});
|
|
@@ -67,18 +67,18 @@ describe('MFACodePane', function () {
|
|
|
67
67
|
});
|
|
68
68
|
it('renders correctly', function () {
|
|
69
69
|
var MFACodePane = getComponent();
|
|
70
|
-
(0, _testUtils.expectComponent)(
|
|
70
|
+
(0, _testUtils.expectComponent)(/*#__PURE__*/_react.default.createElement(MFACodePane, defaultProps)).toMatchSnapshot();
|
|
71
71
|
});
|
|
72
72
|
it('sets isValid as true when `isFieldVisiblyInvalid` is false', function () {
|
|
73
73
|
require('field/index').isFieldVisiblyInvalid = function () {
|
|
74
74
|
return false;
|
|
75
75
|
};
|
|
76
76
|
var MFACodePane = getComponent();
|
|
77
|
-
(0, _testUtils.expectComponent)(
|
|
77
|
+
(0, _testUtils.expectComponent)(/*#__PURE__*/_react.default.createElement(MFACodePane, defaultProps)).toMatchSnapshot();
|
|
78
78
|
});
|
|
79
79
|
it('calls `swap` onChange', function () {
|
|
80
80
|
var MFACodePane = getComponent();
|
|
81
|
-
var wrapper = (0, _enzyme.mount)(
|
|
81
|
+
var wrapper = (0, _enzyme.mount)(/*#__PURE__*/_react.default.createElement(MFACodePane, defaultProps));
|
|
82
82
|
var props = (0, _testUtils.extractPropsFromWrapper)(wrapper);
|
|
83
83
|
props.onChange({
|
|
84
84
|
target: {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
var _react = _interopRequireDefault(require("react"));
|
|
4
4
|
var _enzyme = require("enzyme");
|
|
5
5
|
var _testUtils = require("testUtils");
|
|
6
|
-
function _interopRequireDefault(
|
|
6
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
7
7
|
jest.mock('ui/list', function () {
|
|
8
8
|
return (0, _testUtils.mockComponent)('list');
|
|
9
9
|
});
|
|
@@ -33,11 +33,11 @@ describe('OptionSelectionPane', function () {
|
|
|
33
33
|
});
|
|
34
34
|
it('renders correctly', function () {
|
|
35
35
|
var OptionSelectionPane = getComponent();
|
|
36
|
-
(0, _testUtils.expectComponent)(
|
|
36
|
+
(0, _testUtils.expectComponent)(/*#__PURE__*/_react.default.createElement(OptionSelectionPane, defaultProps)).toMatchSnapshot();
|
|
37
37
|
});
|
|
38
38
|
it('calls `selectOption` when selected', function () {
|
|
39
39
|
var OptionSelectionPane = getComponent();
|
|
40
|
-
var wrapper = (0, _enzyme.mount)(
|
|
40
|
+
var wrapper = (0, _enzyme.mount)(/*#__PURE__*/_react.default.createElement(OptionSelectionPane, defaultProps));
|
|
41
41
|
var props = (0, _testUtils.extractPropsFromWrapper)(wrapper);
|
|
42
42
|
props.onSelect('selected');
|
|
43
43
|
var mock = require('field/actions').selectOption.mock;
|
|
@@ -46,7 +46,7 @@ describe('OptionSelectionPane', function () {
|
|
|
46
46
|
});
|
|
47
47
|
it('calls `cancelOptionSelection` when cancelled', function () {
|
|
48
48
|
var OptionSelectionPane = getComponent();
|
|
49
|
-
var wrapper = (0, _enzyme.mount)(
|
|
49
|
+
var wrapper = (0, _enzyme.mount)(/*#__PURE__*/_react.default.createElement(OptionSelectionPane, defaultProps));
|
|
50
50
|
var props = (0, _testUtils.extractPropsFromWrapper)(wrapper);
|
|
51
51
|
props.onCancel();
|
|
52
52
|
var mock = require('field/actions').cancelOptionSelection.mock;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _immutable = _interopRequireDefault(require("immutable"));
|
|
4
|
-
function _interopRequireDefault(
|
|
4
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
5
5
|
describe('field/password', function () {
|
|
6
6
|
var passwordField;
|
|
7
7
|
beforeEach(function () {
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
var _react = _interopRequireDefault(require("react"));
|
|
4
4
|
var _enzyme = require("enzyme");
|
|
5
5
|
var _testUtils = require("testUtils");
|
|
6
|
-
function _interopRequireDefault(
|
|
7
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (
|
|
6
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
7
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
8
8
|
jest.mock('ui/input/password_input', function () {
|
|
9
9
|
return (0, _testUtils.mockComponent)('password_input');
|
|
10
10
|
});
|
|
@@ -76,18 +76,18 @@ describe('PasswordPane', function () {
|
|
|
76
76
|
});
|
|
77
77
|
it('renders correctly', function () {
|
|
78
78
|
var PasswordPane = getComponent();
|
|
79
|
-
(0, _testUtils.expectComponent)(
|
|
79
|
+
(0, _testUtils.expectComponent)(/*#__PURE__*/_react.default.createElement(PasswordPane, defaultProps)).toMatchSnapshot();
|
|
80
80
|
});
|
|
81
81
|
it('renders correctly when `allowShowPassword` is true', function () {
|
|
82
82
|
require('core/index').ui.allowShowPassword = function () {
|
|
83
83
|
return true;
|
|
84
84
|
};
|
|
85
85
|
var PasswordPane = getComponent();
|
|
86
|
-
(0, _testUtils.expectComponent)(
|
|
86
|
+
(0, _testUtils.expectComponent)(/*#__PURE__*/_react.default.createElement(PasswordPane, defaultProps)).toMatchSnapshot();
|
|
87
87
|
});
|
|
88
88
|
it('renders correct css className when `hidden` is true', function () {
|
|
89
89
|
var PasswordPane = getComponent();
|
|
90
|
-
(0, _testUtils.expectComponent)(
|
|
90
|
+
(0, _testUtils.expectComponent)(/*#__PURE__*/_react.default.createElement(PasswordPane, _extends({}, defaultProps, {
|
|
91
91
|
hidden: true
|
|
92
92
|
}))).toMatchSnapshot();
|
|
93
93
|
});
|
|
@@ -96,32 +96,32 @@ describe('PasswordPane', function () {
|
|
|
96
96
|
return true;
|
|
97
97
|
};
|
|
98
98
|
var PasswordPane = getComponent();
|
|
99
|
-
(0, _testUtils.expectComponent)(
|
|
99
|
+
(0, _testUtils.expectComponent)(/*#__PURE__*/_react.default.createElement(PasswordPane, defaultProps)).toMatchSnapshot();
|
|
100
100
|
});
|
|
101
101
|
it('sets showPasswordStrengthMessage as true when `isFieldValid` is false', function () {
|
|
102
102
|
require('field/index').isFieldValid = function () {
|
|
103
103
|
return false;
|
|
104
104
|
};
|
|
105
105
|
var PasswordPane = getComponent();
|
|
106
|
-
(0, _testUtils.expectComponent)(
|
|
106
|
+
(0, _testUtils.expectComponent)(/*#__PURE__*/_react.default.createElement(PasswordPane, defaultProps)).toMatchSnapshot();
|
|
107
107
|
});
|
|
108
108
|
it('sets showPasswordStrengthMessage as false when `isFieldValid` is true', function () {
|
|
109
109
|
require('field/index').isFieldValid = function () {
|
|
110
110
|
return true;
|
|
111
111
|
};
|
|
112
112
|
var PasswordPane = getComponent();
|
|
113
|
-
(0, _testUtils.expectComponent)(
|
|
113
|
+
(0, _testUtils.expectComponent)(/*#__PURE__*/_react.default.createElement(PasswordPane, defaultProps)).toMatchSnapshot();
|
|
114
114
|
});
|
|
115
115
|
it('sets isValid as true when `isFieldVisiblyInvalid` is false', function () {
|
|
116
116
|
require('field/index').isFieldVisiblyInvalid = function () {
|
|
117
117
|
return false;
|
|
118
118
|
};
|
|
119
119
|
var PasswordPane = getComponent();
|
|
120
|
-
(0, _testUtils.expectComponent)(
|
|
120
|
+
(0, _testUtils.expectComponent)(/*#__PURE__*/_react.default.createElement(PasswordPane, defaultProps)).toMatchSnapshot();
|
|
121
121
|
});
|
|
122
122
|
it('calls `swap` when password changes', function () {
|
|
123
123
|
var PasswordPane = getComponent();
|
|
124
|
-
var wrapper = (0, _enzyme.mount)(
|
|
124
|
+
var wrapper = (0, _enzyme.mount)(/*#__PURE__*/_react.default.createElement(PasswordPane, defaultProps));
|
|
125
125
|
var props = (0, _testUtils.extractPropsFromWrapper)(wrapper, 1);
|
|
126
126
|
props.onChange({
|
|
127
127
|
target: {
|
|
@@ -137,7 +137,7 @@ describe('PasswordPane', function () {
|
|
|
137
137
|
return true;
|
|
138
138
|
};
|
|
139
139
|
var PasswordPane = getComponent();
|
|
140
|
-
var wrapper = (0, _enzyme.mount)(
|
|
140
|
+
var wrapper = (0, _enzyme.mount)(/*#__PURE__*/_react.default.createElement(PasswordPane, defaultProps));
|
|
141
141
|
var props = wrapper.find('div input').props();
|
|
142
142
|
props.onChange({
|
|
143
143
|
target: {
|
|
@@ -153,6 +153,6 @@ describe('PasswordPane', function () {
|
|
|
153
153
|
return '';
|
|
154
154
|
};
|
|
155
155
|
var PasswordPane = getComponent();
|
|
156
|
-
(0, _testUtils.expectComponent)(
|
|
156
|
+
(0, _testUtils.expectComponent)(/*#__PURE__*/_react.default.createElement(PasswordPane, defaultProps)).toMatchSnapshot();
|
|
157
157
|
});
|
|
158
158
|
});
|