2
0
mirror of https://github.com/tenrok/vue-select.git synced 2026-06-22 10:30:34 +03:00

add @tests alias

This commit is contained in:
Jeff Sagal
2022-07-17 13:06:08 -07:00
parent 93b2fbc342
commit 4782b0ebcf
21 changed files with 22 additions and 57 deletions
-19
View File
@@ -1,19 +0,0 @@
root = true
[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 4
trim_trailing_whitespace = true
[*.{js,vue}]
indent_style = space
indent_size = 2
[*.md]
trim_trailing_whitespace = false
[*.{yml,yaml}]
indent_size = 2
+2 -1
View File
@@ -2,7 +2,8 @@
"compilerOptions": { "compilerOptions": {
"baseUrl": ".", "baseUrl": ".",
"paths": { "paths": {
"@/*": ["src/*"] "@/*": ["src/*"],
"@tests/*": ["tests/*"]
} }
}, },
"exclude": ["node_modules", "dist", "coverage", "docs"] "exclude": ["node_modules", "dist", "coverage", "docs"]
+1 -20
View File
@@ -1,6 +1,5 @@
import { shallowMount } from '@vue/test-utils' import { shallowMount } from '@vue/test-utils'
import VueSelect from '../src/components/Select.vue' import VueSelect from '@/src/components/Select.vue'
import Vue from 'vue'
/** /**
* Trigger a submit event on the search * Trigger a submit event on the search
@@ -69,21 +68,3 @@ export const mountDefault = (props = {}, options = {}) => {
...options, ...options,
}) })
} }
/**
* Returns a v-select component directly.
* @param props
* @param options
* @return {Vue | Element | Vue[] | Element[]}
*/
export const mountWithoutTestUtils = (props = {}, options = {}) => {
return createApp({
render: (createEl) =>
createEl('vue-select', {
ref: 'select',
props: { options: ['one', 'two', 'three'], ...props },
...options,
}),
components: { VueSelect },
}).mount().$refs.select
}
+1 -1
View File
@@ -1,5 +1,5 @@
import { it, describe, expect } from 'vitest' import { it, describe, expect } from 'vitest'
import { mountDefault } from '../helpers.js' import { mountDefault } from '@tests/helpers.js'
describe('Search Slot Scope', () => { describe('Search Slot Scope', () => {
/** /**
+1 -1
View File
@@ -1,5 +1,5 @@
import { it, describe, expect } from 'vitest' import { it, describe, expect } from 'vitest'
import { selectWithProps } from '../helpers.js' import { selectWithProps } from '@tests/helpers.js'
import { shallowMount } from '@vue/test-utils' import { shallowMount } from '@vue/test-utils'
import vSelect from '@/components/Select.vue' import vSelect from '@/components/Select.vue'
+1 -1
View File
@@ -1,6 +1,6 @@
import { it, describe, expect, vi, afterEach } from 'vitest' import { it, describe, expect, vi, afterEach } from 'vitest'
import pointerScroll from '@/mixins/pointerScroll.js' import pointerScroll from '@/mixins/pointerScroll.js'
import { mountDefault } from '../helpers.js' import { mountDefault } from '@tests/helpers.js'
describe('Automatic Scrolling', () => { describe('Automatic Scrolling', () => {
let spy let spy
+1 -1
View File
@@ -1,6 +1,6 @@
import { it, describe, expect } from 'vitest' import { it, describe, expect } from 'vitest'
import { defineComponent } from 'vue' import { defineComponent } from 'vue'
import { selectWithProps } from '../helpers.js' import { selectWithProps } from '@tests/helpers.js'
describe('Components API', () => { describe('Components API', () => {
it('swap the Deselect component', () => { it('swap the Deselect component', () => {
+1 -1
View File
@@ -1,5 +1,5 @@
import { it, describe, expect } from 'vitest' import { it, describe, expect } from 'vitest'
import { selectTag, selectWithProps } from '../helpers.js' import { selectTag, selectWithProps } from '@tests/helpers.js'
describe('CreateOption When Tagging Is Enabled', () => { describe('CreateOption When Tagging Is Enabled', () => {
it('can select the current search text as a string', async () => { it('can select the current search text as a string', async () => {
+1 -1
View File
@@ -1,5 +1,5 @@
import { it, describe, expect, vi } from 'vitest' import { it, describe, expect, vi } from 'vitest'
import { mountDefault, selectWithProps } from '../helpers.js' import { mountDefault, selectWithProps } from '@tests/helpers.js'
describe('Removing values', () => { describe('Removing values', () => {
it('can remove the given tag when its close icon is clicked', async () => { it('can remove the given tag when its close icon is clicked', async () => {
+1 -1
View File
@@ -1,5 +1,5 @@
import { it, describe, expect, vi, afterEach } from 'vitest' import { it, describe, expect, vi, afterEach } from 'vitest'
import { selectWithProps } from '../helpers.js' import { selectWithProps } from '@tests/helpers.js'
import OpenIndicator from '@/components/OpenIndicator.vue' import OpenIndicator from '@/components/OpenIndicator.vue'
import VueSelect from '@/components/Select.vue' import VueSelect from '@/components/Select.vue'
+1 -1
View File
@@ -1,6 +1,6 @@
import { it, describe, expect, vi, afterEach } from 'vitest' import { it, describe, expect, vi, afterEach } from 'vitest'
import typeAheadPointer from '@/mixins/typeAheadPointer.js' import typeAheadPointer from '@/mixins/typeAheadPointer.js'
import { mountDefault } from '../helpers.js' import { mountDefault } from '@tests/helpers.js'
describe('Custom Keydown Handlers', () => { describe('Custom Keydown Handlers', () => {
let spy let spy
+1 -1
View File
@@ -1,7 +1,7 @@
import { it, describe, expect, vi } from 'vitest' import { it, describe, expect, vi } from 'vitest'
import { shallowMount } from '@vue/test-utils' import { shallowMount } from '@vue/test-utils'
import VueSelect from '@/components/Select.vue' import VueSelect from '@/components/Select.vue'
import { selectWithProps } from '../helpers.js' import { selectWithProps } from '@tests/helpers.js'
describe('Labels', () => { describe('Labels', () => {
it('can generate labels using a custom label key', () => { it('can generate labels using a custom label key', () => {
+1 -1
View File
@@ -1,7 +1,7 @@
import { it, describe, expect, vi, afterEach } from 'vitest' import { it, describe, expect, vi, afterEach } from 'vitest'
import { shallowMount } from '@vue/test-utils' import { shallowMount } from '@vue/test-utils'
import VueSelect from '@/components/Select.vue' import VueSelect from '@/components/Select.vue'
import { mountDefault } from '../helpers.js' import { mountDefault } from '@tests/helpers.js'
describe('Reset on options change', () => { describe('Reset on options change', () => {
it('should not reset the selected value by default when the options property changes', async () => { it('should not reset the selected value by default when the options property changes', async () => {
+1 -1
View File
@@ -1,7 +1,7 @@
import { it, describe, expect } from 'vitest' import { it, describe, expect } from 'vitest'
import { mount, shallowMount } from '@vue/test-utils' import { mount, shallowMount } from '@vue/test-utils'
import VueSelect from '@/components/Select.vue' import VueSelect from '@/components/Select.vue'
import { mountDefault } from '../helpers.js' import { mountDefault } from '@tests/helpers.js'
describe('When reduce prop is defined', () => { describe('When reduce prop is defined', () => {
it('determines when a reducer has been supplied', async () => { it('determines when a reducer has been supplied', async () => {
+1 -1
View File
@@ -1,5 +1,5 @@
import { it, describe, expect } from 'vitest' import { it, describe, expect } from 'vitest'
import { searchSubmit, selectWithProps } from '../helpers.js' import { searchSubmit, selectWithProps } from '@tests/helpers.js'
describe('Selectable prop', () => { describe('Selectable prop', () => {
it('should select selectable option if clicked', async () => { it('should select selectable option if clicked', async () => {
+1 -1
View File
@@ -2,7 +2,7 @@ import { it, describe, expect, vi, beforeEach, afterEach } from 'vitest'
import { mount, shallowMount } from '@vue/test-utils' import { mount, shallowMount } from '@vue/test-utils'
import VueSelect from '@/components/Select.vue' import VueSelect from '@/components/Select.vue'
import typeAheadPointer from '@/mixins/typeAheadPointer.js' import typeAheadPointer from '@/mixins/typeAheadPointer.js'
import { mountDefault } from '../helpers.js' import { mountDefault } from '@tests/helpers.js'
describe('VS - Selecting Values', () => { describe('VS - Selecting Values', () => {
let defaultProps let defaultProps
+1 -1
View File
@@ -1,6 +1,6 @@
import { it, test, describe, expect, vi } from 'vitest' import { it, test, describe, expect, vi } from 'vitest'
import { h } from 'vue' import { h } from 'vue'
import { mountDefault } from '../helpers.js' import { mountDefault } from '@tests/helpers.js'
describe('Scoped Slots', () => { describe('Scoped Slots', () => {
it('receives an option object to the selected-option-container slot', () => { it('receives an option object to the selected-option-container slot', () => {
+1 -1
View File
@@ -4,7 +4,7 @@ import {
searchSubmit, searchSubmit,
selectTag, selectTag,
selectWithProps, selectWithProps,
} from '../helpers.js' } from '@tests/helpers.js'
import VueSelect from '@/components/Select.vue' import VueSelect from '@/components/Select.vue'
describe('When Tagging Is Enabled', () => { describe('When Tagging Is Enabled', () => {
+1 -1
View File
@@ -1,7 +1,7 @@
import { it, describe, expect } from 'vitest' import { it, describe, expect } from 'vitest'
import { shallowMount } from '@vue/test-utils' import { shallowMount } from '@vue/test-utils'
import VueSelect from '@/components/Select.vue' import VueSelect from '@/components/Select.vue'
import { mountDefault } from '../helpers.js' import { mountDefault } from '@tests/helpers.js'
describe('Moving the Typeahead Pointer', () => { describe('Moving the Typeahead Pointer', () => {
it('should set the pointer to zero when the filteredOptions watcher is called', async () => { it('should set the pointer to zero when the filteredOptions watcher is called', async () => {
+2 -1
View File
@@ -6,7 +6,8 @@
"composite": true, "composite": true,
"baseUrl": ".", "baseUrl": ".",
"paths": { "paths": {
"@/*": ["./src/*"] "@/*": ["./src/*"],
"@tests/*": ["./tests/*"]
} }
} }
} }
+1
View File
@@ -11,6 +11,7 @@ export default defineConfig({
resolve: { resolve: {
alias: { alias: {
'@': fileURLToPath(new URL('./src', import.meta.url)), '@': fileURLToPath(new URL('./src', import.meta.url)),
'@tests': fileURLToPath(new URL('./tests', import.meta.url)),
}, },
}, },
build: { build: {