Skip to content

Commit bb5ec95

Browse files
committed
chore: More test case
1 parent 8d7814a commit bb5ec95

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

tests/Select.test.tsx

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1533,17 +1533,20 @@ describe('Select.Basic', () => {
15331533
<Select onChange={onChange}>
15341534
<Option value={1}>1</Option>
15351535
<Option value={null}>No</Option>
1536+
<Option value={0}>0</Option>
1537+
<Option value="">Empty</Option>
15361538
</Select>,
15371539
);
15381540

1539-
toggleOpen(wrapper);
1540-
selectItem(wrapper, 0);
1541-
expect(onChange).toHaveBeenCalledWith(1, expect.anything());
1542-
expect(wrapper.find('.rc-select-selection-item').text()).toEqual('1');
1543-
1544-
toggleOpen(wrapper);
1545-
selectItem(wrapper, 1);
1546-
expect(onChange).toHaveBeenCalledWith(null, expect.anything());
1547-
expect(wrapper.find('.rc-select-selection-item').text()).toEqual('No');
1541+
[[1, '1'], [null, 'No'], [0, '0'], ['', 'Empty']].forEach(
1542+
([value, showValue], index) => {
1543+
toggleOpen(wrapper);
1544+
selectItem(wrapper, index);
1545+
expect(onChange).toHaveBeenCalledWith(value, expect.anything());
1546+
expect(wrapper.find('.rc-select-selection-item').text()).toEqual(
1547+
showValue,
1548+
);
1549+
},
1550+
);
15481551
});
15491552
});

0 commit comments

Comments
 (0)