mirror of
https://github.com/strapi/strapi.git
synced 2025-09-26 08:52:26 +00:00
fix(helper-plugin): BigInt mistake
This commit is contained in:
parent
98fdd17fcd
commit
688baffb9c
@ -56,7 +56,7 @@ const GenericInput = ({
|
|||||||
description,
|
description,
|
||||||
minimum,
|
minimum,
|
||||||
maximum,
|
maximum,
|
||||||
units: getFieldUnits({ type, name, minimum, maximum }),
|
units: getFieldUnits({ type, minimum, maximum }),
|
||||||
});
|
});
|
||||||
const [showPassword, setShowPassword] = useState(false);
|
const [showPassword, setShowPassword] = useState(false);
|
||||||
|
|
||||||
|
@ -1,12 +1,11 @@
|
|||||||
/**
|
/**
|
||||||
* @param {String} type
|
* @param {String} type
|
||||||
* @param {String} name
|
|
||||||
* @param {Number} minimum
|
* @param {Number} minimum
|
||||||
* @param {Number} maximum
|
* @param {Number} maximum
|
||||||
* @returns {'' | 'characters' | 'character'}
|
* @returns {'' | 'characters' | 'character'}
|
||||||
*/
|
*/
|
||||||
const getFieldUnits = ({ type, name, minimum, maximum }) => {
|
const getFieldUnits = ({ type, minimum, maximum }) => {
|
||||||
if (type === 'number' || name === 'BIGINT') {
|
if (type === 'number') {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
const plural = Math.max(minimum || 0, maximum || 0) > 1;
|
const plural = Math.max(minimum || 0, maximum || 0) > 1;
|
||||||
|
@ -6,10 +6,6 @@ describe('Content Manager | Inputs | Utils', () => {
|
|||||||
expect(getFieldUnits({ type: 'number' })).toEqual('');
|
expect(getFieldUnits({ type: 'number' })).toEqual('');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('returns <empty string> for BIGINT types', () => {
|
|
||||||
expect(getFieldUnits({ name: 'BIGINT' })).toEqual('');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('returns "character" when neither minimum or maximum is greater than 1', () => {
|
it('returns "character" when neither minimum or maximum is greater than 1', () => {
|
||||||
expect(getFieldUnits({ type: 'text', minimum: 1, maximum: 1 })).toEqual('character');
|
expect(getFieldUnits({ type: 'text', minimum: 1, maximum: 1 })).toEqual('character');
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user