|
|
@ -3,7 +3,7 @@ import type { TableProps } from '..'; |
|
|
|
import Table from '..'; |
|
|
|
import mountTest from '../../../tests/shared/mountTest'; |
|
|
|
import rtlTest from '../../../tests/shared/rtlTest'; |
|
|
|
import { fireEvent, render, sleep } from '../../../tests/utils'; |
|
|
|
import { fireEvent, render, waitFakeTimer } from '../../../tests/utils'; |
|
|
|
|
|
|
|
const { Column, ColumnGroup } = Table; |
|
|
|
|
|
|
@ -70,6 +70,7 @@ describe('Table', () => { |
|
|
|
}); |
|
|
|
|
|
|
|
it('loading with Spin', async () => { |
|
|
|
jest.useFakeTimers(); |
|
|
|
const loading = { |
|
|
|
spinning: false, |
|
|
|
delay: 500, |
|
|
@ -81,19 +82,24 @@ describe('Table', () => { |
|
|
|
loading.spinning = true; |
|
|
|
rerender(<Table loading={loading} />); |
|
|
|
expect(container.querySelectorAll('.ant-spin')).toHaveLength(0); |
|
|
|
await sleep(500); |
|
|
|
await waitFakeTimer(); |
|
|
|
rerender(<Table loading />); |
|
|
|
expect(container.querySelectorAll('.ant-spin')).toHaveLength(1); |
|
|
|
jest.clearAllTimers(); |
|
|
|
jest.useRealTimers(); |
|
|
|
}); |
|
|
|
|
|
|
|
// https://github.com/ant-design/ant-design/issues/22733
|
|
|
|
it('support loading tip', async () => { |
|
|
|
jest.useFakeTimers(); |
|
|
|
const { container, rerender } = render(<Table loading={{ tip: 'loading...' }} />); |
|
|
|
await sleep(500); |
|
|
|
await waitFakeTimer(); |
|
|
|
rerender( |
|
|
|
<Table loading={{ tip: 'loading...', loading: true } as TableProps<any>['loading']} />, |
|
|
|
); |
|
|
|
expect(container.querySelectorAll('.ant-spin')).toHaveLength(1); |
|
|
|
jest.clearAllTimers(); |
|
|
|
jest.useRealTimers(); |
|
|
|
}); |
|
|
|
|
|
|
|
it('props#columnsPageRange and props#columnsPageSize do not warn anymore', () => { |
|
|
|