test: update test case (#42582)

* chore: update snapshot

* chore: update test case

* chore: rm watermark image test
pull/42584/head
MadCcc 2 years ago committed by GitHub
parent b2402f9140
commit 88a00dbf9e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1,12 +1,12 @@
import React from 'react';
import debounce from 'lodash/debounce';
import type { Key } from 'react';
import type RcTree from 'rc-tree';
import type { Key } from 'react';
import React from 'react';
import mountTest from '../../../tests/shared/mountTest';
import rtlTest from '../../../tests/shared/rtlTest';
import { act, fireEvent, render } from '../../../tests/utils';
import Tree from '../index';
import { act, fireEvent, render, waitFakeTimer } from '../../../tests/utils';
import type { TreeProps } from '../index';
import Tree from '../index';
const { DirectoryTree, TreeNode } = Tree;
@ -100,18 +100,18 @@ describe('Directory Tree', () => {
);
};
it('click', () => {
it('click', async () => {
const { container, asFragment } = render(<StateDirTree expandAction="click" />);
fireEvent.click(container.querySelector('.ant-tree-node-content-wrapper')!);
jest.runAllTimers();
await waitFakeTimer();
expect(asFragment().firstChild).toMatchSnapshot();
});
it('doubleClick', () => {
it('doubleClick', async () => {
const { container, asFragment } = render(<StateDirTree expandAction="doubleClick" />);
fireEvent.doubleClick(container.querySelector('.ant-tree-node-content-wrapper')!);
jest.runAllTimers();
await waitFakeTimer();
expect(asFragment().firstChild).toMatchSnapshot();
});
});
@ -151,10 +151,10 @@ describe('Directory Tree', () => {
expect(asFragment().firstChild).toMatchSnapshot();
});
it('expandedKeys update', () => {
it('expandedKeys update', async () => {
const { rerender, asFragment } = render(createTree());
rerender(createTree({ expandedKeys: ['0-1'] }));
jest.runAllTimers();
await waitFakeTimer();
expect(asFragment().firstChild).toMatchSnapshot();
});

@ -1,5 +0,0 @@
import { imageDemoTest } from '../../../tests/shared/imageTest';
describe('Watermark image', () => {
imageDemoTest('watermark');
});

@ -149,7 +149,7 @@
"rc-tabs": "~12.6.0",
"rc-textarea": "~1.2.2",
"rc-tooltip": "~6.0.0",
"rc-tree": "~5.7.0",
"rc-tree": "~5.7.4",
"rc-tree-select": "~5.9.0",
"rc-upload": "~4.3.0",
"rc-util": "^5.27.0",

Loading…
Cancel
Save