feat(Search): add left slot (#5771)

This commit is contained in:
chenjiahan
2020-03-07 09:14:29 +08:00
parent fd6b48873a
commit 32f0446629
5 changed files with 33 additions and 8 deletions
@@ -30,6 +30,19 @@ exports[`label slot 1`] = `
</div>
`;
exports[`left slot 1`] = `
<div class="van-search">Custom Left Content<div class="van-search__content van-search__content--square">
<div class="van-cell van-cell--borderless van-field">
<div class="van-field__left-icon"><i class="van-icon van-icon-search">
<!----></i></div>
<div class="van-cell__value van-cell__value--alone van-field__value">
<div class="van-field__body"><input type="search" class="van-field__control"></div>
</div>
</div>
</div>
</div>
`;
exports[`left-icon prop 1`] = `
<div class="van-search">
<div class="van-search__content van-search__content--square">
+11 -3
View File
@@ -66,9 +66,17 @@ test('search event', () => {
test('label slot', () => {
const wrapper = mount(Search, {
scopedSlots: {
label() {
return 'Custom Label';
},
label: () => 'Custom Label',
},
});
expect(wrapper).toMatchSnapshot();
});
test('left slot', () => {
const wrapper = mount(Search, {
scopedSlots: {
left: () => 'Custom Left Content',
},
});