2
0
mirror of https://github.com/tenrok/vue-select.git synced 2026-05-17 02:29:37 +03:00
Files
Jeff Sagal e4d4b27540 V3/update list items slot (#799)
* add tests for slots, add normalized function for passing options to slots

* update active class

* update active class
2019-03-23 15:58:50 -07:00

42 lines
1.2 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')
});
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('receives an option object to the option slot in the dropdown menu', () => {
const Select = mountDefault(
{value: 'one'},
{
scopedSlots: {
'option': `<span slot="option" slot-scope="option">{{ option.label }}</span>`,
},
});
Select.vm.open = true;
expect(Select.find({ref: 'dropdownMenu'}).text()).toEqual('onetwothree')
});
});