test: add boolean value input test (#34324)

This commit is contained in:
MadCcc 2022-03-07 13:09:07 +08:00 committed by GitHub
parent 0acb9901ea
commit 8d7f137a09
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 0 deletions

View File

@ -373,4 +373,11 @@ describe('Input allowClear', () => {
const wrapper = mount(<Input suffix="Bamboo" value={1} />);
expect(wrapper).toBeTruthy();
});
it('should display boolean value as string', () => {
const wrapper = mount(<Input value />);
expect(wrapper.find('input').first().getDOMNode().value).toBe('true');
wrapper.setProps({ value: false });
expect(wrapper.find('input').first().getDOMNode().value).toBe('false');
});
});

View File

@ -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(<TextArea value />);
expect(wrapper.find('textarea').first().getDOMNode().value).toBe('true');
wrapper.setProps({ value: false });
expect(wrapper.find('textarea').first().getDOMNode().value).toBe('false');
});
});