Skip to content

Commit e4ba16d

Browse files
committed
test: part of test
1 parent 7d9fa17 commit e4ba16d

1 file changed

Lines changed: 16 additions & 8 deletions

File tree

tests/Select.checkable.spec.tsx

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,8 @@ describe('TreeSelect.checkable', () => {
316316
});
317317

318318
it('check in filter', () => {
319+
jest.useFakeTimers();
320+
319321
const treeData = [
320322
{
321323
key: 'P001',
@@ -344,14 +346,20 @@ describe('TreeSelect.checkable', () => {
344346
],
345347
},
346348
];
347-
const wrapper = mount(<TreeSelect treeCheckable treeData={treeData} open />);
348-
wrapper.search('58');
349-
wrapper.selectNode(2);
350-
expect(wrapper.getSelection()).toHaveLength(1);
351-
352-
wrapper.search('59');
353-
wrapper.selectNode(2);
354-
expect(wrapper.getSelection()).toHaveLength(2);
349+
350+
const { container } = render(<TreeSelect treeCheckable treeData={treeData} open />);
351+
352+
// Search for '58' and select the found node
353+
search(container, '58');
354+
selectNode(2);
355+
expect(container.querySelectorAll('.rc-tree-select-selection-item')).toHaveLength(1);
356+
357+
// Search for '59' and select another node
358+
search(container, '59');
359+
selectNode(2);
360+
expect(container.querySelectorAll('.rc-tree-select-selection-item')).toHaveLength(2);
361+
362+
jest.useRealTimers();
355363
});
356364
});
357365

0 commit comments

Comments
 (0)