mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-25 11:40:04 +08:00
✅ some tests should run when mount to document.body
This commit is contained in:
parent
6b01785f96
commit
25d2f1b3e2
@ -51,7 +51,7 @@ describe('Input.Password', () => {
|
||||
});
|
||||
|
||||
it('should keep focus state', () => {
|
||||
const wrapper = mount(<Input.Password defaultValue="111" autoFocus />);
|
||||
const wrapper = mount(<Input.Password defaultValue="111" autoFocus />, { attachTo: document.body });
|
||||
expect(document.activeElement).toBe(
|
||||
wrapper
|
||||
.find('input')
|
||||
@ -72,6 +72,7 @@ describe('Input.Password', () => {
|
||||
.at(0)
|
||||
.getDOMNode(),
|
||||
);
|
||||
wrapper.unmount();
|
||||
});
|
||||
|
||||
// https://github.com/ant-design/ant-design/issues/20541
|
||||
|
@ -51,7 +51,7 @@ describe('Input', () => {
|
||||
expect(errorSpy).not.toHaveBeenCalled();
|
||||
});
|
||||
it('trigger warning', () => {
|
||||
const wrapper = mount(<Input />);
|
||||
const wrapper = mount(<Input />, { attachTo: document.body });
|
||||
wrapper
|
||||
.find('input')
|
||||
.instance()
|
||||
@ -62,6 +62,7 @@ describe('Input', () => {
|
||||
expect(errorSpy).toHaveBeenCalledWith(
|
||||
'Warning: [antd: Input] When Input is focused, dynamic add or remove prefix / suffix will make it lose focus caused by dom structure change. Read more: https://ant.design/components/input/#FAQ',
|
||||
);
|
||||
wrapper.unmount();
|
||||
});
|
||||
});
|
||||
});
|
||||
@ -327,7 +328,7 @@ describe('Input allowClear', () => {
|
||||
});
|
||||
|
||||
it('should focus input after clear', () => {
|
||||
const wrapper = mount(<Input allowClear defaultValue="111" />);
|
||||
const wrapper = mount(<Input allowClear defaultValue="111" />, { attachTo: document.body });
|
||||
wrapper
|
||||
.find('.ant-input-clear-icon')
|
||||
.at(0)
|
||||
@ -338,6 +339,7 @@ describe('Input allowClear', () => {
|
||||
.at(0)
|
||||
.getDOMNode(),
|
||||
);
|
||||
wrapper.unmount();
|
||||
});
|
||||
|
||||
it('should not support allowClear when it is disabled', () => {
|
||||
@ -425,7 +427,7 @@ describe('TextArea allowClear', () => {
|
||||
});
|
||||
|
||||
it('should focus textarea after clear', () => {
|
||||
const wrapper = mount(<TextArea allowClear defaultValue="111" />);
|
||||
const wrapper = mount(<TextArea allowClear defaultValue="111" />, { attachTo: document.body });
|
||||
wrapper
|
||||
.find('.ant-input-textarea-clear-icon')
|
||||
.at(0)
|
||||
@ -436,6 +438,7 @@ describe('TextArea allowClear', () => {
|
||||
.at(0)
|
||||
.getDOMNode(),
|
||||
);
|
||||
wrapper.unmount();
|
||||
});
|
||||
|
||||
it('should not support allowClear when it is disabled', () => {
|
||||
|
Loading…
Reference in New Issue
Block a user