feat(Field): add clear-trigger prop (#6699)
This commit is contained in:
@@ -9,7 +9,7 @@ exports[`arrow-direction prop 1`] = `
|
||||
</div>
|
||||
`;
|
||||
|
||||
exports[`clearable 1`] = `
|
||||
exports[`clearable prop 1`] = `
|
||||
<div class="van-cell van-field">
|
||||
<div class="van-cell__value van-cell__value--alone van-field__value">
|
||||
<div class="van-field__body"><input type="text" class="van-field__control"></div>
|
||||
@@ -17,7 +17,7 @@ exports[`clearable 1`] = `
|
||||
</div>
|
||||
`;
|
||||
|
||||
exports[`clearable 2`] = `
|
||||
exports[`clearable prop 2`] = `
|
||||
<div class="van-cell van-field">
|
||||
<div class="van-cell__value van-cell__value--alone van-field__value">
|
||||
<div class="van-field__body"><input type="text" class="van-field__control"><i class="van-icon van-icon-clear van-field__clear">
|
||||
|
||||
@@ -184,7 +184,7 @@ test('maxlength', async () => {
|
||||
expect(wrapper.emitted('input')[0][0]).toEqual('123');
|
||||
});
|
||||
|
||||
test('clearable', () => {
|
||||
test('clearable prop', () => {
|
||||
const wrapper = mount(Field, {
|
||||
propsData: {
|
||||
value: 'test',
|
||||
@@ -202,6 +202,18 @@ test('clearable', () => {
|
||||
expect(wrapper.emitted('clear')[0][0]).toBeTruthy();
|
||||
});
|
||||
|
||||
test('clear-trigger prop', () => {
|
||||
const wrapper = mount(Field, {
|
||||
propsData: {
|
||||
value: 'test',
|
||||
clearable: true,
|
||||
clearTrigger: 'always',
|
||||
},
|
||||
});
|
||||
|
||||
expect(wrapper.contains('.van-field__clear')).toBeTruthy();
|
||||
});
|
||||
|
||||
test('render input slot', () => {
|
||||
const wrapper = mount(Field, {
|
||||
scopedSlots: {
|
||||
|
||||
Reference in New Issue
Block a user