diff --git a/packages/mui-base/src/unstable_useNumberInput/useNumberInput2.test.tsx b/packages/mui-base/src/unstable_useNumberInput/useNumberInput2.test.tsx new file mode 100644 index 0000000000..019ab4ea07 --- /dev/null +++ b/packages/mui-base/src/unstable_useNumberInput/useNumberInput2.test.tsx @@ -0,0 +1,41 @@ +import * as React from 'react'; +import { expect } from 'chai'; +import { spy } from 'sinon'; +import { createRenderer, screen, fireEvent } from '@mui/internal-test-utils'; +import { unstable_useNumberInput as useNumberInput } from '@mui/base/unstable_useNumberInput'; + +describe('useNumberInput2', () => { + const { clock, render } = createRenderer(); + + describe('press and hold', () => { + clock.withFakeTimers(); + + it('should call onChange continuously', () => { + const handleChange = spy(); + function NumberInput(props: { defaultValue: number }) { + const { getInputProps, getIncrementButtonProps } = useNumberInput({ + ...props, + onChange: handleChange, + }); + + return ( +