Skip to content

Commit

Permalink
chore: ++
Browse files Browse the repository at this point in the history
  • Loading branch information
kungege committed Dec 15, 2023
1 parent 43c7972 commit cdbcf18
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions tests/form/loginForm.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
WeiboCircleOutlined,
} from '@ant-design/icons';
import { LoginForm, LoginFormPage, ProFormText } from '@ant-design/pro-form';
import { act, cleanup, render } from '@testing-library/react';
import { cleanup, render, waitFor } from '@testing-library/react';
import { Alert, Space } from 'antd';
import { waitForWaitTime } from '../util';

Expand Down Expand Up @@ -135,14 +135,11 @@ describe('LoginForm', () => {
</LoginForm>,
);

await waitForWaitTime(100);
const dom = await wrapper.findByText('登 录');
waitFor(async () => {
(await wrapper.findByText('登 录')).click();

act(() => {
dom.click();
expect(fn).toHaveBeenCalled();
});

expect(fn).toBeCalled();
});

it('📦 LoginFormPage support log', async () => {
Expand Down Expand Up @@ -194,13 +191,14 @@ describe('LoginForm', () => {
</LoginForm>,
);

await waitForWaitTime(100);
let dom = await wrapper.baseElement.querySelector('.ant-btn-loading');
waitFor(() => {
let dom = wrapper.baseElement.querySelector('.ant-btn-loading');

expect(!!dom).toBeTruthy();
expect(!!dom).toBeTruthy();

dom = await wrapper.baseElement.querySelector('.ant-btn-lg');
dom = wrapper.baseElement.querySelector('.ant-btn-lg');

expect(!!dom).toBeTruthy();
expect(!!dom).toBeTruthy();
});
});
});

0 comments on commit cdbcf18

Please sign in to comment.