mirror of
https://github.com/tenrok/vue-select.git
synced 2026-05-17 02:29:37 +03:00
add1a5282b
* chore: yarn upgrade * upgrade vue test utils * fix selectable suite * fix slot suite * fix ajax suite * fix reactive options suite * fix typeahead suite * fix reduce tests * fix tagging suite * fix deselecting * fix deselecting * fix deselecting
60 lines
1.8 KiB
JavaScript
60 lines
1.8 KiB
JavaScript
import { mountDefault } from '../helpers';
|
|
|
|
describe('Scoped Slots', () => {
|
|
it('receives an option object to the selected-option-container slot', () => {
|
|
const Select = mountDefault(
|
|
{value: 'one'},
|
|
{
|
|
scopedSlots: {
|
|
'selected-option-container': `<span slot="selected-option-container" slot-scope="{option}">{{ option.label }}</span>`,
|
|
},
|
|
});
|
|
|
|
expect(Select.find({ref: 'selectedOptions'}).text()).toEqual('one');
|
|
});
|
|
|
|
describe('Slot: selected-option', () => {
|
|
it('receives an option object to the selected-option slot', () => {
|
|
const Select = mountDefault(
|
|
{value: 'one'},
|
|
{
|
|
scopedSlots: {
|
|
'selected-option': `<span slot="selected-option" slot-scope="option">{{ option.label }}</span>`,
|
|
},
|
|
});
|
|
|
|
expect(Select.find('.vs__selected').text()).toEqual('one');
|
|
});
|
|
|
|
it('opens the dropdown when clicking an option in selected-option slot',
|
|
() => {
|
|
const Select = mountDefault(
|
|
{value: 'one'},
|
|
{
|
|
scopedSlots: {
|
|
'selected-option': `<span class="my-option" slot-scope="option">{{ option.label }}</span>`,
|
|
},
|
|
});
|
|
|
|
Select.find('.my-option').trigger('mousedown');
|
|
expect(Select.vm.open).toEqual(true);
|
|
});
|
|
});
|
|
|
|
it('receives an option object to the option slot in the dropdown menu',
|
|
async () => {
|
|
const Select = mountDefault(
|
|
{value: 'one'},
|
|
{
|
|
scopedSlots: {
|
|
'option': `<span slot="option" slot-scope="option">{{ option.label }}</span>`,
|
|
},
|
|
});
|
|
|
|
Select.vm.open = true;
|
|
await Select.vm.$nextTick();
|
|
|
|
expect(Select.find({ref: 'dropdownMenu'}).text()).toEqual('onetwothree');
|
|
});
|
|
});
|