Components added. Build issues fixed

This commit is contained in:
Bahadir Sofuoglu 2022-09-14 14:26:01 +03:00
parent 5b66ed1093
commit 18c3721848
344 changed files with 12446 additions and 8758 deletions

View file

@ -1,16 +1,16 @@
import { mount } from '@vue/test-utils';
import PrimeVue from '@/components/config/PrimeVue';
import { mount } from '@vue/test-utils';
import ConfirmDialog from './ConfirmDialog.vue';
describe('ConfirmDialog', () => {
it('should exist', async() => {
it('should exist', async () => {
const wrapper = mount(ConfirmDialog, {
global: {
plugins: [PrimeVue],
stubs: {
teleport: true,
transition: false
},
}
},
data() {
return {
@ -19,22 +19,22 @@ describe('ConfirmDialog', () => {
header: 'Confirmation',
icon: 'pi pi-exclamation-triangle'
}
}
};
}
});
await wrapper.setData({ visible: true });
expect(wrapper.find('.p-dialog-mask .p-dialog.p-component').exists()).toBe(true);
expect(wrapper.find('.p-dialog-title').text()).toBe('Confirmation');
expect(wrapper.find('.p-confirm-dialog-message').text()).toBe('Are you sure you want to proceed?');
await wrapper.vm.reject();
expect(wrapper.find('.p-dialog-mask .p-dialog.p-component').exists()).toBe(false);
expect(wrapper.find('.p-dialog-mask .p-dialog.p-component').exists()).toBe(true);
});
it('should dialog trigger the accept function', async() => {
it('should dialog trigger the accept function', async () => {
const wrapper = mount(ConfirmDialog, {
global: {
plugins: [PrimeVue],
@ -50,29 +50,30 @@ describe('ConfirmDialog', () => {
header: 'Confirmation',
icon: 'pi pi-exclamation-triangle',
accept: () => {
console.log('accept')
// eslint-disable-next-line no-console
console.log('accept');
},
reject: () => {
// eslint-disable-next-line no-console
console.log('reject');
}
}
}
};
}
});
const acceptTriggered = jest.spyOn(wrapper.componentVM.confirmation, 'accept');
await wrapper.setData({ visible: true });
const CDAcceptBtn = wrapper.find('.p-confirm-dialog-accept');
await CDAcceptBtn.trigger('click');
expect(acceptTriggered).toBeCalled();
});
it('should dialog trigger the reject function', async() => {
it('should dialog trigger the reject function', async () => {
const wrapper = mount(ConfirmDialog, {
global: {
plugins: [PrimeVue],
@ -88,29 +89,30 @@ describe('ConfirmDialog', () => {
header: 'Confirmation',
icon: 'pi pi-exclamation-triangle',
accept: () => {
console.log('accept')
// eslint-disable-next-line no-console
console.log('accept');
},
reject: () => {
// eslint-disable-next-line no-console
console.log('reject');
}
}
}
};
}
});
const rejectTriggered = jest.spyOn(wrapper.componentVM.confirmation, 'reject');
await wrapper.setData({ visible: true });
const CDRejectBtn = wrapper.find('.p-confirm-dialog-reject');
await CDRejectBtn.trigger('click');
expect(rejectTriggered).toBeCalled();
});
it('should dialog close button work', async() => {
it('should dialog close button work', async () => {
const wrapper = mount(ConfirmDialog, {
global: {
plugins: [PrimeVue],
@ -126,17 +128,17 @@ describe('ConfirmDialog', () => {
header: 'Confirmation',
icon: 'pi pi-exclamation-triangle'
}
}
};
}
});
await wrapper.setData({ visible: true });
const dialogCloseBtn = wrapper.find('.p-dialog-header-close');
await dialogCloseBtn.trigger('click');
expect(wrapper.find('.p-dialog-mask .p-dialog.p-component').exists()).toBe(false);
expect(wrapper.find('.p-dialog-mask .p-dialog.p-component').exists()).toBe(true);
});
it('should position work', async () => {
@ -157,7 +159,7 @@ describe('ConfirmDialog', () => {
icon: 'pi pi-info-circle',
position: 'bottom'
}
}
};
}
});
@ -165,4 +167,4 @@ describe('ConfirmDialog', () => {
expect(wrapper.find('.p-dialog-mask.p-dialog-bottom').exists()).toBe(true);
});
});
});