2
0
mirror of https://github.com/tenrok/vue-select.git synced 2026-06-10 07:52:23 +03:00

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)
This commit is contained in:
Jeff Sagal
2022-07-18 09:33:46 -07:00
committed by GitHub
parent 92abcbf1f8
commit 98c278b2bb
51 changed files with 3470 additions and 10062 deletions
+9 -21
View File
@@ -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 '@tests/helpers.js'
import OpenIndicator from '@/components/OpenIndicator.vue'
import VueSelect from '@/components/Select.vue'
const preventDefault = jest.fn()
const preventDefault = vi.fn()
function clickEvent(currentTarget) {
return { currentTarget, preventDefault }
@@ -30,19 +31,6 @@ describe('Toggling Dropdown', () => {
expect(Select.vm.open).toEqual(true)
})
it('should not close the dropdown when the el is clicked and enableMouseInputSearch is set to true', () => {
const Select = selectWithProps({
modelValue: [{ label: 'one' }],
options: [{ label: 'one' }],
enableMouseSearchInput: true,
})
Select.vm.toggleDropdown(clickEvent(Select.vm.$refs.search))
expect(Select.vm.open).toEqual(true)
Select.vm.toggleDropdown(clickEvent(Select.vm.$el))
expect(Select.vm.open).toEqual(false)
})
it('should open the dropdown when the selected tag is clicked', () => {
const Select = selectWithProps({
modelValue: [{ label: 'one' }],
@@ -57,7 +45,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 +92,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 +103,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 +114,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()