feat(DropdownItem): add title slot (#4975)

This commit is contained in:
neverland
2019-11-10 11:47:11 +08:00
committed by GitHub
parent 76cdb03962
commit 9d12e895fe
6 changed files with 45 additions and 2 deletions

View File

@@ -303,6 +303,19 @@ exports[`title prop 1`] = `
</div>
`;
exports[`title slot 1`] = `
<div class="van-dropdown-menu van-hairline--top-bottom">
<div role="button" tabindex="0" class="van-dropdown-menu__item"><span class="van-dropdown-menu__title"><div class="van-ellipsis">
Custom Title
</div></span></div>
<div>
<div class="van-dropdown-item van-dropdown-item--down" style="z-index: 10; top: 0px; display: none;">
<!---->
</div>
</div>
</div>
`;
exports[`toggle method 1`] = `
<div class="van-dropdown-menu van-hairline--top-bottom">
<div role="button" tabindex="0" class="van-dropdown-menu__item"><span class="van-dropdown-menu__title van-dropdown-menu__title--active van-dropdown-menu__title--down"><div class="van-ellipsis"></div></span></div>

View File

@@ -241,3 +241,19 @@ test('toggle method', async done => {
}
});
});
test('title slot', () => {
const wrapper = mount({
template: `
<van-dropdown-menu>
<van-dropdown-item>
<template #title>
Custom Title
</template>
</van-dropdown-item>
</van-dropdown-menu>
`
});
expect(wrapper).toMatchSnapshot();
});