auth0-lock 11.34.1 → 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 +32 -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,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 _testUtils = require('testUtils');
|
|
1
|
+
"use strict";
|
|
10
2
|
|
|
3
|
+
var _react = _interopRequireDefault(require("react"));
|
|
4
|
+
var _enzyme = require("enzyme");
|
|
5
|
+
var _testUtils = require("testUtils");
|
|
11
6
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
|
-
|
|
13
7
|
jest.mock('ui/list', function () {
|
|
14
8
|
return (0, _testUtils.mockComponent)('list');
|
|
15
9
|
});
|
|
16
|
-
|
|
17
10
|
var getComponent = function getComponent() {
|
|
18
11
|
return require('field/option_selection_pane').default;
|
|
19
12
|
};
|
|
20
|
-
|
|
21
13
|
describe('OptionSelectionPane', function () {
|
|
22
14
|
var defaultProps = {
|
|
23
15
|
iconUrl: 'iconUrl',
|
|
@@ -30,10 +22,8 @@ describe('OptionSelectionPane', function () {
|
|
|
30
22
|
}
|
|
31
23
|
}
|
|
32
24
|
};
|
|
33
|
-
|
|
34
25
|
beforeEach(function () {
|
|
35
26
|
jest.resetModules();
|
|
36
|
-
|
|
37
27
|
jest.mock('field/actions', function () {
|
|
38
28
|
return {
|
|
39
29
|
cancelOptionSelection: jest.fn(),
|
|
@@ -43,31 +33,23 @@ describe('OptionSelectionPane', function () {
|
|
|
43
33
|
});
|
|
44
34
|
it('renders correctly', function () {
|
|
45
35
|
var OptionSelectionPane = getComponent();
|
|
46
|
-
(0, _testUtils.expectComponent)(
|
|
36
|
+
(0, _testUtils.expectComponent)( /*#__PURE__*/_react.default.createElement(OptionSelectionPane, defaultProps)).toMatchSnapshot();
|
|
47
37
|
});
|
|
48
38
|
it('calls `selectOption` when selected', function () {
|
|
49
39
|
var OptionSelectionPane = getComponent();
|
|
50
|
-
|
|
51
|
-
var wrapper = (0, _enzyme.mount)(_react2.default.createElement(OptionSelectionPane, defaultProps));
|
|
40
|
+
var wrapper = (0, _enzyme.mount)( /*#__PURE__*/_react.default.createElement(OptionSelectionPane, defaultProps));
|
|
52
41
|
var props = (0, _testUtils.extractPropsFromWrapper)(wrapper);
|
|
53
|
-
|
|
54
42
|
props.onSelect('selected');
|
|
55
|
-
|
|
56
43
|
var mock = require('field/actions').selectOption.mock;
|
|
57
|
-
|
|
58
44
|
expect(mock.calls.length).toBe(1);
|
|
59
45
|
expect(mock.calls[0]).toMatchSnapshot();
|
|
60
46
|
});
|
|
61
47
|
it('calls `cancelOptionSelection` when cancelled', function () {
|
|
62
48
|
var OptionSelectionPane = getComponent();
|
|
63
|
-
|
|
64
|
-
var wrapper = (0, _enzyme.mount)(_react2.default.createElement(OptionSelectionPane, defaultProps));
|
|
49
|
+
var wrapper = (0, _enzyme.mount)( /*#__PURE__*/_react.default.createElement(OptionSelectionPane, defaultProps));
|
|
65
50
|
var props = (0, _testUtils.extractPropsFromWrapper)(wrapper);
|
|
66
|
-
|
|
67
51
|
props.onCancel();
|
|
68
|
-
|
|
69
52
|
var mock = require('field/actions').cancelOptionSelection.mock;
|
|
70
|
-
|
|
71
53
|
expect(mock.calls.length).toBe(1);
|
|
72
54
|
expect(mock.calls[0]).toMatchSnapshot();
|
|
73
55
|
});
|
|
@@ -1,35 +1,29 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var _immutable = require('immutable');
|
|
4
|
-
|
|
5
|
-
var _immutable2 = _interopRequireDefault(_immutable);
|
|
1
|
+
"use strict";
|
|
6
2
|
|
|
3
|
+
var _immutable = _interopRequireDefault(require("immutable"));
|
|
7
4
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
8
|
-
|
|
9
5
|
describe('field/password', function () {
|
|
10
|
-
var passwordField
|
|
6
|
+
var passwordField;
|
|
11
7
|
beforeEach(function () {
|
|
12
8
|
jest.resetModules();
|
|
13
9
|
jest.mock('password-sheriff/lib/policy');
|
|
14
10
|
passwordField = require('field/password');
|
|
15
11
|
});
|
|
16
12
|
describe('validatePassword()', function () {
|
|
17
|
-
it(
|
|
13
|
+
it("returns false when there is no password", function () {
|
|
18
14
|
var value = passwordField.validatePassword('');
|
|
19
15
|
expect(value).toBe(false);
|
|
20
16
|
});
|
|
21
|
-
it(
|
|
17
|
+
it("returns true when there is no policy", function () {
|
|
22
18
|
var value = passwordField.validatePassword('the-password');
|
|
23
19
|
expect(value).toBe(true);
|
|
24
20
|
});
|
|
25
|
-
it(
|
|
21
|
+
it("validates password correctly when there is a policy", function () {
|
|
26
22
|
var model = {
|
|
27
23
|
toJS: jest.fn()
|
|
28
24
|
};
|
|
29
25
|
passwordField.validatePassword('the-password', model);
|
|
30
|
-
|
|
31
26
|
var mock = require('password-sheriff/lib/policy').prototype.check.mock;
|
|
32
|
-
|
|
33
27
|
expect(mock.calls.length).toBe(1);
|
|
34
28
|
expect(mock.calls[0][0]).toBe('the-password');
|
|
35
29
|
expect(model.toJS).toHaveBeenCalledTimes(1);
|
|
@@ -1,40 +1,29 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
|
4
|
-
|
|
5
|
-
var _react = require('react');
|
|
6
|
-
|
|
7
|
-
var _react2 = _interopRequireDefault(_react);
|
|
8
|
-
|
|
9
|
-
var _enzyme = require('enzyme');
|
|
10
|
-
|
|
11
|
-
var _testUtils = require('testUtils');
|
|
1
|
+
"use strict";
|
|
12
2
|
|
|
3
|
+
var _react = _interopRequireDefault(require("react"));
|
|
4
|
+
var _enzyme = require("enzyme");
|
|
5
|
+
var _testUtils = require("testUtils");
|
|
13
6
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
|
-
|
|
7
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
15
8
|
jest.mock('ui/input/password_input', function () {
|
|
16
9
|
return (0, _testUtils.mockComponent)('password_input');
|
|
17
10
|
});
|
|
18
|
-
|
|
19
11
|
var getComponent = function getComponent() {
|
|
20
12
|
return require('field/password/password_pane').default;
|
|
21
13
|
};
|
|
22
|
-
|
|
23
14
|
describe('PasswordPane', function () {
|
|
24
15
|
var defaultProps = {
|
|
25
16
|
i18n: {
|
|
26
17
|
str: function str() {
|
|
27
|
-
for (var _len = arguments.length, keys = Array(_len), _key = 0; _key < _len; _key++) {
|
|
18
|
+
for (var _len = arguments.length, keys = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
28
19
|
keys[_key] = arguments[_key];
|
|
29
20
|
}
|
|
30
|
-
|
|
31
21
|
return keys.join(',');
|
|
32
22
|
},
|
|
33
23
|
html: function html() {
|
|
34
|
-
for (var _len2 = arguments.length, keys = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
24
|
+
for (var _len2 = arguments.length, keys = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
35
25
|
keys[_key2] = arguments[_key2];
|
|
36
26
|
}
|
|
37
|
-
|
|
38
27
|
return keys.join(',');
|
|
39
28
|
}
|
|
40
29
|
},
|
|
@@ -43,10 +32,8 @@ describe('PasswordPane', function () {
|
|
|
43
32
|
policy: 'policy',
|
|
44
33
|
strengthMessages: {}
|
|
45
34
|
};
|
|
46
|
-
|
|
47
35
|
beforeEach(function () {
|
|
48
36
|
jest.resetModules();
|
|
49
|
-
|
|
50
37
|
jest.mock('field/index', function () {
|
|
51
38
|
return {
|
|
52
39
|
isFieldValid: function isFieldValid() {
|
|
@@ -60,13 +47,11 @@ describe('PasswordPane', function () {
|
|
|
60
47
|
}
|
|
61
48
|
};
|
|
62
49
|
});
|
|
63
|
-
|
|
64
50
|
jest.mock('field/password', function () {
|
|
65
51
|
return {
|
|
66
52
|
setPassword: 'setPassword'
|
|
67
53
|
};
|
|
68
54
|
});
|
|
69
|
-
|
|
70
55
|
jest.mock('core/index', function () {
|
|
71
56
|
return {
|
|
72
57
|
id: function id() {
|
|
@@ -82,7 +67,6 @@ describe('PasswordPane', function () {
|
|
|
82
67
|
}
|
|
83
68
|
};
|
|
84
69
|
});
|
|
85
|
-
|
|
86
70
|
jest.mock('store/index', function () {
|
|
87
71
|
return {
|
|
88
72
|
swap: jest.fn(),
|
|
@@ -90,63 +74,61 @@ describe('PasswordPane', function () {
|
|
|
90
74
|
};
|
|
91
75
|
});
|
|
92
76
|
});
|
|
93
|
-
|
|
94
77
|
it('renders correctly', function () {
|
|
95
78
|
var PasswordPane = getComponent();
|
|
96
|
-
(0, _testUtils.expectComponent)(
|
|
79
|
+
(0, _testUtils.expectComponent)( /*#__PURE__*/_react.default.createElement(PasswordPane, defaultProps)).toMatchSnapshot();
|
|
97
80
|
});
|
|
98
81
|
it('renders correctly when `allowShowPassword` is true', function () {
|
|
99
82
|
require('core/index').ui.allowShowPassword = function () {
|
|
100
83
|
return true;
|
|
101
84
|
};
|
|
102
85
|
var PasswordPane = getComponent();
|
|
103
|
-
(0, _testUtils.expectComponent)(
|
|
86
|
+
(0, _testUtils.expectComponent)( /*#__PURE__*/_react.default.createElement(PasswordPane, defaultProps)).toMatchSnapshot();
|
|
104
87
|
});
|
|
105
88
|
it('renders correct css className when `hidden` is true', function () {
|
|
106
89
|
var PasswordPane = getComponent();
|
|
107
|
-
(0, _testUtils.expectComponent)(
|
|
90
|
+
(0, _testUtils.expectComponent)( /*#__PURE__*/_react.default.createElement(PasswordPane, _extends({}, defaultProps, {
|
|
91
|
+
hidden: true
|
|
92
|
+
}))).toMatchSnapshot();
|
|
108
93
|
});
|
|
109
94
|
it('disables input when submitting', function () {
|
|
110
95
|
require('core/index').submitting = function () {
|
|
111
96
|
return true;
|
|
112
97
|
};
|
|
113
98
|
var PasswordPane = getComponent();
|
|
114
|
-
|
|
115
|
-
(0, _testUtils.expectComponent)(_react2.default.createElement(PasswordPane, defaultProps)).toMatchSnapshot();
|
|
99
|
+
(0, _testUtils.expectComponent)( /*#__PURE__*/_react.default.createElement(PasswordPane, defaultProps)).toMatchSnapshot();
|
|
116
100
|
});
|
|
117
101
|
it('sets showPasswordStrengthMessage as true when `isFieldValid` is false', function () {
|
|
118
102
|
require('field/index').isFieldValid = function () {
|
|
119
103
|
return false;
|
|
120
104
|
};
|
|
121
105
|
var PasswordPane = getComponent();
|
|
122
|
-
|
|
123
|
-
(0, _testUtils.expectComponent)(_react2.default.createElement(PasswordPane, defaultProps)).toMatchSnapshot();
|
|
106
|
+
(0, _testUtils.expectComponent)( /*#__PURE__*/_react.default.createElement(PasswordPane, defaultProps)).toMatchSnapshot();
|
|
124
107
|
});
|
|
125
108
|
it('sets showPasswordStrengthMessage as false when `isFieldValid` is true', function () {
|
|
126
109
|
require('field/index').isFieldValid = function () {
|
|
127
110
|
return true;
|
|
128
111
|
};
|
|
129
112
|
var PasswordPane = getComponent();
|
|
130
|
-
|
|
131
|
-
(0, _testUtils.expectComponent)(_react2.default.createElement(PasswordPane, defaultProps)).toMatchSnapshot();
|
|
113
|
+
(0, _testUtils.expectComponent)( /*#__PURE__*/_react.default.createElement(PasswordPane, defaultProps)).toMatchSnapshot();
|
|
132
114
|
});
|
|
133
115
|
it('sets isValid as true when `isFieldVisiblyInvalid` is false', function () {
|
|
134
116
|
require('field/index').isFieldVisiblyInvalid = function () {
|
|
135
117
|
return false;
|
|
136
118
|
};
|
|
137
119
|
var PasswordPane = getComponent();
|
|
138
|
-
|
|
139
|
-
(0, _testUtils.expectComponent)(_react2.default.createElement(PasswordPane, defaultProps)).toMatchSnapshot();
|
|
120
|
+
(0, _testUtils.expectComponent)( /*#__PURE__*/_react.default.createElement(PasswordPane, defaultProps)).toMatchSnapshot();
|
|
140
121
|
});
|
|
141
122
|
it('calls `swap` when password changes', function () {
|
|
142
123
|
var PasswordPane = getComponent();
|
|
143
|
-
|
|
144
|
-
var wrapper = (0, _enzyme.mount)(_react2.default.createElement(PasswordPane, defaultProps));
|
|
124
|
+
var wrapper = (0, _enzyme.mount)( /*#__PURE__*/_react.default.createElement(PasswordPane, defaultProps));
|
|
145
125
|
var props = (0, _testUtils.extractPropsFromWrapper)(wrapper, 1);
|
|
146
|
-
props.onChange({
|
|
147
|
-
|
|
126
|
+
props.onChange({
|
|
127
|
+
target: {
|
|
128
|
+
value: 'newPassword'
|
|
129
|
+
}
|
|
130
|
+
});
|
|
148
131
|
var mock = require('store/index').swap.mock;
|
|
149
|
-
|
|
150
132
|
expect(mock.calls.length).toBe(1);
|
|
151
133
|
expect(mock.calls[0]).toMatchSnapshot();
|
|
152
134
|
});
|
|
@@ -155,13 +137,14 @@ describe('PasswordPane', function () {
|
|
|
155
137
|
return true;
|
|
156
138
|
};
|
|
157
139
|
var PasswordPane = getComponent();
|
|
158
|
-
|
|
159
|
-
var wrapper = (0, _enzyme.mount)(_react2.default.createElement(PasswordPane, defaultProps));
|
|
140
|
+
var wrapper = (0, _enzyme.mount)( /*#__PURE__*/_react.default.createElement(PasswordPane, defaultProps));
|
|
160
141
|
var props = wrapper.find('div input').props();
|
|
161
|
-
props.onChange({
|
|
162
|
-
|
|
142
|
+
props.onChange({
|
|
143
|
+
target: {
|
|
144
|
+
checked: true
|
|
145
|
+
}
|
|
146
|
+
});
|
|
163
147
|
var mock = require('store/index').swap.mock;
|
|
164
|
-
|
|
165
148
|
expect(mock.calls.length).toBe(1);
|
|
166
149
|
expect(mock.calls[0]).toMatchSnapshot();
|
|
167
150
|
});
|
|
@@ -170,6 +153,6 @@ describe('PasswordPane', function () {
|
|
|
170
153
|
return '';
|
|
171
154
|
};
|
|
172
155
|
var PasswordPane = getComponent();
|
|
173
|
-
(0, _testUtils.expectComponent)(
|
|
156
|
+
(0, _testUtils.expectComponent)( /*#__PURE__*/_react.default.createElement(PasswordPane, defaultProps)).toMatchSnapshot();
|
|
174
157
|
});
|
|
175
158
|
});
|
|
@@ -1,28 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
|
4
|
-
|
|
5
|
-
var _react = require('react');
|
|
6
|
-
|
|
7
|
-
var _react2 = _interopRequireDefault(_react);
|
|
8
|
-
|
|
9
|
-
var _enzyme = require('enzyme');
|
|
10
|
-
|
|
11
|
-
var _testUtils = require('testUtils');
|
|
1
|
+
"use strict";
|
|
12
2
|
|
|
3
|
+
var _react = _interopRequireDefault(require("react"));
|
|
4
|
+
var _enzyme = require("enzyme");
|
|
5
|
+
var _testUtils = require("testUtils");
|
|
13
6
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
|
-
|
|
7
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
15
8
|
jest.mock('ui/input/phone_number_input', function () {
|
|
16
9
|
return (0, _testUtils.mockComponent)('phone_number_input');
|
|
17
10
|
});
|
|
18
11
|
jest.mock('ui/input/select_input', function () {
|
|
19
12
|
return (0, _testUtils.mockComponent)('select_input');
|
|
20
13
|
});
|
|
21
|
-
|
|
22
14
|
var getComponent = function getComponent() {
|
|
23
15
|
return require('field/phone-number/phone_number_pane').default;
|
|
24
16
|
};
|
|
25
|
-
|
|
26
17
|
describe('PhoneNumberPane', function () {
|
|
27
18
|
var defaultProps = {
|
|
28
19
|
lock: {},
|
|
@@ -30,7 +21,6 @@ describe('PhoneNumberPane', function () {
|
|
|
30
21
|
};
|
|
31
22
|
beforeEach(function () {
|
|
32
23
|
jest.resetModules();
|
|
33
|
-
|
|
34
24
|
jest.mock('field/index', function () {
|
|
35
25
|
return {
|
|
36
26
|
phoneNumber: function phoneNumber() {
|
|
@@ -41,7 +31,6 @@ describe('PhoneNumberPane', function () {
|
|
|
41
31
|
}
|
|
42
32
|
};
|
|
43
33
|
});
|
|
44
|
-
|
|
45
34
|
jest.mock('field/phone_number', function () {
|
|
46
35
|
return {
|
|
47
36
|
humanLocation: function humanLocation() {
|
|
@@ -50,7 +39,6 @@ describe('PhoneNumberPane', function () {
|
|
|
50
39
|
setPhoneNumber: 'setPhoneNumber'
|
|
51
40
|
};
|
|
52
41
|
});
|
|
53
|
-
|
|
54
42
|
jest.mock('core/index', function () {
|
|
55
43
|
return {
|
|
56
44
|
id: function id() {
|
|
@@ -61,13 +49,11 @@ describe('PhoneNumberPane', function () {
|
|
|
61
49
|
}
|
|
62
50
|
};
|
|
63
51
|
});
|
|
64
|
-
|
|
65
52
|
jest.mock('field/actions', function () {
|
|
66
53
|
return {
|
|
67
54
|
startOptionSelection: jest.fn()
|
|
68
55
|
};
|
|
69
56
|
});
|
|
70
|
-
|
|
71
57
|
jest.mock('store/index', function () {
|
|
72
58
|
return {
|
|
73
59
|
swap: jest.fn(),
|
|
@@ -75,58 +61,49 @@ describe('PhoneNumberPane', function () {
|
|
|
75
61
|
};
|
|
76
62
|
});
|
|
77
63
|
});
|
|
78
|
-
|
|
79
64
|
it('renders correctly', function () {
|
|
80
65
|
var PhoneNumberPane = getComponent();
|
|
81
|
-
(0, _testUtils.expectComponent)(
|
|
66
|
+
(0, _testUtils.expectComponent)( /*#__PURE__*/_react.default.createElement(PhoneNumberPane, defaultProps)).toMatchSnapshot();
|
|
82
67
|
});
|
|
83
68
|
it('shows header when instructions are available', function () {
|
|
84
69
|
var PhoneNumberPane = getComponent();
|
|
85
|
-
(0, _testUtils.expectComponent)(
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
'instructions'
|
|
89
|
-
) }))).toMatchSnapshot();
|
|
70
|
+
(0, _testUtils.expectComponent)( /*#__PURE__*/_react.default.createElement(PhoneNumberPane, _extends({}, defaultProps, {
|
|
71
|
+
instructions: /*#__PURE__*/_react.default.createElement("span", null, "instructions")
|
|
72
|
+
}))).toMatchSnapshot();
|
|
90
73
|
});
|
|
91
74
|
it('disables input when submitting', function () {
|
|
92
75
|
require('core/index').submitting = function () {
|
|
93
76
|
return true;
|
|
94
77
|
};
|
|
95
78
|
var PhoneNumberPane = getComponent();
|
|
96
|
-
|
|
97
|
-
(0, _testUtils.expectComponent)(_react2.default.createElement(PhoneNumberPane, defaultProps)).toMatchSnapshot();
|
|
79
|
+
(0, _testUtils.expectComponent)( /*#__PURE__*/_react.default.createElement(PhoneNumberPane, defaultProps)).toMatchSnapshot();
|
|
98
80
|
});
|
|
99
81
|
it('sets isValid as true when `isFieldVisiblyInvalid` is false', function () {
|
|
100
82
|
require('field/index').isFieldVisiblyInvalid = function () {
|
|
101
83
|
return false;
|
|
102
84
|
};
|
|
103
85
|
var PhoneNumberPane = getComponent();
|
|
104
|
-
|
|
105
|
-
(0, _testUtils.expectComponent)(_react2.default.createElement(PhoneNumberPane, defaultProps)).toMatchSnapshot();
|
|
86
|
+
(0, _testUtils.expectComponent)( /*#__PURE__*/_react.default.createElement(PhoneNumberPane, defaultProps)).toMatchSnapshot();
|
|
106
87
|
});
|
|
107
88
|
it('calls `startOptionSelection` when SelectInput is clicked', function () {
|
|
108
89
|
var PhoneNumberPane = getComponent();
|
|
109
|
-
|
|
110
|
-
var wrapper = (0, _enzyme.mount)(_react2.default.createElement(PhoneNumberPane, defaultProps));
|
|
90
|
+
var wrapper = (0, _enzyme.mount)( /*#__PURE__*/_react.default.createElement(PhoneNumberPane, defaultProps));
|
|
111
91
|
var props = (0, _testUtils.extractPropsFromWrapper)(wrapper, 1);
|
|
112
|
-
|
|
113
92
|
props.onClick();
|
|
114
|
-
|
|
115
93
|
var mock = require('field/actions').startOptionSelection.mock;
|
|
116
|
-
|
|
117
94
|
expect(mock.calls.length).toBe(1);
|
|
118
95
|
expect(mock.calls[0]).toMatchSnapshot();
|
|
119
96
|
});
|
|
120
97
|
it('calls `swap` when PhoneNumberInput changes', function () {
|
|
121
98
|
var PhoneNumberPane = getComponent();
|
|
122
|
-
|
|
123
|
-
var wrapper = (0, _enzyme.mount)(_react2.default.createElement(PhoneNumberPane, defaultProps));
|
|
99
|
+
var wrapper = (0, _enzyme.mount)( /*#__PURE__*/_react.default.createElement(PhoneNumberPane, defaultProps));
|
|
124
100
|
var props = (0, _testUtils.extractPropsFromWrapper)(wrapper, 2);
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
101
|
+
props.onChange({
|
|
102
|
+
target: {
|
|
103
|
+
value: 'newPhoneNumber'
|
|
104
|
+
}
|
|
105
|
+
});
|
|
128
106
|
var mock = require('store/index').swap.mock;
|
|
129
|
-
|
|
130
107
|
expect(mock.calls.length).toBe(1);
|
|
131
108
|
expect(mock.calls[0]).toMatchSnapshot();
|
|
132
109
|
});
|
|
@@ -1,25 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
|
4
|
-
|
|
5
|
-
var _react = require('react');
|
|
6
|
-
|
|
7
|
-
var _react2 = _interopRequireDefault(_react);
|
|
8
|
-
|
|
9
|
-
var _enzyme = require('enzyme');
|
|
10
|
-
|
|
11
|
-
var _testUtils = require('testUtils');
|
|
1
|
+
"use strict";
|
|
12
2
|
|
|
3
|
+
var _react = _interopRequireDefault(require("react"));
|
|
4
|
+
var _enzyme = require("enzyme");
|
|
5
|
+
var _testUtils = require("testUtils");
|
|
13
6
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
|
-
|
|
7
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
15
8
|
jest.mock('ui/button/auth_button', function () {
|
|
16
9
|
return (0, _testUtils.mockComponent)('auth_button');
|
|
17
10
|
});
|
|
18
|
-
|
|
19
11
|
var getComponent = function getComponent() {
|
|
20
12
|
return require('field/social/social_buttons_pane').default;
|
|
21
13
|
};
|
|
22
|
-
|
|
23
14
|
describe('SocialButtonsPane', function () {
|
|
24
15
|
var defaultProps = {
|
|
25
16
|
lock: {
|
|
@@ -29,44 +20,46 @@ describe('SocialButtonsPane', function () {
|
|
|
29
20
|
}
|
|
30
21
|
},
|
|
31
22
|
labelFn: function labelFn() {
|
|
32
|
-
for (var _len = arguments.length, keys = Array(_len), _key = 0; _key < _len; _key++) {
|
|
23
|
+
for (var _len = arguments.length, keys = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
33
24
|
keys[_key] = arguments[_key];
|
|
34
25
|
}
|
|
35
|
-
|
|
36
26
|
return keys.join(',');
|
|
37
27
|
},
|
|
38
28
|
showLoading: false,
|
|
39
29
|
signUp: false,
|
|
40
30
|
disabled: false
|
|
41
31
|
};
|
|
42
|
-
|
|
43
32
|
beforeEach(function () {
|
|
44
33
|
jest.resetModules();
|
|
45
|
-
|
|
46
34
|
jest.mock('quick-auth/actions', function () {
|
|
47
35
|
return {
|
|
48
36
|
logIn: jest.fn()
|
|
49
37
|
};
|
|
50
38
|
});
|
|
51
|
-
|
|
52
39
|
jest.mock('connection/social/index', function () {
|
|
53
40
|
return {
|
|
54
41
|
displayName: function displayName() {
|
|
55
42
|
return 'displayName';
|
|
56
43
|
},
|
|
57
44
|
socialConnections: function socialConnections() {
|
|
58
|
-
return [{
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
return
|
|
62
|
-
}
|
|
45
|
+
return [{
|
|
46
|
+
item: 1,
|
|
47
|
+
get: function get(key) {
|
|
48
|
+
return "socialConnections1-".concat(key);
|
|
49
|
+
}
|
|
50
|
+
}, {
|
|
51
|
+
item: 2,
|
|
52
|
+
get: function get(key) {
|
|
53
|
+
return "socialConnections2-".concat(key);
|
|
54
|
+
}
|
|
55
|
+
}];
|
|
63
56
|
},
|
|
64
57
|
authButtonsTheme: function authButtonsTheme() {
|
|
65
58
|
return {
|
|
66
59
|
get: function get() {
|
|
67
60
|
return {
|
|
68
61
|
get: function get(key) {
|
|
69
|
-
return
|
|
62
|
+
return "authButtonsTheme-".concat(key);
|
|
70
63
|
}
|
|
71
64
|
};
|
|
72
65
|
}
|
|
@@ -74,7 +67,6 @@ describe('SocialButtonsPane', function () {
|
|
|
74
67
|
}
|
|
75
68
|
};
|
|
76
69
|
});
|
|
77
|
-
|
|
78
70
|
jest.mock('connection/database/index', function () {
|
|
79
71
|
return {
|
|
80
72
|
termsAccepted: function termsAccepted() {
|
|
@@ -82,13 +74,11 @@ describe('SocialButtonsPane', function () {
|
|
|
82
74
|
}
|
|
83
75
|
};
|
|
84
76
|
});
|
|
85
|
-
|
|
86
77
|
jest.mock('connection/database/actions', function () {
|
|
87
78
|
return {
|
|
88
79
|
signUpError: jest.fn()
|
|
89
80
|
};
|
|
90
81
|
});
|
|
91
|
-
|
|
92
82
|
jest.mock('core/index', function () {
|
|
93
83
|
return {
|
|
94
84
|
id: function id() {
|
|
@@ -98,55 +88,48 @@ describe('SocialButtonsPane', function () {
|
|
|
98
88
|
};
|
|
99
89
|
});
|
|
100
90
|
});
|
|
101
|
-
|
|
102
91
|
it('renders correctly', function () {
|
|
103
92
|
var SocialButtonsPane = getComponent();
|
|
104
|
-
(0, _testUtils.expectComponent)(
|
|
93
|
+
(0, _testUtils.expectComponent)( /*#__PURE__*/_react.default.createElement(SocialButtonsPane, defaultProps)).toMatchSnapshot();
|
|
105
94
|
});
|
|
106
95
|
it('calls signUpError when isSignUp===true and terms were not accepted', function () {
|
|
107
96
|
var SocialButtonsPane = getComponent();
|
|
108
|
-
|
|
109
|
-
|
|
97
|
+
var wrapper = (0, _enzyme.mount)( /*#__PURE__*/_react.default.createElement(SocialButtonsPane, _extends({}, defaultProps, {
|
|
98
|
+
signUp: true
|
|
99
|
+
})));
|
|
110
100
|
var props = (0, _testUtils.extractPropsFromWrapper)(wrapper, 2);
|
|
111
|
-
|
|
112
101
|
props.onClick();
|
|
113
|
-
|
|
114
102
|
var mock = require('connection/database/actions').signUpError.mock;
|
|
115
|
-
|
|
116
103
|
expect(mock.calls.length).toBe(1);
|
|
117
104
|
expect(mock.calls[0]).toMatchSnapshot();
|
|
118
105
|
});
|
|
119
106
|
it('shows loading when showLoading === true', function () {
|
|
120
107
|
var SocialButtonsPane = getComponent();
|
|
121
|
-
(0, _testUtils.expectComponent)(
|
|
108
|
+
(0, _testUtils.expectComponent)( /*#__PURE__*/_react.default.createElement(SocialButtonsPane, _extends({}, defaultProps, {
|
|
109
|
+
showLoading: true
|
|
110
|
+
}))).toMatchSnapshot();
|
|
122
111
|
});
|
|
123
112
|
it('shows header when instructions are available', function () {
|
|
124
113
|
var SocialButtonsPane = getComponent();
|
|
125
|
-
(0, _testUtils.expectComponent)(
|
|
114
|
+
(0, _testUtils.expectComponent)( /*#__PURE__*/_react.default.createElement(SocialButtonsPane, _extends({}, defaultProps, {
|
|
115
|
+
instructions: "instructions"
|
|
116
|
+
}))).toMatchSnapshot();
|
|
126
117
|
});
|
|
127
118
|
it('calls `logIn` with social connection 1 when first button is clicked', function () {
|
|
128
119
|
var SocialButtonsPane = getComponent();
|
|
129
|
-
|
|
130
|
-
var wrapper = (0, _enzyme.mount)(_react2.default.createElement(SocialButtonsPane, defaultProps));
|
|
120
|
+
var wrapper = (0, _enzyme.mount)( /*#__PURE__*/_react.default.createElement(SocialButtonsPane, defaultProps));
|
|
131
121
|
var props = (0, _testUtils.extractPropsFromWrapper)(wrapper, 2);
|
|
132
|
-
|
|
133
122
|
props.onClick();
|
|
134
|
-
|
|
135
123
|
var mock = require('quick-auth/actions').logIn.mock;
|
|
136
|
-
|
|
137
124
|
expect(mock.calls.length).toBe(1);
|
|
138
125
|
expect(mock.calls[0]).toMatchSnapshot();
|
|
139
126
|
});
|
|
140
127
|
it('calls `logIn` with social connection 2 when second button is clicked', function () {
|
|
141
128
|
var SocialButtonsPane = getComponent();
|
|
142
|
-
|
|
143
|
-
var wrapper = (0, _enzyme.mount)(_react2.default.createElement(SocialButtonsPane, defaultProps));
|
|
129
|
+
var wrapper = (0, _enzyme.mount)( /*#__PURE__*/_react.default.createElement(SocialButtonsPane, defaultProps));
|
|
144
130
|
var props = (0, _testUtils.extractPropsFromWrapper)(wrapper, 3);
|
|
145
|
-
|
|
146
131
|
props.onClick();
|
|
147
|
-
|
|
148
132
|
var mock = require('quick-auth/actions').logIn.mock;
|
|
149
|
-
|
|
150
133
|
expect(mock.calls.length).toBe(1);
|
|
151
134
|
expect(mock.calls[0]).toMatchSnapshot();
|
|
152
135
|
});
|