[new feature] DropdownMenu: add icon option (#3855)
This commit is contained in:
@@ -21,8 +21,8 @@ function renderWrapper(options = {}) {
|
||||
direction: options.direction || 'down',
|
||||
closeOnClickOutside: options.closeOnClickOutside,
|
||||
options: [
|
||||
{ text: 'A', value: 0 },
|
||||
{ text: 'B', value: 1 }
|
||||
{ text: 'A', value: 0, icon: options.icon },
|
||||
{ text: 'B', value: 1, icon: options.icon }
|
||||
]
|
||||
};
|
||||
}
|
||||
@@ -46,6 +46,19 @@ test('show dropdown item', async () => {
|
||||
expect(wrapper).toMatchSnapshot();
|
||||
});
|
||||
|
||||
test('render option icon', async () => {
|
||||
const wrapper = renderWrapper({
|
||||
icon: 'success'
|
||||
});
|
||||
|
||||
await later();
|
||||
|
||||
const titles = wrapper.findAll('.van-dropdown-menu__title');
|
||||
|
||||
titles.at(0).trigger('click');
|
||||
expect(wrapper).toMatchSnapshot();
|
||||
});
|
||||
|
||||
test('close-on-click-outside', async () => {
|
||||
const wrapper = renderWrapper({
|
||||
closeOnClickOutside: true
|
||||
@@ -79,7 +92,7 @@ test('direction up', async () => {
|
||||
direction: 'up'
|
||||
});
|
||||
|
||||
await later();
|
||||
await later(10);
|
||||
|
||||
const titles = wrapper.findAll('.van-dropdown-menu__title');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user