mirror of
https://github.com/primefaces/primevue.git
synced 2025-05-08 16:37:15 +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
88
components/lib/autocomplete/AutoComplete.spec.js
Normal file
88
components/lib/autocomplete/AutoComplete.spec.js
Normal file
|
@ -0,0 +1,88 @@
|
|||
import { mount } from '@vue/test-utils';
|
||||
import PrimeVue from 'primevue/config';
|
||||
import { nextTick } from 'vue';
|
||||
import AutoComplete from './AutoComplete.vue';
|
||||
|
||||
describe('AutoComplete.vue', () => {
|
||||
let wrapper;
|
||||
|
||||
beforeEach(async () => {
|
||||
wrapper = mount(AutoComplete, {
|
||||
global: {
|
||||
plugins: [PrimeVue],
|
||||
stubs: {
|
||||
teleport: true
|
||||
}
|
||||
},
|
||||
props: {
|
||||
suggestions: null,
|
||||
field: 'name'
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
countries: [
|
||||
{ name: 'Afghanistan', code: 'AF' },
|
||||
{ name: 'Bahrain', code: 'BH' },
|
||||
{ name: 'Chile', code: 'CL' },
|
||||
{ name: 'Denmark', code: 'DK' }
|
||||
]
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
await wrapper.trigger('click');
|
||||
});
|
||||
|
||||
it('should exists', () => {
|
||||
expect(wrapper.find('.p-autocomplete.p-component').exists()).toBe(true);
|
||||
expect(wrapper.find('.p-autocomplete-input').exists()).toBe(true);
|
||||
});
|
||||
|
||||
it('search complete', async () => {
|
||||
const event = { target: { value: 'b' } };
|
||||
|
||||
wrapper.vm.onInput(event);
|
||||
await wrapper.vm.$nextTick();
|
||||
|
||||
wrapper.vm.search(event, event.target.value, 'input');
|
||||
await wrapper.vm.$nextTick();
|
||||
|
||||
await wrapper.setProps({
|
||||
suggestions: [{ name: 'Bahrain', code: 'BH' }]
|
||||
});
|
||||
|
||||
expect(wrapper.find('.p-autocomplete-items').exists()).toBe(true);
|
||||
expect(wrapper.findAll('.p-autocomplete-item').length).toBe(1);
|
||||
});
|
||||
|
||||
describe('dropdown', () => {
|
||||
it('should have correct custom icon', async () => {
|
||||
wrapper.setProps({
|
||||
dropdown: true,
|
||||
dropdownIcon: 'pi pi-discord'
|
||||
});
|
||||
|
||||
await nextTick();
|
||||
|
||||
const token = wrapper.find('.p-button-icon');
|
||||
|
||||
expect(token.classes()).toContain('pi-discord');
|
||||
});
|
||||
});
|
||||
|
||||
describe('multiple', () => {
|
||||
it('should have correct custom icon', async () => {
|
||||
wrapper.setProps({
|
||||
multiple: true,
|
||||
removeTokenIcon: 'pi pi-discord',
|
||||
modelValue: ['foo', 'bar']
|
||||
});
|
||||
|
||||
await nextTick();
|
||||
|
||||
wrapper.findAll('.p-autocomplete-token-icon').forEach((tokenIcon) => {
|
||||
expect(tokenIcon.classes()).toContain('pi-discord');
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue