(
onClick={handleStep(-1)}
onMouseDown={handleMouseDown(handleStep(-1))}
onMouseUp={onMouseUp}
+ onBlur={onBlur}
>
diff --git a/polaris-react/src/components/TextField/components/Spinner/tests/Spinner.test.tsx b/polaris-react/src/components/TextField/components/Spinner/tests/Spinner.test.tsx
index 4edddf3afe8..4f02bf3357f 100644
--- a/polaris-react/src/components/TextField/components/Spinner/tests/Spinner.test.tsx
+++ b/polaris-react/src/components/TextField/components/Spinner/tests/Spinner.test.tsx
@@ -4,11 +4,18 @@ import {mountWithApp} from 'tests/utilities';
import {Spinner} from '../Spinner';
describe('', () => {
+ const defaultProps = {
+ onChange: noop,
+ onMouseDown: noop,
+ onMouseUp: noop,
+ onBlur: noop,
+ };
+
describe('onChange', () => {
it('adds a change callback', () => {
const spy = jest.fn();
const spinner = mountWithApp(
- ,
+ ,
);
spinner.find('div', {role: 'button'})!.trigger('onClick');
@@ -19,14 +26,7 @@ describe('', () => {
describe('onClick', () => {
it('adds a click callback', () => {
const spy = jest.fn();
- const spinner = mountWithApp(
- ,
- );
+ const spinner = mountWithApp();
spinner.find('div', {className: 'Spinner'})!.trigger('onClick');
expect(spy).toHaveBeenCalledTimes(1);
});
@@ -40,9 +40,9 @@ describe('', () => {
const changeSpy = jest.fn();
const spinner = mountWithApp(
,
);
@@ -61,9 +61,9 @@ describe('', () => {
const changeSpy = jest.fn();
const spinner = mountWithApp(
,
);
@@ -80,7 +80,7 @@ describe('', () => {
it('adds a mouse up callback', () => {
const spy = jest.fn();
const spinner = mountWithApp(
- ,
+ ,
);
spinner.find('div', {role: 'button'})!.trigger('onMouseUp');
@@ -88,6 +88,17 @@ describe('', () => {
expect(spy).toHaveBeenCalledTimes(1);
});
});
+
+ describe('onBlur()', () => {
+ it('is called when the stepper is blurred', () => {
+ const onBlurSpy = jest.fn();
+ const spinner = mountWithApp(
+ ,
+ );
+ spinner.find('div', {role: 'button'})!.trigger('onBlur');
+ expect(onBlurSpy).toHaveBeenCalledTimes(1);
+ });
+ });
});
function noop() {}