primevue-mirror/components/panel/Panel.spec.js

34 lines
1.1 KiB
JavaScript
Raw Normal View History

2022-09-06 12:03:37 +00:00
import { mount } from '@vue/test-utils';
import Panel from './Panel.vue';
describe('Panel.vue', () => {
let wrapper;
beforeEach(() => {
wrapper = mount(Panel, {
props: {
header: 'PrimeVue'
},
slots: {
default: '<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt</p>'
}
});
});
it('should exist', () => {
expect(wrapper.find('.p-panel.p-component').exists()).toBe(true);
expect(wrapper.find('.p-panel-content').text()).toBe('Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt');
expect(wrapper.find('.p-panel-title').text()).toBe('PrimeVue');
});
it('should be toggleable', async () => {
await wrapper.setProps({ toggleable: true });
expect(wrapper.find('.p-panel.p-component').classes()).toContain('p-panel-toggleable');
await wrapper.vm.toggle({});
2022-09-14 11:26:01 +00:00
expect(wrapper.emitted().toggle[0]).toEqual([{ originalEvent: {}, value: true }]);
2022-09-06 12:03:37 +00:00
});
2022-09-14 11:26:01 +00:00
});