[new feature] DropdownMenu: add icon option (#3855)

This commit is contained in:
neverland
2019-07-15 18:44:33 +08:00
committed by GitHub
parent d15315b8e4
commit dbe56fd362
5 changed files with 83 additions and 28 deletions
+16 -3
View File
@@ -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');