diff --git a/components/lib/blockui/BlockUI.spec.js b/components/lib/blockui/BlockUI.spec.js index 456e22db6..0d4a4e35a 100644 --- a/components/lib/blockui/BlockUI.spec.js +++ b/components/lib/blockui/BlockUI.spec.js @@ -1,16 +1,7 @@ -import { config, mount } from '@vue/test-utils'; +import { mount } from '@vue/test-utils'; import { beforeEach, expect } from 'vitest'; import BlockUI from './BlockUI.vue'; -config.global.mocks = { - $primevue: { - config: { - zIndex: { - modal: 1100 - } - } - } -}; vi.mock('primevue/utils'); let wrapper = null; diff --git a/components/lib/config/PrimeVue.js b/components/lib/config/PrimeVue.js index 06b137fd1..532251cf9 100644 --- a/components/lib/config/PrimeVue.js +++ b/components/lib/config/PrimeVue.js @@ -1,7 +1,7 @@ import { FilterMatchMode } from 'primevue/api'; import { inject, reactive } from 'vue'; -const defaultOptions = { +export const defaultOptions = { ripple: false, inputStyle: 'outlined', locale: { diff --git a/components/lib/config/PrimeVue.spec.js b/components/lib/config/PrimeVue.spec.js new file mode 100644 index 000000000..8440d832c --- /dev/null +++ b/components/lib/config/PrimeVue.spec.js @@ -0,0 +1,6 @@ +import { config } from '@vue/test-utils'; +import { defaultOptions } from 'primevue/config'; + +config.global.mocks['$primevue'] = { + config: defaultOptions +}; diff --git a/components/lib/dataviewlayoutoptions/DataViewLayoutOptions.spec.js b/components/lib/dataviewlayoutoptions/DataViewLayoutOptions.spec.js index 9e0f14dfd..6d8c70d4d 100644 --- a/components/lib/dataviewlayoutoptions/DataViewLayoutOptions.spec.js +++ b/components/lib/dataviewlayoutoptions/DataViewLayoutOptions.spec.js @@ -1,19 +1,6 @@ -import { config, mount } from '@vue/test-utils'; +import { mount } from '@vue/test-utils'; import DataViewLayoutOptions from './DataViewLayoutOptions.vue'; -config.global.mocks = { - $primevue: { - config: { - locale: { - aria: { - listView: 'listView', - gridView: 'gridView' - } - } - } - } -}; - describe('DataViewLayoutOptions.vue', () => { it('should exist', async () => { const wrapper = mount(DataViewLayoutOptions, { diff --git a/components/lib/inplace/Inplace.spec.js b/components/lib/inplace/Inplace.spec.js index 26c1f884b..a4adb3809 100644 --- a/components/lib/inplace/Inplace.spec.js +++ b/components/lib/inplace/Inplace.spec.js @@ -1,19 +1,7 @@ -import { config, mount } from '@vue/test-utils'; +import { mount } from '@vue/test-utils'; import InputText from 'primevue/inputtext'; import Inplace from './Inplace.vue'; -config.global.mocks = { - $primevue: { - config: { - locale: { - aria: { - close: 'Close' - } - } - } - } -}; - describe('Inplace.vue', () => { it('should exist', () => { const wrapper = mount(Inplace); diff --git a/components/lib/listbox/Listbox.spec.js b/components/lib/listbox/Listbox.spec.js index dc5c88a82..9c1b69c6c 100644 --- a/components/lib/listbox/Listbox.spec.js +++ b/components/lib/listbox/Listbox.spec.js @@ -1,20 +1,6 @@ -import { config, mount } from '@vue/test-utils'; +import { mount } from '@vue/test-utils'; import Listbox from './Listbox.vue'; -config.global.mocks = { - $primevue: { - config: { - locale: { - aria: { - trueLabel: 'trueLabel', - falseLabel: 'falseLabel', - nullLabel: 'nullLabel' - } - } - } - } -}; - describe('Listbox.vue', () => { let wrapper; diff --git a/components/lib/menubar/Menubar.spec.js b/components/lib/menubar/Menubar.spec.js index 1a7124fc4..9c3e39c65 100644 --- a/components/lib/menubar/Menubar.spec.js +++ b/components/lib/menubar/Menubar.spec.js @@ -1,18 +1,6 @@ -import { config, mount } from '@vue/test-utils'; +import { mount } from '@vue/test-utils'; import Menubar from './Menubar.vue'; -config.global.mocks = { - $primevue: { - config: { - locale: { - aria: { - navigation: 'Navigation' - } - } - } - } -}; - describe('Menubar.vue', () => { let wrapper; diff --git a/components/lib/message/Message.spec.js b/components/lib/message/Message.spec.js index ac0e7e89d..523fbd47b 100644 --- a/components/lib/message/Message.spec.js +++ b/components/lib/message/Message.spec.js @@ -1,19 +1,6 @@ -import { config, mount } from '@vue/test-utils'; -import PrimeVue from 'primevue/config'; +import { mount } from '@vue/test-utils'; import Message from './Message.vue'; -config.global.mocks = { - $primevue: { - config: { - locale: { - aria: { - close: 'Close' - } - } - } - } -}; - describe('Message.vue', () => { let wrapper; diff --git a/components/lib/password/Password.spec.js b/components/lib/password/Password.spec.js index 8e9165f60..f6b202c75 100644 --- a/components/lib/password/Password.spec.js +++ b/components/lib/password/Password.spec.js @@ -1,17 +1,6 @@ -import { config, mount } from '@vue/test-utils'; +import { mount } from '@vue/test-utils'; import Password from './Password.vue'; -config.global.mocks = { - $primevue: { - config: { - 'z-index': 5, - inputStyle: 'filled', - ripple: false, - locale: {} - } - } -}; - describe('Password.vue', () => { let wrapper; const event = { target: { value: 'P' } }; diff --git a/components/lib/picklist/PickList.spec.js b/components/lib/picklist/PickList.spec.js index b371e9b14..3a319936e 100644 --- a/components/lib/picklist/PickList.spec.js +++ b/components/lib/picklist/PickList.spec.js @@ -1,20 +1,6 @@ -import { mount, config } from '@vue/test-utils'; +import { mount } from '@vue/test-utils'; import PickList from './PickList.vue'; -config.global.mocks = { - $primevue: { - config: { - locale: { - aria: { - moveUp: 'Move Up', - moveDown: 'Move Down', - moveTop: 'Move Top', - moveBottom: 'Move Bottom' - } - } - } - } -}; describe('PickList.vue', () => { let wrapper; diff --git a/components/lib/rating/Rating.spec.js b/components/lib/rating/Rating.spec.js index f7718a649..0ab65c6f5 100644 --- a/components/lib/rating/Rating.spec.js +++ b/components/lib/rating/Rating.spec.js @@ -1,18 +1,7 @@ -import { config, mount } from '@vue/test-utils'; +import { mount } from '@vue/test-utils'; import { expect } from 'vitest'; import Rating from './Rating.vue'; -config.global.mocks = { - $primevue: { - config: { - locale: { - aria: { - stars: '5' - } - } - } - } -}; describe('Rating.vue', () => { let wrapper; diff --git a/components/lib/tristatecheckbox/TriStateCheckbox.spec.js b/components/lib/tristatecheckbox/TriStateCheckbox.spec.js index 0ba1dfc2a..6a7fd9fb2 100644 --- a/components/lib/tristatecheckbox/TriStateCheckbox.spec.js +++ b/components/lib/tristatecheckbox/TriStateCheckbox.spec.js @@ -1,19 +1,6 @@ -import { config, mount } from '@vue/test-utils'; +import { mount } from '@vue/test-utils'; import TriStateCheckbox from './TriStateCheckbox.vue'; -config.global.mocks = { - $primevue: { - config: { - locale: { - aria: { - trueLabel: 'trueLabel', - falseLabel: 'falseLabel', - nullLabel: 'nullLabel' - } - } - } - } -}; let wrapper; const modelValues = [true, false, null]; const emittedResults = [false, null, true]; diff --git a/vitest.config.js b/vitest.config.js index d86452c56..f1c2c7578 100644 --- a/vitest.config.js +++ b/vitest.config.js @@ -14,7 +14,8 @@ export default mergeConfig( coverage: { provider: 'istanbul', reporter: ['text', 'json', 'html'] - } + }, + setupFiles: [path.resolve(__dirname, './components/lib/config/PrimeVue.spec.js')] }, resolve: { alias: {