mirror of
https://github.com/primefaces/primevue.git
synced 2025-05-10 17:32:36 +00:00
Components added. Build issues fixed
This commit is contained in:
parent
5b66ed1093
commit
18c3721848
344 changed files with 12446 additions and 8758 deletions
|
@ -3,16 +3,16 @@ import { mount } from '@vue/test-utils';
|
|||
import Button from '@/components/button/Button.vue';
|
||||
|
||||
describe('Button.vue', () => {
|
||||
it('is Button element exist', () => {
|
||||
const wrapper = mount(Button);
|
||||
it('is Button element exist', () => {
|
||||
const wrapper = mount(Button);
|
||||
|
||||
expect(wrapper.find('.p-button.p-component').exists()).toBe(true);
|
||||
expect(wrapper.find('.p-button.p-component').exists()).toBe(true);
|
||||
expect(wrapper.find('.p-button-label').exists()).toBe(true);
|
||||
})
|
||||
});
|
||||
});
|
||||
|
||||
describe('Button.vue', () => {
|
||||
it('is icon exist and right position', () => {
|
||||
it('is icon exist and right position', () => {
|
||||
const icon = 'pi pi-discord';
|
||||
const iconPos = 'right';
|
||||
const label = 'Save';
|
||||
|
@ -23,28 +23,27 @@ describe('Button.vue', () => {
|
|||
props
|
||||
});
|
||||
|
||||
expect(wrapper.find('.p-button-icon-only').exists()).toBe(true);
|
||||
expect(wrapper.find('.p-button-icon-only').exists()).toBe(true);
|
||||
|
||||
wrapper = mount(Button, {
|
||||
props: { ...props, label }
|
||||
});
|
||||
|
||||
expect(wrapper.find('.p-button-icon.p-button-icon-' + iconPos).exists()).toBe(true);
|
||||
})
|
||||
});
|
||||
});
|
||||
|
||||
describe('Button.vue', () => {
|
||||
it('is badge working', () => {
|
||||
const badge = '5';
|
||||
const badgeClass= 'p-badge-danger';
|
||||
const badgeClass = 'p-badge-danger';
|
||||
const wrapper = mount(Button, {
|
||||
props: { badge, badgeClass }
|
||||
});
|
||||
|
||||
|
||||
expect(wrapper.find('.p-badge').text()).toEqual(badge);
|
||||
expect(wrapper.find('.' + badgeClass).exists()).toBe(true);
|
||||
})
|
||||
});
|
||||
});
|
||||
|
||||
describe('Button.vue', () => {
|
||||
|
@ -56,12 +55,12 @@ describe('Button.vue', () => {
|
|||
loadingIcon
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
expect(wrapper.find('.p-disabled').exists()).toBe(false);
|
||||
|
||||
await wrapper.setProps({ loading: true })
|
||||
await wrapper.setProps({ loading: true });
|
||||
const array = loadingIcon.split(' ');
|
||||
const lastIcon = '.' + array.join('.');
|
||||
const lastIcon = '.' + array.join('.');
|
||||
|
||||
expect(wrapper.find('.p-button-loading').exists()).toBe(true);
|
||||
expect(wrapper.find('.p-button-loading-icon' + lastIcon).exists()).toBe(true);
|
||||
|
@ -69,17 +68,17 @@ describe('Button.vue', () => {
|
|||
await wrapper.setProps({ loading: false });
|
||||
|
||||
expect(wrapper.find('.p-button-loading').exists()).toBe(false);
|
||||
})
|
||||
});
|
||||
});
|
||||
|
||||
describe('Button.vue', () => {
|
||||
it('should render default slot', () => {
|
||||
const wrapper = mount(Button, {
|
||||
slots: {
|
||||
default: h('span', {class: 'ml-2 font-bold'}, 'Default PrimeVue Button')
|
||||
default: h('span', { class: 'ml-2 font-bold' }, 'Default PrimeVue Button')
|
||||
}
|
||||
});
|
||||
|
||||
expect(wrapper.html()).toBe('<button class="p-button p-component" type="button"><span class="ml-2 font-bold">Default PrimeVue Button</span></button>');
|
||||
})
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue