@itfin/components 2.0.21 → 2.0.22
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/package.json
CHANGED
|
@@ -183,7 +183,7 @@ export function dateSameOrBeforeValidation (dateCompare, message) {
|
|
|
183
183
|
};
|
|
184
184
|
}
|
|
185
185
|
|
|
186
|
-
export function
|
|
186
|
+
export function passwordValidation(message) {
|
|
187
187
|
return (v, $t) => {
|
|
188
188
|
return !isEmpty(v) && PASSWORD_REGEX.test(v.trim() + '') || (message || $t('components.passwordValidation'));
|
|
189
189
|
};
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
dateAfterValidation,
|
|
8
8
|
dateSameOrAfterValidation,
|
|
9
9
|
dateSameOrBeforeValidation,
|
|
10
|
-
|
|
10
|
+
passwordValidation,
|
|
11
11
|
} from './validators';
|
|
12
12
|
|
|
13
13
|
describe('Validators', () => {
|
|
@@ -84,15 +84,15 @@ describe('Validators', () => {
|
|
|
84
84
|
});
|
|
85
85
|
|
|
86
86
|
|
|
87
|
-
test('
|
|
88
|
-
expect(
|
|
89
|
-
expect(
|
|
90
|
-
expect(
|
|
91
|
-
expect(
|
|
92
|
-
expect(
|
|
93
|
-
expect(
|
|
94
|
-
expect(
|
|
95
|
-
expect(
|
|
96
|
-
expect(
|
|
87
|
+
test('passwordValidation', () => {
|
|
88
|
+
expect(passwordValidation()('', $t)).toEqual('components.passwordValidation');
|
|
89
|
+
expect(passwordValidation()(' ', $t)).toEqual('components.passwordValidation');
|
|
90
|
+
expect(passwordValidation()(null, $t)).toEqual('components.passwordValidation');
|
|
91
|
+
expect(passwordValidation()(undefined, $t)).toEqual('components.passwordValidation');
|
|
92
|
+
expect(passwordValidation()(' тесттест ', $t)).toEqual('components.passwordValidation');
|
|
93
|
+
expect(passwordValidation()(' ТЕСТТЕСТ ', $t)).toEqual('components.passwordValidation');
|
|
94
|
+
expect(passwordValidation()(' ТестТест ', $t)).toEqual('components.passwordValidation');
|
|
95
|
+
expect(passwordValidation()(' ТестТест1 ', $t)).toEqual('components.passwordValidation');
|
|
96
|
+
expect(passwordValidation()(' ТестТест1@ ', $t)).toEqual(true);
|
|
97
97
|
});
|
|
98
98
|
});
|