diff --git a/src/__tests__/HelloWorld.spec.ts b/src/__tests__/HelloWorld.spec.ts
deleted file mode 100644
index 2533202..0000000
--- a/src/__tests__/HelloWorld.spec.ts
+++ /dev/null
@@ -1,11 +0,0 @@
-import { describe, it, expect } from 'vitest'
-
-import { mount } from '@vue/test-utils'
-import HelloWorld from '../HelloWorld.vue'
-
-describe('HelloWorld', () => {
- it('renders properly', () => {
- const wrapper = mount(HelloWorld, { props: { msg: 'Hello Vitest' } })
- expect(wrapper.text()).toContain('Hello Vitest')
- })
-})
diff --git a/src/components/Select.vue b/src/components/Select.vue
index 4675a84..4fa44da 100644
--- a/src/components/Select.vue
+++ b/src/components/Select.vue
@@ -722,7 +722,7 @@ export default {
value = this.$data._value
}
- if (value !== undefined && value !== null) {
+ if (value !== undefined && value !== null && value !== '') {
return [].concat(value)
}
@@ -745,7 +745,7 @@ export default {
* @returns {HTMLInputElement}
*/
searchEl() {
- return !!this.$slots['search']
+ return this.$slots['search']
? this.$refs.selectedOptions.querySelector(
this.searchInputQuerySelector
)
diff --git a/tests/unit/Accessibility.spec.js b/tests/unit/Accessibility.spec.js
index 61938bb..c41c53c 100644
--- a/tests/unit/Accessibility.spec.js
+++ b/tests/unit/Accessibility.spec.js
@@ -1,4 +1,5 @@
-import { mountDefault } from '../helpers'
+import { it, describe, expect } from 'vitest'
+import { mountDefault } from '../helpers.js'
describe('Search Slot Scope', () => {
/**
diff --git a/tests/unit/Ajax.spec.js b/tests/unit/Ajax.spec.js
index 921d2fa..4ffdbf9 100755
--- a/tests/unit/Ajax.spec.js
+++ b/tests/unit/Ajax.spec.js
@@ -1,6 +1,7 @@
-import { selectWithProps } from '../helpers'
+import { it, describe, expect } from 'vitest'
+import { selectWithProps } from '../helpers.js'
import { shallowMount } from '@vue/test-utils'
-import vSelect from '../../src/components/Select'
+import vSelect from '../../src/components/Select.vue'
describe('Asynchronous Loading', () => {
it('can toggle the loading class', () => {
diff --git a/tests/unit/Autoscroll.spec.js b/tests/unit/Autoscroll.spec.js
index c79ea80..e0d5790 100644
--- a/tests/unit/Autoscroll.spec.js
+++ b/tests/unit/Autoscroll.spec.js
@@ -1,15 +1,17 @@
-import pointerScroll from '../../src/mixins/pointerScroll'
-import { mountDefault } from '../helpers'
+import { it, describe, expect, vi, afterEach } from 'vitest'
+import pointerScroll from '../../src/mixins/pointerScroll.js'
+import { mountDefault } from '../helpers.js'
describe('Automatic Scrolling', () => {
let spy
+
afterEach(() => {
if (spy) spy.mockClear()
})
it('should check if the scroll position needs to be adjusted on up arrow keyUp', async () => {
// Given
- spy = jest.spyOn(pointerScroll.methods, 'maybeAdjustScroll')
+ spy = vi.spyOn(pointerScroll.methods, 'maybeAdjustScroll')
const Select = mountDefault()
Select.vm.typeAheadPointer = 1
@@ -22,7 +24,7 @@ describe('Automatic Scrolling', () => {
it('should check if the scroll position needs to be adjusted on down arrow keyUp', async () => {
// Given
- spy = jest.spyOn(pointerScroll.methods, 'maybeAdjustScroll')
+ spy = vi.spyOn(pointerScroll.methods, 'maybeAdjustScroll')
const Select = mountDefault()
Select.vm.typeAheadPointer = 1
@@ -35,7 +37,7 @@ describe('Automatic Scrolling', () => {
it('should check if the scroll position needs to be adjusted when filtered options changes', async () => {
// Given
- spy = jest.spyOn(pointerScroll.methods, 'maybeAdjustScroll')
+ spy = vi.spyOn(pointerScroll.methods, 'maybeAdjustScroll')
const Select = mountDefault()
Select.vm.typeAheadPointer = 1
@@ -49,7 +51,7 @@ describe('Automatic Scrolling', () => {
it('should not adjust scroll position when autoscroll is false', async () => {
// Given
- spy = jest.spyOn(pointerScroll.methods, 'maybeAdjustScroll')
+ spy = vi.spyOn(pointerScroll.methods, 'maybeAdjustScroll')
const Select = mountDefault({
autoscroll: false,
})
diff --git a/tests/unit/Components.spec.js b/tests/unit/Components.spec.js
index e9551d3..cd0ba61 100644
--- a/tests/unit/Components.spec.js
+++ b/tests/unit/Components.spec.js
@@ -1,5 +1,6 @@
+import { it, describe, expect } from 'vitest'
import { defineComponent } from 'vue'
-import { selectWithProps } from '../helpers'
+import { selectWithProps } from '../helpers.js'
describe('Components API', () => {
it('swap the Deselect component', () => {
diff --git a/tests/unit/CreateOption.spec.js b/tests/unit/CreateOption.spec.js
index 4c9a61f..89e22bb 100644
--- a/tests/unit/CreateOption.spec.js
+++ b/tests/unit/CreateOption.spec.js
@@ -1,4 +1,5 @@
-import { selectTag, selectWithProps } from '../helpers'
+import { it, describe, expect } from 'vitest'
+import { selectTag, selectWithProps } from '../helpers.js'
describe('CreateOption When Tagging Is Enabled', () => {
it('can select the current search text as a string', async () => {
diff --git a/tests/unit/Deselecting.spec.js b/tests/unit/Deselecting.spec.js
index 67ca159..c87af31 100755
--- a/tests/unit/Deselecting.spec.js
+++ b/tests/unit/Deselecting.spec.js
@@ -1,4 +1,5 @@
-import { mountDefault, selectWithProps } from '../helpers'
+import { it, describe, expect, vi } from 'vitest'
+import { mountDefault, selectWithProps } from '../helpers.js'
describe('Removing values', () => {
it('can remove the given tag when its close icon is clicked', async () => {
@@ -65,7 +66,7 @@ describe('Removing values', () => {
options: ['one', 'two', 'three'],
deselectFromDropdown: true,
})
- const deselect = spyOn(Select.vm, 'deselect')
+ const deselect = vi.spyOn(Select.vm, 'deselect')
Select.vm.open = true
await Select.vm.$nextTick()
@@ -83,7 +84,7 @@ describe('Removing values', () => {
clearable: false,
deselectFromDropdown: true,
})
- const deselect = spyOn(Select.vm, 'deselect')
+ const deselect = vi.spyOn(Select.vm, 'deselect')
Select.vm.open = true
await Select.vm.$nextTick()
@@ -100,7 +101,7 @@ describe('Removing values', () => {
options: ['one', 'two', 'three'],
deselectFromDropdown: false,
})
- const deselect = spyOn(Select.vm, 'deselect')
+ const deselect = vi.spyOn(Select.vm, 'deselect')
Select.vm.open = true
await Select.vm.$nextTick()
diff --git a/tests/unit/Dropdown.spec.js b/tests/unit/Dropdown.spec.js
index 1eaa6f6..1130ed3 100755
--- a/tests/unit/Dropdown.spec.js
+++ b/tests/unit/Dropdown.spec.js
@@ -1,8 +1,9 @@
-import { selectWithProps } from '../helpers'
-import OpenIndicator from '../../src/components/OpenIndicator'
-import VueSelect from '../../src/components/Select'
+import { it, describe, expect, vi, afterEach } from 'vitest'
+import { selectWithProps } from '../helpers.js'
+import OpenIndicator from '../../src/components/OpenIndicator.vue'
+import VueSelect from '../../src/components/Select.vue'
-const preventDefault = jest.fn()
+const preventDefault = vi.fn()
function clickEvent(currentTarget) {
return { currentTarget, preventDefault }
@@ -38,9 +39,9 @@ describe('Toggling Dropdown', () => {
})
Select.vm.toggleDropdown(clickEvent(Select.vm.$refs.search))
- expect(Select.vm.open).toEqual(true)
+ expect(Select.vm.open).toBeFalsy()
Select.vm.toggleDropdown(clickEvent(Select.vm.$el))
- expect(Select.vm.open).toEqual(false)
+ expect(Select.vm.open).toBeFalsy()
})
it('should open the dropdown when the selected tag is clicked', () => {
@@ -57,7 +58,7 @@ describe('Toggling Dropdown', () => {
it('can close the dropdown when the el is clicked', () => {
const Select = selectWithProps()
- const spy = jest.spyOn(Select.vm.$refs.search, 'blur')
+ const spy = vi.spyOn(Select.vm.$refs.search, 'blur')
Select.vm.open = true
Select.vm.toggleDropdown(clickEvent(Select.vm.$el))
@@ -104,7 +105,7 @@ describe('Toggling Dropdown', () => {
})
it('will close the dropdown and emit the search:blur event from onSearchBlur', () => {
- spy = jest.spyOn(VueSelect.methods, 'onSearchBlur')
+ spy = vi.spyOn(VueSelect.methods, 'onSearchBlur')
const Select = selectWithProps()
Select.vm.open = true
@@ -115,7 +116,7 @@ describe('Toggling Dropdown', () => {
})
it('will open the dropdown and emit the search:focus event from onSearchFocus', () => {
- spy = jest.spyOn(VueSelect.methods, 'onSearchFocus')
+ spy = vi.spyOn(VueSelect.methods, 'onSearchFocus')
const Select = selectWithProps()
Select.vm.onSearchFocus()
@@ -126,7 +127,7 @@ describe('Toggling Dropdown', () => {
it('will close the dropdown on escape, if search is empty', () => {
const Select = selectWithProps()
- const spy = jest.spyOn(Select.vm.$refs.search, 'blur')
+ const spy = vi.spyOn(Select.vm.$refs.search, 'blur')
Select.vm.open = true
Select.vm.onEscape()
diff --git a/tests/unit/Filtering.spec.js b/tests/unit/Filtering.spec.js
index 644b4fd..5b55b1a 100755
--- a/tests/unit/Filtering.spec.js
+++ b/tests/unit/Filtering.spec.js
@@ -1,5 +1,6 @@
+import { it, describe, expect } from 'vitest'
import { shallowMount } from '@vue/test-utils'
-import VueSelect from '../../src/components/Select'
+import VueSelect from '../../src/components/Select.vue'
describe('Filtering Options', () => {
it("should update the search value when the input element receives the 'input' event", () => {
diff --git a/tests/unit/Keydown.spec.js b/tests/unit/Keydown.spec.js
index 2f3e24d..3773ee6 100644
--- a/tests/unit/Keydown.spec.js
+++ b/tests/unit/Keydown.spec.js
@@ -1,6 +1,6 @@
-import { DOMWrapper } from '@vue/test-utils'
-import typeAheadPointer from '../../src/mixins/typeAheadPointer'
-import { mountDefault } from '../helpers'
+import { it, describe, expect, vi, afterEach } from 'vitest'
+import typeAheadPointer from '../../src/mixins/typeAheadPointer.js'
+import { mountDefault } from '../helpers.js'
describe('Custom Keydown Handlers', () => {
let spy
@@ -9,7 +9,7 @@ describe('Custom Keydown Handlers', () => {
})
it('can use the map-keydown prop to trigger custom behaviour', async () => {
- const onKeyDown = jest.fn()
+ const onKeyDown = vi.fn()
const Select = mountDefault({
mapKeydown: (defaults, vm) => ({ ...defaults, 32: onKeyDown }),
})
@@ -20,7 +20,7 @@ describe('Custom Keydown Handlers', () => {
})
it('selectOnKeyCodes should trigger a selection for custom keycodes', () => {
- spy = jest.spyOn(typeAheadPointer.methods, 'typeAheadSelect')
+ spy = vi.spyOn(typeAheadPointer.methods, 'typeAheadSelect')
const Select = mountDefault({
selectOnKeyCodes: [32],
@@ -32,9 +32,9 @@ describe('Custom Keydown Handlers', () => {
})
it('even works when combining selectOnKeyCodes with map-keydown', () => {
- spy = jest.spyOn(typeAheadPointer.methods, 'typeAheadSelect')
+ spy = vi.spyOn(typeAheadPointer.methods, 'typeAheadSelect')
- const onKeyDown = jest.fn()
+ const onKeyDown = vi.fn()
const Select = mountDefault({
mapKeydown: (defaults, vm) => ({ ...defaults, 32: onKeyDown }),
selectOnKeyCodes: [9],
@@ -49,7 +49,7 @@ describe('Custom Keydown Handlers', () => {
describe('CompositionEvent support', () => {
it('will not select a value with enter if the user is composing', () => {
- spy = jest.spyOn(typeAheadPointer.methods, 'typeAheadSelect')
+ spy = vi.spyOn(typeAheadPointer.methods, 'typeAheadSelect')
const Select = mountDefault()
@@ -63,7 +63,7 @@ describe('Custom Keydown Handlers', () => {
})
it('will not select a value with tab if the user is composing', () => {
- spy = jest.spyOn(typeAheadPointer.methods, 'typeAheadSelect')
+ spy = vi.spyOn(typeAheadPointer.methods, 'typeAheadSelect')
const Select = mountDefault({ selectOnTab: true })
diff --git a/tests/unit/Labels.spec.js b/tests/unit/Labels.spec.js
index 38339fa..0d0de1b 100755
--- a/tests/unit/Labels.spec.js
+++ b/tests/unit/Labels.spec.js
@@ -1,6 +1,7 @@
-import VueSelect from '../../src/components/Select'
+import { it, describe, expect, vi } from 'vitest'
import { shallowMount } from '@vue/test-utils'
-import { selectWithProps } from '../helpers'
+import VueSelect from '../../src/components/Select.vue'
+import { selectWithProps } from '../helpers.js'
describe('Labels', () => {
it('can generate labels using a custom label key', () => {
@@ -13,7 +14,7 @@ describe('Labels', () => {
})
it('will console.warn when options contain objects without a valid label key', async () => {
- const spy = jest.spyOn(console, 'warn').mockImplementation(() => {})
+ const spy = vi.spyOn(console, 'warn').mockImplementation(() => {})
const Select = selectWithProps({
options: [{}],
})
@@ -63,23 +64,23 @@ describe('Labels', () => {
* @see https://github.com/vuejs/vue/issues/10224
* @see https://github.com/vuejs/vue/pull/10229
*/
- xit('will not call getOptionLabel if both scoped option slots are used and a filter is provided', () => {
- const spy = spyOn(VueSelect.props.getOptionLabel, 'default')
- const Select = shallowMount(VueSelect, {
- props: {
- options: [{ name: 'one' }],
- filter: () => {},
- },
- scopedSlots: {
- option: '{{ props.name }}',
- 'selected-option': '{{ props.name }}',
- },
- })
-
- Select.vm.select({ name: 'one' })
-
- expect(spy).toHaveBeenCalledTimes(0)
- expect(Select.find('.selected').exists()).toBeTruthy()
- })
+ // it('will not call getOptionLabel if both scoped option slots are used and a filter is provided', () => {
+ // const spy = spyOn(VueSelect.props.getOptionLabel, 'default')
+ // const Select = shallowMount(VueSelect, {
+ // props: {
+ // options: [{ name: 'one' }],
+ // filter: () => {},
+ // },
+ // scopedSlots: {
+ // option: '{{ props.name }}',
+ // 'selected-option': '{{ props.name }}',
+ // },
+ // })
+ //
+ // Select.vm.select({ name: 'one' })
+ //
+ // expect(spy).toHaveBeenCalledTimes(0)
+ // expect(Select.find('.selected').exists()).toBeTruthy()
+ // })
})
})
diff --git a/tests/unit/Layout.spec.js b/tests/unit/Layout.spec.js
index 28e5237..c90d9b7 100755
--- a/tests/unit/Layout.spec.js
+++ b/tests/unit/Layout.spec.js
@@ -1,5 +1,6 @@
+import { it, describe, expect } from 'vitest'
import { shallowMount } from '@vue/test-utils'
-import VueSelect from '../../src/components/Select'
+import VueSelect from '../../src/components/Select.vue'
describe('Single value options', () => {
it('should reset the search input on focus lost', () => {
diff --git a/tests/unit/OptionComparator.spec.js b/tests/unit/OptionComparator.spec.js
index a1c7848..a1d06ee 100644
--- a/tests/unit/OptionComparator.spec.js
+++ b/tests/unit/OptionComparator.spec.js
@@ -1,4 +1,5 @@
-import Select from '../../src/components/Select'
+import { it, describe, expect } from 'vitest'
+import Select from '../../src/components/Select.vue'
describe('Comparing Options', () => {
const comparator = Select.methods.optionComparator.bind({
diff --git a/tests/unit/OptionKey.spec.js b/tests/unit/OptionKey.spec.js
index a349b8a..ea9ce9f 100644
--- a/tests/unit/OptionKey.spec.js
+++ b/tests/unit/OptionKey.spec.js
@@ -1,3 +1,4 @@
+import { it, describe, expect } from 'vitest'
import Select from '../../src/components/Select.vue'
describe('Serializing Option Keys', () => {
diff --git a/tests/unit/ReactiveOptions.spec.js b/tests/unit/ReactiveOptions.spec.js
index f112666..7425f8f 100755
--- a/tests/unit/ReactiveOptions.spec.js
+++ b/tests/unit/ReactiveOptions.spec.js
@@ -1,6 +1,7 @@
-import { mount, shallowMount } from '@vue/test-utils'
-import VueSelect from '../../src/components/Select'
-import { mountDefault } from '../helpers'
+import { it, describe, expect, vi, afterEach } from 'vitest'
+import { shallowMount } from '@vue/test-utils'
+import VueSelect from '../../src/components/Select.vue'
+import { mountDefault } from '../helpers.js'
describe('Reset on options change', () => {
it('should not reset the selected value by default when the options property changes', async () => {
@@ -21,7 +22,7 @@ describe('Reset on options change', () => {
})
it('will yell at you if resetOnOptionsChange is not a function or boolean', () => {
- spy = jest.spyOn(console, 'warn').mockImplementation(() => {})
+ spy = vi.spyOn(console, 'warn').mockImplementation(() => {})
mountDefault({ resetOnOptionsChange: 1 })
expect(spy.mock.calls[0][0]).toContain(
@@ -45,7 +46,7 @@ describe('Reset on options change', () => {
})
it('should receive the new options, old options, and current value', async () => {
- let resetOnOptionsChange = jest.fn((option) => option)
+ let resetOnOptionsChange = vi.fn((option) => option)
const Select = mountDefault({
resetOnOptionsChange,
options: ['bear'],
@@ -64,7 +65,7 @@ describe('Reset on options change', () => {
it('should allow resetOnOptionsChange to be a function that returns true', async () => {
let resetOnOptionsChange = () => true
- spy = jest.spyOn(VueSelect.methods, 'clearSelection')
+ spy = vi.spyOn(VueSelect.methods, 'clearSelection')
const Select = shallowMount(VueSelect, {
props: { resetOnOptionsChange, options: ['one'], modelValue: 'one' },
})
@@ -76,7 +77,7 @@ describe('Reset on options change', () => {
it('should allow resetOnOptionsChange to be a function that returns false', () => {
let resetOnOptionsChange = () => false
- spy = jest.spyOn(VueSelect.methods, 'clearSelection')
+ spy = vi.spyOn(VueSelect.methods, 'clearSelection')
const Select = shallowMount(VueSelect, {
props: { resetOnOptionsChange, options: ['one'], modelValue: 'one' },
})
@@ -88,7 +89,7 @@ describe('Reset on options change', () => {
it('should reset the options if the selectedValue does not exist in the new options', async () => {
let resetOnOptionsChange = (options, old, val) =>
val.some((val) => options.includes(val))
- spy = jest.spyOn(VueSelect.methods, 'clearSelection')
+ spy = vi.spyOn(VueSelect.methods, 'clearSelection')
const Select = shallowMount(VueSelect, {
props: { resetOnOptionsChange, options: ['one'], modelValue: 'one' },
})
@@ -135,7 +136,7 @@ describe('Reset on options change', () => {
it('clearSearchOnBlur returns false when multiple is true', async () => {
const Select = mountDefault({})
- let clearSearchOnBlur = jest.spyOn(Select.vm.$.props, 'clearSearchOnBlur')
+ let clearSearchOnBlur = vi.spyOn(Select.vm.$.props, 'clearSearchOnBlur')
await Select.get('input').trigger('click')
Select.vm.search = 'one'
await Select.get('input').trigger('blur')
@@ -149,7 +150,7 @@ describe('Reset on options change', () => {
})
it('clearSearchOnBlur accepts a function', async () => {
- let clearSearchOnBlur = jest.fn(() => false)
+ let clearSearchOnBlur = vi.fn(() => false)
const Select = mountDefault({ clearSearchOnBlur })
await Select.get('input').trigger('click')
diff --git a/tests/unit/Reduce.spec.js b/tests/unit/Reduce.spec.js
index f45c6ce..322377f 100755
--- a/tests/unit/Reduce.spec.js
+++ b/tests/unit/Reduce.spec.js
@@ -1,5 +1,6 @@
+import { it, describe, expect } from 'vitest'
import { mount, shallowMount } from '@vue/test-utils'
-import VueSelect from '../../src/components/Select'
+import VueSelect from '../../src/components/Select.vue'
import { mountDefault } from '../helpers.js'
describe('When reduce prop is defined', () => {
diff --git a/tests/unit/Selectable.spec.js b/tests/unit/Selectable.spec.js
index b0d2d84..9c31231 100644
--- a/tests/unit/Selectable.spec.js
+++ b/tests/unit/Selectable.spec.js
@@ -1,4 +1,5 @@
-import { searchSubmit, selectWithProps } from '../helpers'
+import { it, describe, expect } from 'vitest'
+import { searchSubmit, selectWithProps } from '../helpers.js'
describe('Selectable prop', () => {
it('should select selectable option if clicked', async () => {
diff --git a/tests/unit/Selecting.spec.js b/tests/unit/Selecting.spec.js
index cfc1db8..fc9decb 100755
--- a/tests/unit/Selecting.spec.js
+++ b/tests/unit/Selecting.spec.js
@@ -1,7 +1,8 @@
+import { it, describe, expect, vi, beforeEach, afterEach } from 'vitest'
import { mount, shallowMount } from '@vue/test-utils'
import VueSelect from '../../src/components/Select.vue'
-import typeAheadPointer from '../../src/mixins/typeAheadPointer'
-import { mountDefault } from '../helpers'
+import typeAheadPointer from '../../src/mixins/typeAheadPointer.js'
+import { mountDefault } from '../helpers.js'
describe('VS - Selecting Values', () => {
let defaultProps
@@ -57,7 +58,7 @@ describe('VS - Selecting Values', () => {
})
it('can select an option on tab', () => {
- spy = jest.spyOn(typeAheadPointer.methods, 'typeAheadSelect')
+ spy = vi.spyOn(typeAheadPointer.methods, 'typeAheadSelect')
const Select = shallowMount(VueSelect, {
props: {
selectOnTab: true,
@@ -218,7 +219,7 @@ describe('VS - Selecting Values', () => {
expect(Select.vm.selectedValue).toEqual(options)
})
- fit('can select a false boolean option', async () => {
+ it('can select a false boolean option', async () => {
const Select = mountDefault({
options: [false],
})
diff --git a/tests/unit/Slots.spec.js b/tests/unit/Slots.spec.js
index 5d30a5c..e773377 100644
--- a/tests/unit/Slots.spec.js
+++ b/tests/unit/Slots.spec.js
@@ -1,5 +1,6 @@
+import { it, test, describe, expect, vi } from 'vitest'
import { h } from 'vue'
-import { mountDefault } from '../helpers'
+import { mountDefault } from '../helpers.js'
describe('Scoped Slots', () => {
it('receives an option object to the selected-option-container slot', () => {
@@ -68,7 +69,7 @@ describe('Scoped Slots', () => {
})
it('noOptions slot receives the current search text', async () => {
- const noOptions = jest.fn()
+ const noOptions = vi.fn()
const Select = mountDefault(
{},
{
@@ -88,7 +89,7 @@ describe('Scoped Slots', () => {
})
test('header slot props', async () => {
- const header = jest.fn()
+ const header = vi.fn()
const Select = mountDefault(
{},
{
@@ -106,7 +107,7 @@ describe('Scoped Slots', () => {
})
test('footer slot props', async () => {
- const footer = jest.fn()
+ const footer = vi.fn()
const Select = mountDefault(
{},
{
@@ -124,7 +125,7 @@ describe('Scoped Slots', () => {
})
test('list-header slot props', async () => {
- const header = jest.fn()
+ const header = vi.fn()
const Select = mountDefault(
{},
{
@@ -142,7 +143,7 @@ describe('Scoped Slots', () => {
})
test('list-footer slot props', async () => {
- const footer = jest.fn()
+ const footer = vi.fn()
const Select = mountDefault(
{},
{
diff --git a/tests/unit/Tagging.spec.js b/tests/unit/Tagging.spec.js
index 528164a..41da19d 100755
--- a/tests/unit/Tagging.spec.js
+++ b/tests/unit/Tagging.spec.js
@@ -1,10 +1,11 @@
+import { it, describe, expect, vi } from 'vitest'
import {
mountDefault,
searchSubmit,
selectTag,
selectWithProps,
-} from '../helpers'
-import VueSelect from '../../src/components/Select'
+} from '../helpers.js'
+import VueSelect from '../../src/components/Select.vue'
describe('When Tagging Is Enabled', () => {
it('can determine if a given option string already exists', () => {
@@ -222,7 +223,7 @@ describe('When Tagging Is Enabled', () => {
})
it('should not allow duplicate tags when using object options', async () => {
- const spy = jest.spyOn(VueSelect.methods, 'select')
+ const spy = vi.spyOn(VueSelect.methods, 'select')
const Select = selectWithProps({
taggable: true,
multiple: true,
diff --git a/tests/unit/TypeAhead.spec.js b/tests/unit/TypeAhead.spec.js
index c6bae0f..63892bc 100755
--- a/tests/unit/TypeAhead.spec.js
+++ b/tests/unit/TypeAhead.spec.js
@@ -1,8 +1,7 @@
+import { it, describe, expect } from 'vitest'
import { shallowMount } from '@vue/test-utils'
-import VueSelect from '../../src/components/Select'
-import { mountDefault, mountWithoutTestUtils } from '../helpers'
-import typeAheadMixin from '../../src/mixins/typeAheadPointer'
-import Vue from 'vue'
+import VueSelect from '../../src/components/Select.vue'
+import { mountDefault } from '../helpers.js'
describe('Moving the Typeahead Pointer', () => {
it('should set the pointer to zero when the filteredOptions watcher is called', async () => {
diff --git a/tests/unit/utility/sortAndStringify.spec.js b/tests/unit/utility/sortAndStringify.spec.js
index dbf649a..3ecc3a0 100644
--- a/tests/unit/utility/sortAndStringify.spec.js
+++ b/tests/unit/utility/sortAndStringify.spec.js
@@ -1,3 +1,4 @@
+import { test, expect } from 'vitest'
import sortAndStringify from '../../../src/utility/sortAndStringify'
test('it will stringify an object', () => {
diff --git a/tests/unit/utility/uniqueId.spec.js b/tests/unit/utility/uniqueId.spec.js
index 2febb51..ce9c200 100644
--- a/tests/unit/utility/uniqueId.spec.js
+++ b/tests/unit/utility/uniqueId.spec.js
@@ -1,3 +1,4 @@
+import { test, expect } from 'vitest'
import uniqueId from '../../../src/utility/uniqueId'
test('it generates a unique number', () => {
diff --git a/vite.config.ts b/vite.config.ts
index 73d2c87..fec9cd7 100644
--- a/vite.config.ts
+++ b/vite.config.ts
@@ -11,6 +11,7 @@ export default defineConfig({
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url)),
+ '~tests': fileURLToPath(new URL('./tests', import.meta.url)),
},
},
build: {