Skip to content

Commit 2b1a5e6

Browse files
committed
feat: test
1 parent 300be98 commit 2b1a5e6

1 file changed

Lines changed: 5 additions & 8 deletions

File tree

tests/Expanded.spec.tsx

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import React from 'react';
22
import { spyElementPrototypes } from 'rc-util/lib/test/domHook';
3-
import { render, act } from '@testing-library/react';
3+
import { render } from '@testing-library/react';
4+
import { safeAct } from './utils';
45
import Table, { type ColumnsType } from '../src';
56

67
describe('Table.Expanded', () => {
@@ -40,7 +41,7 @@ describe('Table.Expanded', () => {
4041
{ title: 'c', dataIndex: 'c' },
4142
];
4243
const data = [{ a: 'a' }];
43-
const { container } = render(
44+
const wrapper = render(
4445
<Table<Record<string, any>>
4546
columns={columns}
4647
data={data}
@@ -51,13 +52,9 @@ describe('Table.Expanded', () => {
5152
}}
5253
/>,
5354
);
54-
console.log('container', container);
55-
await act(async () => {
56-
vi.runAllTimers();
57-
await Promise.resolve();
58-
});
55+
await safeAct(wrapper);
5956

60-
const expandDom = container.querySelector('.rc-table-expanded-row-fixed');
57+
const expandDom = wrapper.container.querySelector('.rc-table-expanded-row-fixed');
6158
console.log('expandDom', expandDom);
6259
const trDom = expandDom.parentElement;
6360
expect(trDom.getAttribute('colspan')).toBe('2');

0 commit comments

Comments
 (0)