From 688baffb9c7f0fcd3ef3062ab48fc9c4a69a7ba3 Mon Sep 17 00:00:00 2001 From: Jamie Howard Date: Fri, 20 Jan 2023 08:44:18 +0000 Subject: [PATCH] fix(helper-plugin): BigInt mistake --- .../helper-plugin/lib/src/components/GenericInput/index.js | 2 +- .../lib/src/components/GenericInput/utils/getFieldUnits.js | 5 ++--- .../GenericInput/utils/tests/getFieldUnits.test.js | 4 ---- 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/packages/core/helper-plugin/lib/src/components/GenericInput/index.js b/packages/core/helper-plugin/lib/src/components/GenericInput/index.js index 5df206c19b..d14bf07fd7 100644 --- a/packages/core/helper-plugin/lib/src/components/GenericInput/index.js +++ b/packages/core/helper-plugin/lib/src/components/GenericInput/index.js @@ -56,7 +56,7 @@ const GenericInput = ({ description, minimum, maximum, - units: getFieldUnits({ type, name, minimum, maximum }), + units: getFieldUnits({ type, minimum, maximum }), }); const [showPassword, setShowPassword] = useState(false); diff --git a/packages/core/helper-plugin/lib/src/components/GenericInput/utils/getFieldUnits.js b/packages/core/helper-plugin/lib/src/components/GenericInput/utils/getFieldUnits.js index df58c806bc..09329db04a 100644 --- a/packages/core/helper-plugin/lib/src/components/GenericInput/utils/getFieldUnits.js +++ b/packages/core/helper-plugin/lib/src/components/GenericInput/utils/getFieldUnits.js @@ -1,12 +1,11 @@ /** * @param {String} type - * @param {String} name * @param {Number} minimum * @param {Number} maximum * @returns {'' | 'characters' | 'character'} */ -const getFieldUnits = ({ type, name, minimum, maximum }) => { - if (type === 'number' || name === 'BIGINT') { +const getFieldUnits = ({ type, minimum, maximum }) => { + if (type === 'number') { return ''; } const plural = Math.max(minimum || 0, maximum || 0) > 1; diff --git a/packages/core/helper-plugin/lib/src/components/GenericInput/utils/tests/getFieldUnits.test.js b/packages/core/helper-plugin/lib/src/components/GenericInput/utils/tests/getFieldUnits.test.js index 5376ec7cf0..4b22ec30cc 100644 --- a/packages/core/helper-plugin/lib/src/components/GenericInput/utils/tests/getFieldUnits.test.js +++ b/packages/core/helper-plugin/lib/src/components/GenericInput/utils/tests/getFieldUnits.test.js @@ -6,10 +6,6 @@ describe('Content Manager | Inputs | Utils', () => { expect(getFieldUnits({ type: 'number' })).toEqual(''); }); - it('returns for BIGINT types', () => { - expect(getFieldUnits({ name: 'BIGINT' })).toEqual(''); - }); - it('returns "character" when neither minimum or maximum is greater than 1', () => { expect(getFieldUnits({ type: 'text', minimum: 1, maximum: 1 })).toEqual('character'); });