Skip to content

Commit 1337ff3

Browse files
Jaideep PannuJaideep Pannu
authored andcommitted
fix(react-form-renderer): Fix data type validation message for numeric in case of custom message
1 parent 1fa4870 commit 1337ff3

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

packages/react-form-renderer/src/tests/validators/validators.test.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,10 @@ describe('New validators', () => {
131131
it('should not pass the validation and return custom message', () => {
132132
expect(validatorMapper[validatorTypes.MIN_NUMBER_VALUE]({ value: 99, message: 'Foo' })(1)).toEqual('Foo');
133133
});
134+
135+
it('should not pass the validation and return type error message', () => {
136+
expect(validatorMapper[validatorTypes.MIN_NUMBER_VALUE]({ value: 99, message: 'Foo' })("oo")).toEqual('Value is not a number');
137+
});
134138
});
135139

136140
describe('max value validator', () => {

packages/react-form-renderer/src/validators/validator-functions.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ export const numericality = memoize(
9595
}
9696

9797
if (!isNumber(value)) {
98-
return prepareMsg(message, 'notANumber').defaultMessage;
98+
return prepareMsg(null, 'notANumber').defaultMessage;
9999
}
100100

101101
if (equal !== null && +value !== equal) {

0 commit comments

Comments
 (0)