chore: 更新 nav 单测延迟的判断逻辑 (#6149)

This commit is contained in:
meerkat 2023-02-09 10:07:56 +08:00 committed by GitHub
parent 715b922564
commit dc2b670708
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -10,7 +10,7 @@
* 7.
*/
import {render, cleanup, fireEvent} from '@testing-library/react';
import {render, cleanup, fireEvent, waitFor} from '@testing-library/react';
import '../../src';
import {render as amisRender} from '../../src';
import {makeEnv, wait} from '../helper';
@ -277,7 +277,9 @@ test('Renderer:Nav with overflow', async () => {
fireEvent.click(btn!);
await wait(200);
await waitFor(() =>
expect(container.querySelector('.cxd-Spinner')).not.toBeInTheDocument()
);
expect(container).toMatchSnapshot();
});
@ -509,7 +511,9 @@ test('Renderer:Nav with itemActions', async () => {
container.querySelector('.cxd-Nav-Menu-item-extra .cxd-Button')!
);
await wait(200);
await waitFor(() =>
expect(container.querySelector('.cxd-Spinner')).not.toBeInTheDocument()
);
expect(container).toMatchSnapshot();
expect(getByText('编辑')).toBeInTheDocument();
});