From 99879e50fb16075f79fffbf598b211495f79e2dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tu=C4=9F=C3=A7e=20K=C3=BC=C3=A7=C3=BCko=C4=9Flu?= Date: Thu, 10 Mar 2022 13:39:23 +0300 Subject: [PATCH] Update Dialog.spec.js --- src/components/dialog/Dialog.spec.js | 44 +++++++++++++++++++++++++--- 1 file changed, 40 insertions(+), 4 deletions(-) diff --git a/src/components/dialog/Dialog.spec.js b/src/components/dialog/Dialog.spec.js index 86f7df3c9..fc6cd874e 100644 --- a/src/components/dialog/Dialog.spec.js +++ b/src/components/dialog/Dialog.spec.js @@ -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: '

Lorem ipsum dolor sit amet, consectetur adipiscing elit

', + footer: '

Dialog Footer

' + } + }); + + expect(wrapper.find('.p-dialog-content').exists()).toBe(true); + expect(wrapper.find('.p-dialog-footer').exists()).toBe(true); + }); }); \ No newline at end of file