2
0
mirror of https://github.com/tenrok/vue-select.git synced 2026-05-17 02:29:37 +03:00
Files
vue-select/tests/unit/CreateOption.spec.js
T
Jeff Sagal 98c278b2bb build(vite): replace webpack with Vite, add Typescript (#1594)
BREAKING: mixins are no longer exported from the index (and will likely be converted to hooks)
2022-07-18 09:33:46 -07:00

32 lines
884 B
JavaScript

import { it, describe, expect } from 'vitest'
import { selectTag, selectWithProps } from '@tests/helpers.js'
describe('CreateOption When Tagging Is Enabled', () => {
it('can select the current search text as a string', async () => {
const Select = selectWithProps({
taggable: true,
multiple: true,
options: ['one', 'two'],
createOption: (option) => 'four',
})
await selectTag(Select, 'three')
expect(Select.vm.selectedValue).toEqual(['four'])
})
it('can select the current search text as an object', async () => {
const Select = selectWithProps({
taggable: true,
multiple: false,
value: null,
options: [],
label: 'name',
createOption: (title) => ({ name: title }),
})
await selectTag(Select, 'two')
expect(Select.emitted('update:modelValue')[0]).toEqual([{ name: 'two' }])
})
})