-
-
Notifications
You must be signed in to change notification settings - Fork 489
Expand file tree
/
Copy pathCustom.test.tsx
More file actions
26 lines (21 loc) · 679 Bytes
/
Custom.test.tsx
File metadata and controls
26 lines (21 loc) · 679 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import * as React from 'react';
import Select from '../src';
import { injectRunAllTimers } from './utils/common';
import { fireEvent, render } from '@testing-library/react';
describe('Select.Custom', () => {
injectRunAllTimers(jest);
beforeEach(() => {
jest.useFakeTimers();
});
afterEach(() => {
jest.useRealTimers();
});
it('getRawInputElement', () => {
const onOpenChange = jest.fn();
const { container } = render(
<Select getRawInputElement={() => <span className="custom" />} onOpenChange={onOpenChange} />,
);
fireEvent.click(container.querySelector('.custom'));
expect(onOpenChange).toHaveBeenCalledWith(true);
});
});