diff --git a/components/input/__tests__/Password.test.js b/components/input/__tests__/Password.test.js
index 281beabfd0..29fdafdc83 100644
--- a/components/input/__tests__/Password.test.js
+++ b/components/input/__tests__/Password.test.js
@@ -51,7 +51,7 @@ describe('Input.Password', () => {
});
it('should keep focus state', () => {
- const wrapper = mount();
+ const wrapper = mount(, { 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
diff --git a/components/input/__tests__/index.test.js b/components/input/__tests__/index.test.js
index a4948a7c93..e009ab412c 100644
--- a/components/input/__tests__/index.test.js
+++ b/components/input/__tests__/index.test.js
@@ -51,7 +51,7 @@ describe('Input', () => {
expect(errorSpy).not.toHaveBeenCalled();
});
it('trigger warning', () => {
- const wrapper = mount();
+ const wrapper = mount(, { 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();
+ const wrapper = mount(, { 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();
+ const wrapper = mount(, { 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', () => {