primevue-mirror/components/badge/Badge.spec.js

36 lines
1005 B
JavaScript
Raw Normal View History

2022-09-06 12:03:37 +00:00
import { mount } from '@vue/test-utils';
2022-12-29 08:26:54 +00:00
import { expect } from 'vitest';
2022-09-06 12:03:37 +00:00
import Badge from './Badge.vue';
2022-12-29 08:26:54 +00:00
let wrapper = null;
2022-09-06 12:03:37 +00:00
describe('Badge.vue', () => {
2022-12-29 08:26:54 +00:00
beforeEach(() => {
wrapper = mount(Badge, {
2022-09-06 12:03:37 +00:00
props: {
value: '29',
severity: 'warning',
size: 'large'
}
});
2022-12-29 08:26:54 +00:00
});
it('should exist', () => {
2022-09-06 12:03:37 +00:00
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);
2022-12-29 08:26:54 +00:00
expect(wrapper.vm.containerClass).not.toBe('p-overlay-badge');
2022-09-06 12:03:37 +00:00
});
it('badge classes should exist', () => {
2022-12-29 08:26:54 +00:00
wrapper = mount(Badge, {
slots: {
default: 'Main Content'
2022-09-06 12:03:37 +00:00
}
});
2022-12-29 08:26:54 +00:00
expect(wrapper.vm.containerClass).toBe('p-overlay-badge');
2022-09-06 12:03:37 +00:00
});
2022-09-14 11:26:01 +00:00
});