- fix OrderList.spec.js, OrganizationChart.spec.js

pull/6170/head
uros 2024-08-01 19:14:29 +02:00
parent 305752ef3c
commit 30afab8178
2 changed files with 10 additions and 10 deletions

View File

@ -113,21 +113,21 @@ describe('OrderList.vue', () => {
it('should exist', () => {
expect(wrapper.find('.p-orderlist.p-component').exists()).toBe(true);
expect(wrapper.find('.p-orderlist-controls').exists()).toBe(true);
expect(wrapper.findAll('li.p-orderlist-item').length).toBe(6);
expect(wrapper.findAll('li.p-listbox-option').length).toBe(6);
});
it('should select item', async () => {
await wrapper.vm.onItemClick({}, wrapper.vm.modelValue[0], 0);
const listBoxOption = wrapper.find('li.p-listbox-option');
expect(wrapper.emitted()['update:selection'][0]).toEqual([[wrapper.vm.modelValue[0]]]);
expect(listBoxOption.classes()).not.toContain('p-listbox-option-selected');
await wrapper.setProps({ selection: [wrapper.vm.modelValue[0]] });
await listBoxOption.trigger('click');
expect(wrapper.findAll('li.p-orderlist-item')[0].classes()).toContain('p-highlight');
expect(wrapper.findAll('li.p-listbox-option')[0].classes()).toContain('p-listbox-option-selected');
});
it('should slot works', () => {
expect(wrapper.find('.p-orderlist-header').text()).toBe('List of Products');
expect(wrapper.find('.p-listbox-header').text()).toBe('List of Products');
expect(wrapper.findAll('.product-item').length).toBe(6);
});
@ -135,7 +135,7 @@ describe('OrderList.vue', () => {
await wrapper.setProps({ selection: [wrapper.vm.modelValue[2]] });
await wrapper.setData({ d_selection: [wrapper.vm.modelValue[2]] });
expect(wrapper.findAll('li.p-orderlist-item')[2].classes()).toContain('p-highlight');
expect(wrapper.findAll('li.p-listbox-option')[2].classes()).toContain('p-listbox-option-selected');
await wrapper.vm.moveUp({});

View File

@ -123,7 +123,7 @@ describe('OrganizationChart.vue', () => {
it('should exist', () => {
expect(wrapper.find('.p-organizationchart.p-component').exists()).toBe(true);
expect(wrapper.find('table.p-organizationchart-table').exists()).toBe(true);
expect(wrapper.findAll('.p-node-toggler-icon').length).toBe(5);
expect(wrapper.findAll('.p-organizationchart-node-toggle-button').length).toBe(5);
});
it('should collapsed and expand', async () => {
@ -141,7 +141,7 @@ describe('OrganizationChart.vue', () => {
});
it('should item select and unselect', async () => {
const contents = wrapper.findAll('.p-organizationchart-node-content');
const contents = wrapper.findAll('.p-organizationchart-node.p-organizationchart-node-selectable');
await wrapper.vm.onNodeClick(wrapper.vm.value);
@ -150,7 +150,7 @@ describe('OrganizationChart.vue', () => {
await wrapper.setProps({ selectionKeys: { 0: true } });
expect(contents[0].classes()).toContain('p-highlight');
expect(contents[0].classes()).toContain('p-organizationchart-node-selected');
await wrapper.vm.onNodeClick(wrapper.vm.value);