primevue-mirror/components/badge/Badge.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';
2022-12-08 14:13:16 +00:00
import Button from 'primevue/button';
2022-09-06 12:03:37 +00:00
import Badge from './Badge.vue';
describe('Badge.vue', () => {
it('should exist', () => {
const wrapper = mount(Badge, {
props: {
value: '29',
severity: 'warning',
size: 'large'
}
});
expect(wrapper.find('.p-badge.p-component').exists()).toBe(true);
expect(wrapper.find('.p-badge-warning').exists()).toBe(true);
expect(wrapper.find('.p-badge-lg').exists()).toBe(true);
expect(wrapper.find('.p-badge-no-gutter').exists()).toBe(false);
});
it('badge classes should exist', () => {
const wrapper = mount({
template: '<Button type="button" label="Messages" icon="pi pi-users" class="p-button-warning" badge="8" badgeClass="p-badge-danger" />',
components: {
Button
}
});
expect(wrapper.find('.p-badge.p-component').exists()).toBe(true);
expect(wrapper.find('.p-badge-danger').exists()).toBe(true);
expect(wrapper.find('.p-badge-no-gutter').exists()).toBe(true);
});
2022-09-14 11:26:01 +00:00
});