From b94a4b23a02879bdf9b2b0a1ad3def2eddc1f3e2 Mon Sep 17 00:00:00 2001 From: uros Date: Thu, 1 Aug 2024 23:22:05 +0200 Subject: [PATCH] - fix BlockUI.spec.js, Carousel.spec.js, CascadeSelect.spec.js --- packages/primevue/src/blockui/BlockUI.spec.js | 11 ++++++++++- .../primevue/src/carousel/Carousel.spec.js | 2 +- .../src/cascadeselect/CascadeSelect.spec.js | 18 +++++++++--------- 3 files changed, 20 insertions(+), 11 deletions(-) diff --git a/packages/primevue/src/blockui/BlockUI.spec.js b/packages/primevue/src/blockui/BlockUI.spec.js index 1168815cb..bdccf0593 100644 --- a/packages/primevue/src/blockui/BlockUI.spec.js +++ b/packages/primevue/src/blockui/BlockUI.spec.js @@ -1,4 +1,5 @@ import { mount } from '@vue/test-utils'; +import PrimeVue from 'primevue/config'; import { beforeEach, expect } from 'vitest'; import BlockUI from './BlockUI.vue'; @@ -6,7 +7,15 @@ let wrapper = null; describe('BlockUI.vue', () => { beforeEach(() => { - wrapper = mount(BlockUI); + wrapper = mount(BlockUI, { + attachTo: document.body, + global: { + plugins: [PrimeVue], + stubs: { + teleport: true + } + } + }); }); afterEach(() => { diff --git a/packages/primevue/src/carousel/Carousel.spec.js b/packages/primevue/src/carousel/Carousel.spec.js index 64389409a..ded11640f 100644 --- a/packages/primevue/src/carousel/Carousel.spec.js +++ b/packages/primevue/src/carousel/Carousel.spec.js @@ -81,7 +81,7 @@ describe('Carousel.vue', () => { expect(firstItem.classes()).toContain('p-carousel-item-active'); - const nextBtn = wrapper.find('.p-carousel-next'); + const nextBtn = wrapper.find('.p-carousel-next-button'); await nextBtn.trigger('click'); diff --git a/packages/primevue/src/cascadeselect/CascadeSelect.spec.js b/packages/primevue/src/cascadeselect/CascadeSelect.spec.js index e4ed7b2f2..5be2134d7 100644 --- a/packages/primevue/src/cascadeselect/CascadeSelect.spec.js +++ b/packages/primevue/src/cascadeselect/CascadeSelect.spec.js @@ -106,20 +106,20 @@ describe('CascadeSelect.vue', () => { await wrapper.trigger('click'); - expect(wrapper.find('.p-cascadeselect-panel.p-cascadeselect-items').exists()).toBe(true); - expect(wrapper.findAll('.p-cascadeselect-item').length).toBe(3); - expect(wrapper.findAll('.p-cascadeselect-item-text')[0].text()).toBe('Australia'); + expect(wrapper.find('.p-cascadeselect-list').exists()).toBe(true); + expect(wrapper.findAll('.p-cascadeselect-option').length).toBe(3); + expect(wrapper.findAll('.p-cascadeselect-option-text')[0].text()).toBe('Australia'); - const firstGroup = wrapper.findAll('.p-cascadeselect-item-content')[0]; + const firstGroup = wrapper.findAll('.p-cascadeselect-option-content')[0]; await firstGroup.trigger('click'); - expect(wrapper.find('.p-cascadeselect-panel.p-cascadeselect-sublist').exists()).toBe(true); + expect(wrapper.find('.p-cascadeselect-list .p-cascadeselect-option-list').exists()).toBe(true); - const sublist = wrapper.find('.p-cascadeselect-panel.p-cascadeselect-sublist'); + const sublist = wrapper.find('.p-cascadeselect-list .p-cascadeselect-option-list'); - expect(sublist.findAll('.p-cascadeselect-item.p-cascadeselect-item-group').length).toBe(2); - expect(sublist.findAll('.p-cascadeselect-item-text')[0].text()).toBe('New South Wales'); + expect(sublist.findAll('.p-cascadeselect-option').length).toBe(2); + expect(sublist.findAll('.p-cascadeselect-option-text')[0].text()).toBe('New South Wales'); }); it('should accept custom icons', async () => { @@ -130,7 +130,7 @@ describe('CascadeSelect.vue', () => { await nextTick(); - expect(wrapper.find('.p-cascadeselect-trigger-icon').classes()).toContain('pi-discord'); + expect(wrapper.find('.p-cascadeselect-dropdown-icon').classes()).toContain('pi-discord'); await wrapper.trigger('click');