feat(Field): add clear-icon prop (#8438)

This commit is contained in:
neverland
2021-04-01 09:51:00 +08:00
committed by GitHub
parent d51db70789
commit 2a065f85ef
5 changed files with 30 additions and 1 deletions
@@ -1,5 +1,10 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`should change clear icon when using clear-icon prop 1`] = `
<i class="van-badge__wrapper van-icon van-icon-cross van-field__clear">
</i>
`;
exports[`should render colon when using colon prop 1`] = `
<div class="van-cell__title van-field__label">
<span>
+14
View File
@@ -430,3 +430,17 @@ test('should allow to set autocomplete attribute', () => {
'on'
);
});
test('should change clear icon when using clear-icon prop', async () => {
const wrapper = mount(Field, {
props: {
clearable: true,
clearIcon: 'cross',
modelValue: 'test',
},
});
const input = wrapper.find('input');
await input.trigger('focus');
expect(wrapper.find('.van-field__clear').html()).toMatchSnapshot();
});