2022-09-06 12:03:37 +00:00
|
|
|
import { mount } from '@vue/test-utils';
|
2022-12-08 11:04:25 +00:00
|
|
|
import PrimeVue from 'primevue/config';
|
2022-09-06 12:03:37 +00:00
|
|
|
import Image from './Image.vue';
|
|
|
|
|
|
|
|
describe('Image.vue', () => {
|
|
|
|
it('should exist', () => {
|
|
|
|
const wrapper = mount(Image, {
|
|
|
|
global: {
|
2022-12-08 11:04:25 +00:00
|
|
|
plugins: [PrimeVue],
|
2022-09-06 12:03:37 +00:00
|
|
|
stubs: {
|
|
|
|
teleport: true
|
|
|
|
}
|
|
|
|
},
|
|
|
|
props: {
|
2023-02-06 14:59:12 +00:00
|
|
|
src: 'images/galleria/galleria1.jpg'
|
2022-09-06 12:03:37 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
expect(wrapper.find('.p-image.p-component').exists()).toBe(true);
|
2023-02-06 14:59:12 +00:00
|
|
|
expect(wrapper.find('.p-image.p-component img').attributes().src).toBe('images/galleria/galleria1.jpg');
|
2022-09-06 12:03:37 +00:00
|
|
|
});
|
|
|
|
|
2022-09-14 11:26:01 +00:00
|
|
|
it('should preview', async () => {
|
2022-09-06 12:03:37 +00:00
|
|
|
const wrapper = mount(Image, {
|
|
|
|
global: {
|
2022-12-08 11:04:25 +00:00
|
|
|
plugins: [PrimeVue],
|
2022-09-06 12:03:37 +00:00
|
|
|
stubs: {
|
|
|
|
teleport: true
|
|
|
|
}
|
|
|
|
},
|
|
|
|
props: {
|
2023-02-06 14:59:12 +00:00
|
|
|
src: 'images/galleria/galleria1.jpg',
|
2022-09-06 12:03:37 +00:00
|
|
|
preview: true
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2024-08-01 19:20:37 +00:00
|
|
|
expect(wrapper.find('.p-image-preview').exists()).toBe(true);
|
|
|
|
expect(wrapper.find('.p-image-toolbar').exists()).toBe(false);
|
|
|
|
expect(wrapper.find('.p-image-preview-mask').exists()).toBe(true);
|
2022-09-06 12:03:37 +00:00
|
|
|
|
2022-09-14 11:26:01 +00:00
|
|
|
await wrapper.setData({ maskVisible: true });
|
2022-09-06 12:03:37 +00:00
|
|
|
|
|
|
|
expect(wrapper.find('.p-image-mask').exists()).toBe(true);
|
|
|
|
expect(wrapper.find('.p-image-toolbar').exists()).toBe(true);
|
|
|
|
});
|
2022-09-14 11:26:01 +00:00
|
|
|
});
|