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
65
components/lib/listbox/Listbox.spec.js
Normal file
65
components/lib/listbox/Listbox.spec.js
Normal file
|
@ -0,0 +1,65 @@
|
|||
import { config, mount } from '@vue/test-utils';
|
||||
import Listbox from './Listbox.vue';
|
||||
|
||||
config.global.mocks = {
|
||||
$primevue: {
|
||||
config: {
|
||||
locale: {
|
||||
aria: {
|
||||
trueLabel: 'trueLabel',
|
||||
falseLabel: 'falseLabel',
|
||||
nullLabel: 'nullLabel'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
describe('Listbox.vue', () => {
|
||||
let wrapper;
|
||||
|
||||
beforeEach(() => {
|
||||
wrapper = mount(Listbox, {
|
||||
props: {
|
||||
modelValue: null,
|
||||
options: [
|
||||
{ name: 'New York', code: 'NY' },
|
||||
{ name: 'Rome', code: 'RM' },
|
||||
{ name: 'London', code: 'LDN' },
|
||||
{ name: 'Istanbul', code: 'IST' },
|
||||
{ name: 'Paris', code: 'PRS' }
|
||||
],
|
||||
optionLabel: 'name'
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
it('should exist', () => {
|
||||
expect(wrapper.find('.p-listbox.p-component').exists()).toBe(true);
|
||||
expect(wrapper.findAll('li.p-listbox-item').length).toBe(5);
|
||||
expect(wrapper.findAll('li.p-listbox-item')[0].attributes()['aria-label']).toBe('New York');
|
||||
});
|
||||
|
||||
it('should select a list item', async () => {
|
||||
await wrapper.vm.onOptionSelect({}, wrapper.vm.options[0]);
|
||||
|
||||
expect(wrapper.emitted()['update:modelValue'][0]).toEqual([wrapper.vm.options[0]]);
|
||||
|
||||
await wrapper.setProps({ modelValue: wrapper.vm.options[0] });
|
||||
|
||||
expect(wrapper.findAll('li.p-listbox-item')[0].classes()).toContain('p-highlight');
|
||||
});
|
||||
|
||||
describe('filter', () => {
|
||||
it('should have correct custom icon', async () => {
|
||||
await wrapper.setProps({
|
||||
filter: true,
|
||||
filterIcon: 'pi pi-discord'
|
||||
});
|
||||
|
||||
const icon = wrapper.find('.p-listbox-filter-icon');
|
||||
|
||||
expect(icon.classes()).toContain('pi-discord');
|
||||
});
|
||||
});
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue