feat(Picker): add confirm、cancel slot (#7377)

This commit is contained in:
neverland
2020-10-21 18:27:24 +08:00
committed by GitHub
parent 83095c7d1e
commit dabd984070
5 changed files with 64 additions and 27 deletions
@@ -88,6 +88,21 @@ exports[`not allow html 1`] = `
</div>
`;
exports[`render confirm/cancel slot 1`] = `
<div class="van-picker">
<div class="van-picker__toolbar"><button type="button" class="van-picker__cancel">Custom Cancel</button><button type="button" class="van-picker__confirm">Custom Confirm</button></div>
<!---->
<div class="van-picker__columns" style="height: 264px;">
<div class="van-picker-column">
<ul class="van-picker-column__wrapper" style="transform: translate3d(0, 110px, 0); transition-duration: 0ms; transition-property: none;"></ul>
</div>
<div class="van-picker__mask" style="background-size: 100% 110px;"></div>
<div class="van-hairline-unset--top-bottom van-picker__frame" style="height: 44px;"></div>
</div>
<!---->
</div>
`;
exports[`render title slot 1`] = `
<div class="van-picker">
<div class="van-picker__toolbar"><button type="button" class="van-picker__cancel">取消</button>Custom title<button type="button" class="van-picker__confirm">确认</button></div>
+15 -5
View File
@@ -138,13 +138,23 @@ test('column watch default index', async () => {
test('render title slot', () => {
const wrapper = mount({
template: `
<picker show-toolbar>
<van-picker show-toolbar>
<template v-slot:title>Custom title</template>
</picker>
</van-picker>
`,
});
expect(wrapper).toMatchSnapshot();
});
test('render confirm/cancel slot', () => {
const wrapper = mount({
template: `
<van-picker show-toolbar>
<template v-slot:confirm>Custom Confirm</template>
<template v-slot:cancel>Custom Cancel</template>
</van-picker>
`,
components: {
Picker,
},
});
expect(wrapper).toMatchSnapshot();