Skip to content

Commit

Permalink
chore: add test case
Browse files Browse the repository at this point in the history
  • Loading branch information
Yuiai01 committed Apr 26, 2023
1 parent 8b6fc58 commit ad34721
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions components/transfer/__tests__/index.test.tsx
Expand Up @@ -73,6 +73,19 @@ const searchTransferProps = {
targetKeys: ['3', '4'],
};

const generateData = (n = 20) => {
const data = [];
for (let i = 0; i < n; i++) {
data.push({
key: `${i}`,
title: `content${i}`,
description: `description of content${i}`,
chosen: false,
});
}
return data;
};

describe('Transfer', () => {
mountTest(Transfer);
rtlTest(Transfer);
Expand Down Expand Up @@ -571,6 +584,17 @@ describe('Transfer', () => {
);
await waitFor(() => expect(getAllByTitle('1/1')).toHaveLength(2));
});

it('should support change pageSize', () => {
const dataSource = generateData();
const { container } = render(
<Transfer dataSource={dataSource} pagination={{ showSizeChanger: true, simple: false }} />,
);

fireEvent.mouseDown(container.querySelector('.ant-select-selector')!);
fireEvent.click(container.querySelectorAll('.ant-select-item-option')[1]);
expect(container.querySelectorAll('.ant-transfer-list-content-item').length).toBe(20);
});
});

it('remove by click icon', () => {
Expand Down

0 comments on commit ad34721

Please sign in to comment.