修改用例写法

This commit is contained in:
liaoxuezhi 2022-04-12 23:35:25 +08:00
parent 66f8d33e2e
commit 7340576d67

View File

@ -1,5 +1,5 @@
import React = require('react');
import {render, fireEvent} from '@testing-library/react';
import {render, fireEvent, waitFor} from '@testing-library/react';
import '../../../src/themes/default';
import {render as amisRender} from '../../../src/index';
import {makeEnv, wait} from '../../helper';
@ -27,8 +27,11 @@ test('Renderer:city', async () => {
)
);
// 第一个用 findByText 来等待 suspense 组件加载出来后面的一般来说就不需要await的除非是耗时操作
fireEvent.click(await findByText('请选择'));
await waitFor(() => {
getByText('请选择');
});
fireEvent.click(getByText('请选择'));
fireEvent.click(getByText('北京市'));
fireEvent.click(getByText('请选择'));
fireEvent.click(getByText('北京市市辖区'));