From 278bcea29576e8fdd72b9ef399231e7c0bdba40c Mon Sep 17 00:00:00 2001 From: Circkoooooo <2389451262@qq.com> Date: Thu, 20 Jul 2023 20:28:10 +0800 Subject: [PATCH] feat(select): allows select the behavior of triggering blur event in tags mode. --- docs/examples/tags.tsx | 1 + src/Select.tsx | 27 +++++++++++++++++++-------- tests/Tags.test.tsx | 14 ++++++++++++++ 3 files changed, 34 insertions(+), 8 deletions(-) diff --git a/docs/examples/tags.tsx b/docs/examples/tags.tsx index bfc62cbe2..cd63f2efe 100644 --- a/docs/examples/tags.tsx +++ b/docs/examples/tags.tsx @@ -39,6 +39,7 @@ const Test: React.FC = () => { ); + + wrapper + .find('input') + .simulate('change', { target: { value: 'foo' } }) + .simulate('blur'); + + jest.runAllTimers(); + expect(findSelection(wrapper).text()).toBe(""); + expect(onChange).toHaveBeenCalledWith([''], [{}]); + }); + it('tokenize input', () => { const handleChange = jest.fn(); const handleSelect = jest.fn();