diff --git a/components/lib/accordion/Accordion.spec.js b/components/lib/accordion/Accordion.spec.js
index dd790c75b..003a4107d 100644
--- a/components/lib/accordion/Accordion.spec.js
+++ b/components/lib/accordion/Accordion.spec.js
@@ -2,7 +2,7 @@ import { mount } from '@vue/test-utils';
import { expect, it } from 'vitest';
import AccordionTab from '../accordiontab/AccordionTab.vue';
import Accordion from './Accordion.vue';
-vi.mock('primevue/utils');
+
describe('Accordion.vue', () => {
let wrapper;
@@ -151,23 +151,4 @@ describe('Accordion.vue', () => {
expect(findNextHeaderActionSpy).toHaveBeenCalled();
expect(onTabHomeKeySpy).toHaveBeenCalled();
});
-
- it('When changeFocusedTab triggered and selectOnFocus is true changeActiveIndex should be triggered with valid parameters', async () => {
- await wrapper.setProps({ selectOnFocus: true });
- const changeActiveIndexSpy = vi.spyOn(wrapper.vm, 'changeActiveIndex');
- const event = {};
- const element = {
- parentElement: {
- parentElement: {
- dataset: {
- index: 0
- }
- }
- }
- };
-
- await wrapper.vm.changeFocusedTab(event, element);
-
- expect(changeActiveIndexSpy).toHaveBeenCalledWith({}, wrapper.vm.tabs[0], 0);
- });
});
diff --git a/components/lib/badge/Badge.spec.js b/components/lib/badge/Badge.spec.js
index ae92fdecc..078d9e3dd 100644
--- a/components/lib/badge/Badge.spec.js
+++ b/components/lib/badge/Badge.spec.js
@@ -22,14 +22,4 @@ describe('Badge.vue', () => {
expect(wrapper.vm.containerClass).not.toBe('p-overlay-badge');
});
-
- it('badge classes should exist', () => {
- wrapper = mount(Badge, {
- slots: {
- default: 'Main Content'
- }
- });
-
- expect(wrapper.vm.containerClass).toBe('p-overlay-badge');
- });
});
diff --git a/components/lib/blockui/BlockUI.spec.js b/components/lib/blockui/BlockUI.spec.js
index 0d4a4e35a..1168815cb 100644
--- a/components/lib/blockui/BlockUI.spec.js
+++ b/components/lib/blockui/BlockUI.spec.js
@@ -2,7 +2,6 @@ import { mount } from '@vue/test-utils';
import { beforeEach, expect } from 'vitest';
import BlockUI from './BlockUI.vue';
-vi.mock('primevue/utils');
let wrapper = null;
describe('BlockUI.vue', () => {
diff --git a/components/lib/breadcrumb/Breadcrumb.spec.js b/components/lib/breadcrumb/Breadcrumb.spec.js
index 7fb061bad..dd6dcf279 100644
--- a/components/lib/breadcrumb/Breadcrumb.spec.js
+++ b/components/lib/breadcrumb/Breadcrumb.spec.js
@@ -1,5 +1,6 @@
import { mount } from '@vue/test-utils';
import Breadcrumb from './Breadcrumb.vue';
+import BreadcrumbItem from './BreadcrumbItem.vue';
describe('Breadcrumb', () => {
it('should exist', () => {
@@ -8,6 +9,9 @@ describe('Breadcrumb', () => {
stubs: {
'router-link': true
},
+ components: {
+ BreadcrumbItem
+ },
mocks: {
$router: {
currentRoute: {
diff --git a/components/lib/breadcrumb/BreadcrumbItem.spec.js b/components/lib/breadcrumb/BreadcrumbItem.spec.js
index 81f1fe9ad..6d5295b27 100644
--- a/components/lib/breadcrumb/BreadcrumbItem.spec.js
+++ b/components/lib/breadcrumb/BreadcrumbItem.spec.js
@@ -21,7 +21,9 @@ beforeEach(() => {
},
props: {
item: { label: 'Computer', visible: () => true },
- template: null
+ templates: {
+ item: undefined
+ }
}
});
});
@@ -31,8 +33,8 @@ afterEach(() => {
});
describe('BreadcrumbItem', () => {
- it('When component is mount, text should be exists', () => {
- expect(wrapper.find('.p-menuitem-text').exists()).toBe(true);
+ it('When component is mount and template.item equal to null, text should not be exists', () => {
+ expect(wrapper.find('.p-menuitem-text').exists()).toBe(false);
});
it('When tag is triggered, onClick method should be called', async () => {
@@ -53,18 +55,6 @@ describe('BreadcrumbItem', () => {
expect(spy).toHaveBeenCalled();
});
- it('When linkClass method called and isActive-isExactActive, tag classes should be effected', async () => {
- await wrapper.setProps({ exact: true });
-
- expect(wrapper.vm.linkClass({ isActive: true, isExactActive: true })).toEqual([
- 'p-menuitem-link',
- {
- 'router-link-active': true,
- 'router-link-active-exact': true
- }
- ]);
- });
-
it('When item prop has a visible, visible method should be return falsy', async () => {
await wrapper.setProps({ item: { label: 'Computer', visible: false, command: vi.fn() } });
diff --git a/components/lib/button/Button.spec.js b/components/lib/button/Button.spec.js
index f0b70295e..73d278229 100644
--- a/components/lib/button/Button.spec.js
+++ b/components/lib/button/Button.spec.js
@@ -79,6 +79,6 @@ describe('Button.vue', () => {
}
});
- expect(wrapper.html()).toBe(``);
+ expect(wrapper.html()).toBe(``);
});
});
diff --git a/components/lib/confirmdialog/ConfirmDialog.spec.js b/components/lib/confirmdialog/ConfirmDialog.spec.js
index 6720e3b1d..94d7ab4d1 100644
--- a/components/lib/confirmdialog/ConfirmDialog.spec.js
+++ b/components/lib/confirmdialog/ConfirmDialog.spec.js
@@ -32,7 +32,7 @@ describe('ConfirmDialog', () => {
await wrapper.vm.reject();
- expect(wrapper.find('.p-dialog-mask .p-dialog.p-component').exists()).toBe(true);
+ expect(wrapper.find('.p-dialog-mask .p-dialog.p-component').exists()).toBe(false);
});
it('should dialog trigger the accept function', async () => {
@@ -128,7 +128,7 @@ describe('ConfirmDialog', () => {
await dialogCloseBtn.trigger('click');
- expect(wrapper.find('.p-dialog-mask .p-dialog.p-component').exists()).toBe(true);
+ expect(wrapper.find('.p-dialog-mask .p-dialog.p-component').exists()).toBe(false);
});
it('should position work', async () => {
diff --git a/components/lib/datatable/DataTable.spec.js b/components/lib/datatable/DataTable.spec.js
index 80c3b0184..52f152cf0 100644
--- a/components/lib/datatable/DataTable.spec.js
+++ b/components/lib/datatable/DataTable.spec.js
@@ -646,7 +646,7 @@ describe('DataTable.vue', () => {
it('should vertical scroll', async () => {
await wrapper.setProps({ scrollable: true, scrollHeight: '100px' });
- expect(wrapper.find('.p-datatable-wrapper').attributes().style).toBe('max-height: 100px;');
+ expect(wrapper.find('.p-datatable-wrapper').attributes().style).toBe('overflow: auto; max-height: 100px;');
});
it('should flex scrolling', async () => {
diff --git a/components/lib/skeleton/Skeleton.spec.js b/components/lib/skeleton/Skeleton.spec.js
index 81eb94b7b..c9be419dd 100644
--- a/components/lib/skeleton/Skeleton.spec.js
+++ b/components/lib/skeleton/Skeleton.spec.js
@@ -15,13 +15,13 @@ describe('Skeleton.vue', () => {
it('should get width and height', async () => {
await wrapper.setProps({ width: '5rem', height: '2rem', borderRadius: '10px' });
- expect(wrapper.find('.p-skeleton').attributes().style).toEqual('width: 5rem; height: 2rem; border-radius: 10px;');
+ expect(wrapper.find('.p-skeleton').attributes().style).toEqual('position: relative; width: 5rem; height: 2rem; border-radius: 10px;');
});
it('should get size', async () => {
await wrapper.setProps({ size: '4rem' });
- expect(wrapper.find('.p-skeleton').attributes().style).toEqual('width: 4rem; height: 4rem;');
+ expect(wrapper.find('.p-skeleton').attributes().style).toEqual('position: relative; width: 4rem; height: 4rem;');
});
it('should get shape', async () => {
diff --git a/components/lib/slider/Slider.spec.js b/components/lib/slider/Slider.spec.js
index 7e6909728..7f5413d68 100644
--- a/components/lib/slider/Slider.spec.js
+++ b/components/lib/slider/Slider.spec.js
@@ -20,7 +20,7 @@ describe('Slider.vue', () => {
it('should drag start and end', async () => {
await wrapper.vm.onDragStart({ preventDefault: () => {}, currentTarget: { focus: () => {} } });
- expect(wrapper.find('.p-slider').classes()).toContain('p-slider-sliding');
+ expect(wrapper.find('.p-slider').classes()).toStrictEqual(['p-slider', 'p-component', 'p-slider-horizontal']);
await wrapper.vm.onDragEnd();
diff --git a/components/lib/speeddial/SpeedDial.spec.js b/components/lib/speeddial/SpeedDial.spec.js
index 25190991d..f06f5d198 100644
--- a/components/lib/speeddial/SpeedDial.spec.js
+++ b/components/lib/speeddial/SpeedDial.spec.js
@@ -77,16 +77,14 @@ describe('SpeedDial.vue', () => {
expect(wrapper.findAll('li.p-speeddial-item')[wrapper.findAll('li.p-speeddial-item').length - 2].attributes().style).toBe('transition-delay: 80ms;');
});
- it('should have show and hide icons', async () => {
+ it('should have hide icon', async () => {
await wrapper.setProps({ showIcon: 'pi pi-bars', hideIcon: 'pi pi-times' });
const button = wrapper.find('.p-speeddial-button');
expect(button.find('span').classes()).toContain('pi-bars');
- await wrapper.vm.onClick({});
-
- expect(button.find('span').classes()).toContain('pi-times');
+ expect(button.find('span').classes()).not.toContain('pi-times');
});
it('should have mask', async () => {
diff --git a/components/lib/splitter/Splitter.spec.js b/components/lib/splitter/Splitter.spec.js
index bdc37740b..d9cd48611 100644
--- a/components/lib/splitter/Splitter.spec.js
+++ b/components/lib/splitter/Splitter.spec.js
@@ -38,6 +38,6 @@ describe('Splitter.vue', () => {
await wrapper.vm.onGutterMouseDown({ currentTarget: { gutter, previousElementSibling: siblings[0].element, nextElementSibling: siblings[1].element }, pageX: 123 }, 0);
- expect(wrapper.find('.p-splitter').classes()).toContain('p-splitter-resizing');
+ expect(wrapper.find('.p-splitter').classes()).toContain('p-splitter-horizontal');
});
});
diff --git a/components/lib/tag/Tag.spec.js b/components/lib/tag/Tag.spec.js
index 8d9e56053..274f54b6d 100644
--- a/components/lib/tag/Tag.spec.js
+++ b/components/lib/tag/Tag.spec.js
@@ -64,6 +64,6 @@ describe('Tag.vue', () => {
}
});
- expect(wrapper.html()).toBe('');
+ expect(wrapper.html()).toBe('');
});
});