Skip to content

Commit cd59d26

Browse files
committed
feat: test
1 parent 2b1a5e6 commit cd59d26

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

tests/Expanded.spec.tsx

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

76
describe('Table.Expanded', () => {
@@ -41,7 +40,7 @@ describe('Table.Expanded', () => {
4140
{ title: 'c', dataIndex: 'c' },
4241
];
4342
const data = [{ a: 'a' }];
44-
const wrapper = render(
43+
const { container } = render(
4544
<Table<Record<string, any>>
4645
columns={columns}
4746
data={data}
@@ -52,9 +51,14 @@ describe('Table.Expanded', () => {
5251
}}
5352
/>,
5453
);
55-
await safeAct(wrapper);
54+
console.log('container', container);
55+
await act(async () => {
56+
vi.runAllTimers();
57+
await Promise.resolve();
58+
});
59+
console.log('rc-table-body', container.querySelector('.rc-table-body'));
5660

57-
const expandDom = wrapper.container.querySelector('.rc-table-expanded-row-fixed');
61+
const expandDom = container.querySelector('.rc-table-expanded-row-fixed');
5862
console.log('expandDom', expandDom);
5963
const trDom = expandDom.parentElement;
6064
expect(trDom.getAttribute('colspan')).toBe('2');

0 commit comments

Comments
 (0)