Update Dialog.spec.js

pull/2305/head
Tuğçe Küçükoğlu 2022-03-10 13:39:23 +03:00 committed by Tuğçe Küçükoğlu
parent 22120a9933
commit 99879e50fb
1 changed files with 40 additions and 4 deletions

View File

@ -1,10 +1,46 @@
import { mount } from '@vue/test-utils';
import Dialog from '@/components/dialog/Dialog.vue';
import PrimeVue from '@/components/config/PrimeVue';
import Dialog from './Dialog.vue';
describe('Dialog.vue', () => {
it('is Dialog element exist', () => {
const wrapper = mount(Dialog);
it('is Dialog element exist', async() => {
const wrapper = mount(Dialog, {
global: {
plugins: [PrimeVue],
stubs: {
teleport: true
}
},
props: {
visible: false
}
});
expect(wrapper.find('.p-dialog.p-component').exists()).toBe(false);
})
await wrapper.setProps({ visible: true });
expect(wrapper.find('.p-dialog.p-component').exists()).toBe(true);
});
it('slot checks', async() => {
const wrapper = mount(Dialog, {
global: {
plugins: [PrimeVue],
stubs: {
teleport: true
}
},
props: {
visible: true
},
slots: {
default: '<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit</p>',
footer: '<p>Dialog Footer</p>'
}
});
expect(wrapper.find('.p-dialog-content').exists()).toBe(true);
expect(wrapper.find('.p-dialog-footer').exists()).toBe(true);
});
});