diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 3f82792..0000000 --- a/.editorconfig +++ /dev/null @@ -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 diff --git a/jsconfig.json b/jsconfig.json index 7ae1f75..40548c2 100644 --- a/jsconfig.json +++ b/jsconfig.json @@ -2,7 +2,8 @@ "compilerOptions": { "baseUrl": ".", "paths": { - "@/*": ["src/*"] + "@/*": ["src/*"], + "@tests/*": ["tests/*"] } }, "exclude": ["node_modules", "dist", "coverage", "docs"] diff --git a/tests/helpers.js b/tests/helpers.js index 85bda39..5cf7439 100755 --- a/tests/helpers.js +++ b/tests/helpers.js @@ -1,6 +1,5 @@ import { shallowMount } from '@vue/test-utils' -import VueSelect from '../src/components/Select.vue' -import Vue from 'vue' +import VueSelect from '@/src/components/Select.vue' /** * Trigger a submit event on the search @@ -69,21 +68,3 @@ export const mountDefault = (props = {}, 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 -} diff --git a/tests/unit/Accessibility.spec.js b/tests/unit/Accessibility.spec.js index c41c53c..a836dcb 100644 --- a/tests/unit/Accessibility.spec.js +++ b/tests/unit/Accessibility.spec.js @@ -1,5 +1,5 @@ import { it, describe, expect } from 'vitest' -import { mountDefault } from '../helpers.js' +import { mountDefault } from '@tests/helpers.js' describe('Search Slot Scope', () => { /** diff --git a/tests/unit/Ajax.spec.js b/tests/unit/Ajax.spec.js index 82c6eee..410fe86 100755 --- a/tests/unit/Ajax.spec.js +++ b/tests/unit/Ajax.spec.js @@ -1,5 +1,5 @@ import { it, describe, expect } from 'vitest' -import { selectWithProps } from '../helpers.js' +import { selectWithProps } from '@tests/helpers.js' import { shallowMount } from '@vue/test-utils' import vSelect from '@/components/Select.vue' diff --git a/tests/unit/Autoscroll.spec.js b/tests/unit/Autoscroll.spec.js index 9c285a0..502b124 100644 --- a/tests/unit/Autoscroll.spec.js +++ b/tests/unit/Autoscroll.spec.js @@ -1,6 +1,6 @@ import { it, describe, expect, vi, afterEach } from 'vitest' import pointerScroll from '@/mixins/pointerScroll.js' -import { mountDefault } from '../helpers.js' +import { mountDefault } from '@tests/helpers.js' describe('Automatic Scrolling', () => { let spy diff --git a/tests/unit/Components.spec.js b/tests/unit/Components.spec.js index cd0ba61..5605d1c 100644 --- a/tests/unit/Components.spec.js +++ b/tests/unit/Components.spec.js @@ -1,6 +1,6 @@ import { it, describe, expect } from 'vitest' import { defineComponent } from 'vue' -import { selectWithProps } from '../helpers.js' +import { selectWithProps } from '@tests/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 89e22bb..7c4cf34 100644 --- a/tests/unit/CreateOption.spec.js +++ b/tests/unit/CreateOption.spec.js @@ -1,5 +1,5 @@ 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', () => { 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 c87af31..f39abe5 100755 --- a/tests/unit/Deselecting.spec.js +++ b/tests/unit/Deselecting.spec.js @@ -1,5 +1,5 @@ import { it, describe, expect, vi } from 'vitest' -import { mountDefault, selectWithProps } from '../helpers.js' +import { mountDefault, selectWithProps } from '@tests/helpers.js' describe('Removing values', () => { it('can remove the given tag when its close icon is clicked', async () => { diff --git a/tests/unit/Dropdown.spec.js b/tests/unit/Dropdown.spec.js index 0ff74f9..223be11 100755 --- a/tests/unit/Dropdown.spec.js +++ b/tests/unit/Dropdown.spec.js @@ -1,5 +1,5 @@ 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 VueSelect from '@/components/Select.vue' diff --git a/tests/unit/Keydown.spec.js b/tests/unit/Keydown.spec.js index e839607..753804b 100644 --- a/tests/unit/Keydown.spec.js +++ b/tests/unit/Keydown.spec.js @@ -1,6 +1,6 @@ import { it, describe, expect, vi, afterEach } from 'vitest' import typeAheadPointer from '@/mixins/typeAheadPointer.js' -import { mountDefault } from '../helpers.js' +import { mountDefault } from '@tests/helpers.js' describe('Custom Keydown Handlers', () => { let spy diff --git a/tests/unit/Labels.spec.js b/tests/unit/Labels.spec.js index 5f713f6..3b8f7e3 100755 --- a/tests/unit/Labels.spec.js +++ b/tests/unit/Labels.spec.js @@ -1,7 +1,7 @@ import { it, describe, expect, vi } from 'vitest' import { shallowMount } from '@vue/test-utils' import VueSelect from '@/components/Select.vue' -import { selectWithProps } from '../helpers.js' +import { selectWithProps } from '@tests/helpers.js' describe('Labels', () => { it('can generate labels using a custom label key', () => { diff --git a/tests/unit/ReactiveOptions.spec.js b/tests/unit/ReactiveOptions.spec.js index 7d74d1f..15e572c 100755 --- a/tests/unit/ReactiveOptions.spec.js +++ b/tests/unit/ReactiveOptions.spec.js @@ -1,7 +1,7 @@ import { it, describe, expect, vi, afterEach } from 'vitest' import { shallowMount } from '@vue/test-utils' import VueSelect from '@/components/Select.vue' -import { mountDefault } from '../helpers.js' +import { mountDefault } from '@tests/helpers.js' describe('Reset on options change', () => { it('should not reset the selected value by default when the options property changes', async () => { diff --git a/tests/unit/Reduce.spec.js b/tests/unit/Reduce.spec.js index 803e995..695809e 100755 --- a/tests/unit/Reduce.spec.js +++ b/tests/unit/Reduce.spec.js @@ -1,7 +1,7 @@ import { it, describe, expect } from 'vitest' import { mount, shallowMount } from '@vue/test-utils' import VueSelect from '@/components/Select.vue' -import { mountDefault } from '../helpers.js' +import { mountDefault } from '@tests/helpers.js' describe('When reduce prop is defined', () => { it('determines when a reducer has been supplied', async () => { diff --git a/tests/unit/Selectable.spec.js b/tests/unit/Selectable.spec.js index 9c31231..24ab8a8 100644 --- a/tests/unit/Selectable.spec.js +++ b/tests/unit/Selectable.spec.js @@ -1,5 +1,5 @@ import { it, describe, expect } from 'vitest' -import { searchSubmit, selectWithProps } from '../helpers.js' +import { searchSubmit, selectWithProps } from '@tests/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 c6e910c..71a50d8 100755 --- a/tests/unit/Selecting.spec.js +++ b/tests/unit/Selecting.spec.js @@ -2,7 +2,7 @@ import { it, describe, expect, vi, beforeEach, afterEach } from 'vitest' import { mount, shallowMount } from '@vue/test-utils' import VueSelect from '@/components/Select.vue' import typeAheadPointer from '@/mixins/typeAheadPointer.js' -import { mountDefault } from '../helpers.js' +import { mountDefault } from '@tests/helpers.js' describe('VS - Selecting Values', () => { let defaultProps diff --git a/tests/unit/Slots.spec.js b/tests/unit/Slots.spec.js index e773377..ea397be 100644 --- a/tests/unit/Slots.spec.js +++ b/tests/unit/Slots.spec.js @@ -1,6 +1,6 @@ import { it, test, describe, expect, vi } from 'vitest' import { h } from 'vue' -import { mountDefault } from '../helpers.js' +import { mountDefault } from '@tests/helpers.js' describe('Scoped Slots', () => { it('receives an option object to the selected-option-container slot', () => { diff --git a/tests/unit/Tagging.spec.js b/tests/unit/Tagging.spec.js index 640701b..b09577b 100755 --- a/tests/unit/Tagging.spec.js +++ b/tests/unit/Tagging.spec.js @@ -4,7 +4,7 @@ import { searchSubmit, selectTag, selectWithProps, -} from '../helpers.js' +} from '@tests/helpers.js' import VueSelect from '@/components/Select.vue' describe('When Tagging Is Enabled', () => { diff --git a/tests/unit/TypeAhead.spec.js b/tests/unit/TypeAhead.spec.js index 56a4e43..a960704 100755 --- a/tests/unit/TypeAhead.spec.js +++ b/tests/unit/TypeAhead.spec.js @@ -1,7 +1,7 @@ import { it, describe, expect } from 'vitest' import { shallowMount } from '@vue/test-utils' import VueSelect from '@/components/Select.vue' -import { mountDefault } from '../helpers.js' +import { mountDefault } from '@tests/helpers.js' describe('Moving the Typeahead Pointer', () => { it('should set the pointer to zero when the filteredOptions watcher is called', async () => { diff --git a/tsconfig.app.json b/tsconfig.app.json index cdbea1d..66cbd62 100644 --- a/tsconfig.app.json +++ b/tsconfig.app.json @@ -6,7 +6,8 @@ "composite": true, "baseUrl": ".", "paths": { - "@/*": ["./src/*"] + "@/*": ["./src/*"], + "@tests/*": ["./tests/*"] } } } diff --git a/vite.config.ts b/vite.config.ts index 5e792d4..38821d4 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: {