Skip to content

Commit eb51c83

Browse files
committed
test: add test case
1 parent 1d547d1 commit eb51c83

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

tests/ref.spec.tsx

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/* eslint-disable react/no-render-return-value, max-classes-per-file, func-names, no-console */
2+
import { render } from '@testing-library/react';
3+
import { Provider } from 'rc-motion';
4+
import React from 'react';
5+
import Dialog from '../src';
6+
7+
describe('Dialog.ref', () => {
8+
beforeEach(() => {
9+
jest.useFakeTimers();
10+
});
11+
12+
afterEach(() => {
13+
jest.clearAllTimers();
14+
jest.useRealTimers();
15+
});
16+
17+
it('support panelRef', () => {
18+
const panelRef = React.createRef<HTMLDivElement>();
19+
20+
render(
21+
<Provider motion={false}>
22+
<Dialog panelRef={panelRef} visible />
23+
</Provider>,
24+
);
25+
26+
expect(panelRef.current).toHaveClass('rc-dialog');
27+
});
28+
});

0 commit comments

Comments
 (0)