From 8d7f137a09d2d463360db0ca0c8abc52f94f77af Mon Sep 17 00:00:00 2001
From: MadCcc <1075746765@qq.com>
Date: Mon, 7 Mar 2022 13:09:07 +0800
Subject: [PATCH] test: add boolean value input test (#34324)
---
components/input/__tests__/index.test.js | 7 +++++++
components/input/__tests__/textarea.test.js | 7 +++++++
2 files changed, 14 insertions(+)
diff --git a/components/input/__tests__/index.test.js b/components/input/__tests__/index.test.js
index 42f33c240d..2e661fb892 100644
--- a/components/input/__tests__/index.test.js
+++ b/components/input/__tests__/index.test.js
@@ -373,4 +373,11 @@ describe('Input allowClear', () => {
const wrapper = mount();
expect(wrapper).toBeTruthy();
});
+
+ it('should display boolean value as string', () => {
+ const wrapper = mount();
+ expect(wrapper.find('input').first().getDOMNode().value).toBe('true');
+ wrapper.setProps({ value: false });
+ expect(wrapper.find('input').first().getDOMNode().value).toBe('false');
+ });
});
diff --git a/components/input/__tests__/textarea.test.js b/components/input/__tests__/textarea.test.js
index 320d29f872..f2867a2702 100644
--- a/components/input/__tests__/textarea.test.js
+++ b/components/input/__tests__/textarea.test.js
@@ -509,4 +509,11 @@ describe('TextArea allowClear', () => {
expect(document.activeElement).toBe(wrapper.find('textarea').at(0).getDOMNode());
wrapper.unmount();
});
+
+ it('should display boolean value as string', () => {
+ const wrapper = mount();
+ expect(wrapper.find('textarea').first().getDOMNode().value).toBe('true');
+ wrapper.setProps({ value: false });
+ expect(wrapper.find('textarea').first().getDOMNode().value).toBe('false');
+ });
});