mirror of
https://github.com/primefaces/primevue.git
synced 2025-05-10 17:32:36 +00:00
Styles imported. Components added
This commit is contained in:
parent
3cb3910561
commit
8264983db4
452 changed files with 55902 additions and 0 deletions
45
components/rating/Rating.spec.js
Normal file
45
components/rating/Rating.spec.js
Normal file
|
@ -0,0 +1,45 @@
|
|||
import { mount } from '@vue/test-utils';
|
||||
import Rating from './Rating.vue';
|
||||
|
||||
describe('Rating.vue', () => {
|
||||
let wrapper;
|
||||
|
||||
beforeEach(() => {
|
||||
wrapper = mount(Rating);
|
||||
});
|
||||
|
||||
it('should exist', () => {
|
||||
expect(wrapper.find('.p-rating').exists()).toBe(true);
|
||||
expect(wrapper.find('.p-rating-icon').exists()).toBe(true);
|
||||
});
|
||||
|
||||
it('should update model', async () => {
|
||||
await wrapper.vm.updateModel({}, 5);
|
||||
|
||||
expect(wrapper.emitted()['update:modelValue'][0]).toEqual([5]);
|
||||
expect(wrapper.emitted()['change'][0]).toEqual([{originalEvent: {}, value: 5}]);
|
||||
});
|
||||
|
||||
it('should click', async () => {
|
||||
await wrapper.vm.onStarClick({}, 1);
|
||||
|
||||
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]);
|
||||
});
|
||||
|
||||
it('should not cancel', async () => {
|
||||
await wrapper.setProps({ cancel: false });
|
||||
|
||||
expect(wrapper.find('.p-rating-cancel').exists()).toBe(false);
|
||||
});
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue