feat(Form): add scrollToField method (#5680)
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { later } from '../../../test';
|
||||
import { later, mockScrollIntoView } from '../../../test';
|
||||
import { mountForm, mountSimpleRulesForm, getSimpleRules } from './shared';
|
||||
|
||||
test('submit method', async () => {
|
||||
@@ -96,3 +96,17 @@ test('resetValidation method - reset one field', done => {
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
test('scrollToField method', done => {
|
||||
const fn = mockScrollIntoView();
|
||||
mountSimpleRulesForm({
|
||||
mounted() {
|
||||
this.$refs.form.scrollToField('unknown');
|
||||
expect(fn).toHaveBeenCalledTimes(0);
|
||||
|
||||
this.$refs.form.scrollToField('A');
|
||||
expect(fn).toHaveBeenCalledTimes(1);
|
||||
done();
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user