[new feature] Search: add right-icon slot

This commit is contained in:
陈嘉涵
2019-05-27 14:59:58 +08:00
parent 613679c2aa
commit 6974367b03
6 changed files with 45 additions and 4 deletions
@@ -45,3 +45,19 @@ exports[`right-icon prop 1`] = `
</div>
</div>
`;
exports[`right-icon slot 1`] = `
<div class="van-search" style="background: rgb(255, 255, 255);">
<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">
<div class="van-field__body"><input type="search" class="van-field__control">
<div class="van-field__right-icon">Custom Right Icon</div>
</div>
</div>
</div>
</div>
</div>
`;
+13
View File
@@ -1,3 +1,4 @@
/* eslint-disable object-shorthand */
import Search from '..';
import { mount } from '../../../test/utils';
@@ -94,3 +95,15 @@ test('right-icon prop', () => {
expect(wrapper).toMatchSnapshot();
});
test('right-icon slot', () => {
const wrapper = mount(Search, {
scopedSlots: {
'right-icon'() {
return 'Custom Right Icon';
}
}
});
expect(wrapper).toMatchSnapshot();
});