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
55
components/lib/selectbutton/SelectButton.spec.js
Normal file
55
components/lib/selectbutton/SelectButton.spec.js
Normal file
|
@ -0,0 +1,55 @@
|
|||
import { mount } from '@vue/test-utils';
|
||||
import SelectButton from './SelectButton.vue';
|
||||
|
||||
describe('SelectButton.vue', () => {
|
||||
let wrapper;
|
||||
|
||||
beforeEach(() => {
|
||||
wrapper = mount(SelectButton, {
|
||||
props: {
|
||||
modelValue: null,
|
||||
options: ['Off', 'On']
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
it('should exist', () => {
|
||||
expect(wrapper.find('.p-selectbutton.p-component').exists()).toBe(true);
|
||||
expect(wrapper.findAll('.p-button.p-component').length).toBe(2);
|
||||
});
|
||||
|
||||
it('should option select', async () => {
|
||||
await wrapper.vm.onOptionSelect({}, wrapper.vm.options[0]);
|
||||
|
||||
expect(wrapper.emitted()['update:modelValue'][0]).toEqual(['Off']);
|
||||
|
||||
await wrapper.setProps({ modelValue: wrapper.vm.options[0] });
|
||||
|
||||
expect(wrapper.findAll('.p-button.p-component')[0].classes()).toContain('p-highlight');
|
||||
});
|
||||
});
|
||||
|
||||
describe('multiple select', () => {
|
||||
let wrapper;
|
||||
|
||||
beforeEach(() => {
|
||||
wrapper = mount(SelectButton, {
|
||||
props: {
|
||||
modelValue: null,
|
||||
options: [
|
||||
{ name: 'Option 1', value: 1 },
|
||||
{ name: 'Option 2', value: 2 },
|
||||
{ name: 'Option 3', value: 3 }
|
||||
],
|
||||
optionLabel: 'name',
|
||||
multiple: true
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
it('should select', async () => {
|
||||
await wrapper.setProps({ modelValue: wrapper.vm.options });
|
||||
|
||||
expect(wrapper.findAll('.p-highlight').length).toBe(3);
|
||||
});
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue