mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-27 12:39:49 +08:00
test(transfer): add test case
This commit is contained in:
parent
71a796831c
commit
1512ddd1b2
@ -663,6 +663,17 @@ describe('Transfer', () => {
|
||||
expect(getByText('1 of 2')).toBeTruthy();
|
||||
});
|
||||
|
||||
it('should disable transfer operation button when some items are set to selected but also disabled', () => {
|
||||
const dataSource = listDisabledProps.dataSource.map((d) => ({
|
||||
...d,
|
||||
disabled: true,
|
||||
}));
|
||||
const { container } = render(<Transfer {...listDisabledProps} dataSource={dataSource} />);
|
||||
expect(
|
||||
container.querySelectorAll<HTMLDivElement>('.ant-transfer-operation button').item(0),
|
||||
).toBeDisabled();
|
||||
});
|
||||
|
||||
describe('pagination', () => {
|
||||
it('boolean', async () => {
|
||||
const { getByTitle } = render(<Transfer {...listDisabledProps} pagination />);
|
||||
|
@ -66,6 +66,23 @@ describe('Transfer.List', () => {
|
||||
);
|
||||
});
|
||||
|
||||
it('should disabled all select checkbox when each item of dataSource is disabled', () => {
|
||||
const allDisabledListProps: TransferListProps<KeyWiseTransferItem> = {
|
||||
...listCommonProps,
|
||||
dataSource: listCommonProps.dataSource.map((d) => ({
|
||||
...d,
|
||||
disabled: true,
|
||||
})),
|
||||
};
|
||||
const { container } = render(<List {...allDisabledListProps} />);
|
||||
expect(container.querySelector<HTMLLabelElement>('label.ant-checkbox-wrapper')).toHaveClass(
|
||||
'ant-checkbox-wrapper-disabled',
|
||||
);
|
||||
expect(container.querySelector<HTMLSpanElement>('span.ant-checkbox')).toHaveClass(
|
||||
'ant-checkbox-disabled',
|
||||
);
|
||||
});
|
||||
|
||||
it('support custom dropdown Icon', () => {
|
||||
const { container } = render(
|
||||
<List
|
||||
|
Loading…
Reference in New Issue
Block a user