Skip to content

Commit

Permalink
test: add boolean value input test
Browse files Browse the repository at this point in the history
  • Loading branch information
MadCcc committed Mar 7, 2022
1 parent 6ab61e4 commit e9a471e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
7 changes: 7 additions & 0 deletions components/input/__tests__/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
});
});
7 changes: 7 additions & 0 deletions components/input/__tests__/textarea.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
});
});

0 comments on commit e9a471e

Please sign in to comment.