diff --git a/UNRELEASED.md b/UNRELEASED.md index fa215e7a761..0b000825b22 100644 --- a/UNRELEASED.md +++ b/UNRELEASED.md @@ -8,6 +8,8 @@ Use [the changelog guidelines](https://git.io/polaris-changelog-guidelines) to f ### Enhancements +Updated `Textfield` with a `type` of `number` to not render a spinner if step is set to `0` ([#3477](https://github.com/Shopify/polaris-react/pull/3477)) + ### Bug fixes ### Documentation diff --git a/src/components/TextField/TextField.tsx b/src/components/TextField/TextField.tsx index f69126d483d..97a0685c681 100644 --- a/src/components/TextField/TextField.tsx +++ b/src/components/TextField/TextField.tsx @@ -340,7 +340,7 @@ export function TextField({ ); const spinnerMarkup = - type === 'number' && !disabled && !readOnly ? ( + type === 'number' && step !== 0 && !disabled && !readOnly ? ( ', () => { expect(element.find(Spinner)).toHaveLength(0); }); + it('removes spinner buttons when type is number and step is 0', () => { + const spy = jest.fn(); + const element = mountWithAppProvider( + , + ); + expect(element.find(Spinner)).toHaveLength(0); + }); + it('increments by step when value, step, or both are float numbers', () => { const spy = jest.fn(); const element = mountWithAppProvider(