Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/Selector/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -189,9 +189,8 @@ const Selector: React.RefForwardingComponent<RefSelectorProps, SelectorProps> =
pasteClearRef.current = true;
setTimeout(() => {
pasteClearRef.current = false;
triggerOnSearch(value);
});

triggerOnSearch(value);
};

// ====================== Focus ======================
Expand Down
15 changes: 12 additions & 3 deletions tests/Tags.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,8 @@ describe('Select.Tags', () => {
expectOpen(wrapper, false);
});

it('paste content to split', () => {
it('paste content to split after 100ms', done => {
jest.useFakeTimers();
const onChange = jest.fn();
const wrapper = mount(
<Select mode="tags" tokenSeparators={[' ', '\n']} onChange={onChange}>
Expand All @@ -160,8 +161,16 @@ describe('Select.Tags', () => {
target: { value: ' light bamboo ' },
});

expect(onChange).toHaveBeenCalledWith(['light', 'bamboo'], expect.anything());
expect(onChange).toHaveBeenCalledTimes(1);
setTimeout(() => {
try {
expect(onChange).toHaveBeenCalledWith(['light', 'bamboo'], expect.anything());
expect(onChange).toHaveBeenCalledTimes(1);
done();
} catch (err) {
done.fail(err);
}
}, 100);
jest.runTimersToTime(100);
});

it('renders unlisted item in value', () => {
Expand Down