primevue-mirror/components/lib/skeleton/Skeleton.spec.js

39 lines
1.2 KiB
JavaScript
Raw Normal View History

2022-09-06 12:03:37 +00:00
import { mount } from '@vue/test-utils';
import Skeleton from './Skeleton.vue';
describe('Skeleton.vue', () => {
let wrapper;
2022-09-14 11:26:01 +00:00
2022-09-06 12:03:37 +00:00
beforeEach(() => {
wrapper = mount(Skeleton);
});
it('should exist', () => {
expect(wrapper.find('.p-skeleton.p-component').exists()).toBe(true);
});
it('should get width and height', async () => {
await wrapper.setProps({ width: '5rem', height: '2rem', borderRadius: '10px' });
2023-08-31 09:46:08 +00:00
expect(wrapper.find('.p-skeleton').attributes().style).toEqual('position: relative; width: 5rem; height: 2rem; border-radius: 10px;');
2022-09-06 12:03:37 +00:00
});
it('should get size', async () => {
await wrapper.setProps({ size: '4rem' });
2023-08-31 09:46:08 +00:00
expect(wrapper.find('.p-skeleton').attributes().style).toEqual('position: relative; width: 4rem; height: 4rem;');
2022-09-06 12:03:37 +00:00
});
it('should get shape', async () => {
await wrapper.setProps({ shape: 'circle' });
expect(wrapper.find('.p-skeleton').classes()).toContain('p-skeleton-circle');
});
it('should remove animation', async () => {
await wrapper.setProps({ animation: 'none' });
expect(wrapper.find('.p-skeleton').classes()).toContain('p-skeleton-none');
});
});