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
24 changes: 24 additions & 0 deletions components/select/__tests__/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -177,4 +177,28 @@ describe('Select', () => {
expect(wrapper.html()).toMatchSnapshot();
});
});

describe('Select tags mode', () => {
it('Automatic word segmentation mode supports pasting.', async () => {
const wrapper = mount(Select, {
props: { mode: 'tags', tokenSeparators: [','] },
sync: false,
});

await asyncExpect(async () => {
const inputEl = wrapper.find('.ant-select-selection-search-input');

await inputEl.trigger('paste', {
clipboardData: {
getData: () => '1,2,3',
},
});
await inputEl.setValue('1,2,3');

expect(inputEl.element.value).toBe('');
const tagsElements = wrapper.findAll('.ant-select-selection-item');
expect(tagsElements.length).toBe(3);
}, 100);
});
});
});
6 changes: 5 additions & 1 deletion components/vc-select/Selector/MultipleSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -209,10 +209,14 @@ const SelectSelector = defineComponent<SelectorProps>({

const handleInput = (e: Event) => {
const composing = (e.target as any).composing;
targetValue.value = (e.target as any).value;

if (!composing) {
props.onInputChange(e);
}

// if inputValue is not change
targetValue.value = inputValue.value;
(e.target as any).value = inputValue.value;
};

return () => {
Expand Down
Loading