Components added. Build issues fixed

This commit is contained in:
Bahadir Sofuoglu 2022-09-14 14:26:01 +03:00
parent 5b66ed1093
commit 18c3721848
344 changed files with 12446 additions and 8758 deletions

View file

@ -1,6 +1,17 @@
import { mount } from '@vue/test-utils';
import { config, mount } from '@vue/test-utils';
import Rating from './Rating.vue';
config.global.mocks = {
$primevue: {
config: {
locale: {
aria: {
stars: '5'
}
}
}
}
};
describe('Rating.vue', () => {
let wrapper;
@ -17,24 +28,14 @@ describe('Rating.vue', () => {
await wrapper.vm.updateModel({}, 5);
expect(wrapper.emitted()['update:modelValue'][0]).toEqual([5]);
expect(wrapper.emitted()['change'][0]).toEqual([{originalEvent: {}, value: 5}]);
expect(wrapper.emitted()['change'][0]).toEqual([{ originalEvent: {}, value: 5 }]);
});
it('should click', async () => {
await wrapper.vm.onStarClick({}, 1);
it('when onBlur method triggered blur emitted with parameter', async () => {
await wrapper.vm.onBlur(true);
expect(wrapper.emitted()['update:modelValue'][0]).toEqual([1]);
await wrapper.setProps({ modelValue: 1 });
expect(wrapper.findAll('.p-rating-icon')[1].classes()).toContain('pi-star-fill');
expect(wrapper.findAll('.p-rating-icon')[2].classes()).not.toContain('pi-star-fill');
});
it('should cancel', async () => {
await wrapper.vm.onCancelClick({});
expect(wrapper.emitted()['update:modelValue'][0]).toEqual([null]);
expect(wrapper.vm.focusedOptionIndex).toEqual(-1);
expect(wrapper.emitted()['blur'][0]).toEqual([true]);
});
it('should not cancel', async () => {
@ -42,4 +43,4 @@ describe('Rating.vue', () => {
expect(wrapper.find('.p-rating-cancel').exists()).toBe(false);
});
});
});