Skip to content

Commit a8f0ce4

Browse files
committed
more tests
1 parent 22c25be commit a8f0ce4

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

src/user-event/scroll/__tests__/pull-to-refresh.test.tsx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,4 +52,18 @@ describe('pullToRefresh()', () => {
5252
await user.pullToRefresh(screen.getByTestId('view'));
5353
expect(onRefreshMock).toHaveBeenCalled();
5454
});
55+
56+
it('does not throw when RefreshControl is not set', async () => {
57+
render(<ScrollView testID="view" />);
58+
const user = userEvent.setup();
59+
60+
await expect(() => user.pullToRefresh(screen.getByTestId('view'))).not.toThrow();
61+
});
62+
63+
it('does not throw when RefreshControl onRefresh is not set', async () => {
64+
render(<ScrollView testID="view" refreshControl={<RefreshControl refreshing={false} />} />);
65+
const user = userEvent.setup();
66+
67+
await expect(() => user.pullToRefresh(screen.getByTestId('view'))).not.toThrow();
68+
});
5569
});

src/user-event/setup/setup.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ import type { PressOptions } from '../press';
88
import { longPress, press } from '../press';
99
import type { ScrollToOptions } from '../scroll';
1010
import { scrollTo } from '../scroll';
11+
import { pullToRefresh } from '../scroll/pull-to-refresh';
1112
import type { TypeOptions } from '../type';
1213
import { type } from '../type';
1314
import { wait } from '../utils';
14-
import { pullToRefresh } from '../scroll/pull-to-refresh';
1515

1616
export interface UserEventSetupOptions {
1717
/**

0 commit comments

Comments
 (0)