fix(Field): autofocus prop not work (#8488)

This commit is contained in:
neverland
2021-04-09 14:33:59 +08:00
committed by GitHub
parent 60bc702bb8
commit 07431487f3
2 changed files with 13 additions and 0 deletions
+11
View File
@@ -444,3 +444,14 @@ test('should change clear icon when using clear-icon prop', async () => {
await input.trigger('focus');
expect(wrapper.find('.van-field__clear').html()).toMatchSnapshot();
});
test('should render autofocus attribute to input when using autofocus prop', async () => {
const wrapper = mount(Field, {
props: {
autofocus: true,
},
});
const input = wrapper.find('input');
expect(input.element.hasAttributes('autofocus')).toBeTruthy();
});