mirror of
https://github.com/primefaces/primevue.git
synced 2025-05-09 00:42:36 +00:00
Fixed #3802 - Improve folder structure for nuxt configurations
This commit is contained in:
parent
851950270b
commit
f5fe822afb
563 changed files with 1703 additions and 1095 deletions
48
components/lib/chip/Chip.spec.js
Normal file
48
components/lib/chip/Chip.spec.js
Normal file
|
@ -0,0 +1,48 @@
|
|||
import { mount } from '@vue/test-utils';
|
||||
import Chip from './Chip.vue';
|
||||
|
||||
describe('Chip.vue', () => {
|
||||
let wrapper;
|
||||
|
||||
beforeEach(() => {
|
||||
wrapper = mount(Chip, {
|
||||
props: {
|
||||
label: 'PrimeVue',
|
||||
icon: 'pi pi-primevue',
|
||||
removable: true
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
vi.restoreAllMocks();
|
||||
});
|
||||
|
||||
it('should exists', () => {
|
||||
expect(wrapper.find('.p-chip.p-component').exists()).toBe(true);
|
||||
expect(wrapper.find('.p-chip-icon').classes()).toContain('pi-primevue');
|
||||
expect(wrapper.find('.p-chip-text').text()).toBe('PrimeVue');
|
||||
expect(wrapper.find('.p-chip-remove-icon').exists()).toBe(true);
|
||||
});
|
||||
|
||||
it('should close icon work', async () => {
|
||||
await wrapper.find('.p-chip-remove-icon').trigger('click');
|
||||
|
||||
expect(wrapper.find('.p-chip.p-component').exists()).toBe(false);
|
||||
});
|
||||
|
||||
it('When removable is true and keydown triggered OnKeydown method should be called', async () => {
|
||||
const closeSpy = vi.spyOn(wrapper.vm, 'onKeydown');
|
||||
|
||||
await wrapper.find('.p-chip-remove-icon').trigger('keydown');
|
||||
|
||||
expect(closeSpy).toHaveBeenCalled();
|
||||
});
|
||||
it('When onKeyDown method triggered close method should be called', async () => {
|
||||
const closeSpy = vi.spyOn(wrapper.vm, 'close');
|
||||
|
||||
await wrapper.vm.onKeydown({ key: 'Enter' });
|
||||
|
||||
expect(closeSpy).toHaveBeenCalled();
|
||||
});
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue