Badge test added
parent
4cfebab5d9
commit
ed76c70d54
|
@ -0,0 +1,33 @@
|
||||||
|
import { mount } from '@vue/test-utils';
|
||||||
|
import Badge from './Badge.vue';
|
||||||
|
import Button from '@/components/button/Button.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);
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,17 @@
|
||||||
|
import { mount } from '@vue/test-utils';
|
||||||
|
import BadgeDirective from './BadgeDirective';
|
||||||
|
|
||||||
|
describe('directive badge should exist', () => {
|
||||||
|
it('positioned badge', () => {
|
||||||
|
const wrapper = mount({
|
||||||
|
template: '<i class="pi pi-bell mr-4 p-text-secondary" style="font-size: 2rem" v-badge="2"></i>',
|
||||||
|
directives: {
|
||||||
|
'badge': BadgeDirective
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(wrapper.find('.p-overlay-badge').exists()).toBe(true);
|
||||||
|
expect(wrapper.find('.p-badge.p-component').exists()).toBe(true);
|
||||||
|
expect(wrapper.find('.p-badge.p-component').text()).toBe('2');
|
||||||
|
});
|
||||||
|
});
|
Loading…
Reference in New Issue