feat(Field): add clear-trigger prop (#6699)

This commit is contained in:
neverland
2020-07-04 12:18:25 +08:00
committed by GitHub
parent ebe4036e1a
commit db09f29aa8
5 changed files with 36 additions and 17 deletions
+13 -1
View File
@@ -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: {