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

47 lines
1.3 KiB
JavaScript
Raw Normal View History

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