mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-12-02 12:09:14 +08:00
test: add test cases for Space.Compact context (#38929)
This commit is contained in:
parent
8d2d18c7f3
commit
a7ee3364eb
@ -12,6 +12,9 @@ import DatePicker from '../../date-picker';
|
||||
import Select from '../../select';
|
||||
import TimePicker from '../../time-picker';
|
||||
import TreeSelect from '../../tree-select';
|
||||
import Modal from '../../modal';
|
||||
import Dropdown from '../../dropdown';
|
||||
import Drawer from '../../drawer';
|
||||
|
||||
describe('Space.Compact', () => {
|
||||
mountTest(Space.Compact);
|
||||
@ -182,4 +185,66 @@ describe('Space.Compact', () => {
|
||||
?.classList.contains('ant-btn-compact-vertical-last-item'),
|
||||
).toBe(true);
|
||||
});
|
||||
it('context for Modal', () => {
|
||||
render(
|
||||
<Space.Compact size="small">
|
||||
<Modal title="Basic Modal" open>
|
||||
<Button>normal button A</Button>
|
||||
<Input />
|
||||
</Modal>
|
||||
</Space.Compact>,
|
||||
);
|
||||
expect(
|
||||
document.body
|
||||
.querySelectorAll('.ant-modal')[0]
|
||||
.querySelector('.ant-btn')
|
||||
?.classList.contains('ant-btn-compact-item'),
|
||||
).toBe(false);
|
||||
expect(
|
||||
document.body
|
||||
.querySelectorAll('.ant-modal')[0]
|
||||
.querySelector('.ant-input')
|
||||
?.classList.contains('ant-input-compact-item'),
|
||||
).toBe(false);
|
||||
});
|
||||
it('context for Dropdown', () => {
|
||||
render(
|
||||
<Space.Compact size="small">
|
||||
<Dropdown.Button
|
||||
open
|
||||
menu={{
|
||||
items: [
|
||||
{
|
||||
key: '1',
|
||||
label: <Button>menu button</Button>,
|
||||
},
|
||||
],
|
||||
}}
|
||||
>
|
||||
debug Dropdown.Button context
|
||||
</Dropdown.Button>
|
||||
</Space.Compact>,
|
||||
);
|
||||
expect(
|
||||
document.body
|
||||
.querySelector('.ant-dropdown')
|
||||
?.querySelector('.ant-btn')
|
||||
?.classList.contains('ant-btn-compact-item'),
|
||||
).toBe(false);
|
||||
});
|
||||
it('context for Drawer', () => {
|
||||
render(
|
||||
<Space.Compact size="small">
|
||||
<Drawer title="Basic Drawer" open>
|
||||
<Button>normal button A</Button>
|
||||
</Drawer>
|
||||
</Space.Compact>,
|
||||
);
|
||||
expect(
|
||||
document.body
|
||||
.querySelector('.ant-drawer')
|
||||
?.querySelector('.ant-btn')
|
||||
?.classList.contains('ant-btn-compact-item'),
|
||||
).toBe(false);
|
||||
});
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user