primevue-mirror/components/dialog/Dialog.spec.js

47 lines
1.3 KiB
JavaScript

import PrimeVue from '../config/PrimeVue';
import { mount } from '@vue/test-utils';
import Dialog from './Dialog.vue';
describe('Dialog.vue', () => {
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(false);
expect(wrapper.find('.p-dialog-footer').exists()).toBe(false);
});
});