Form: validate method reject error info (#21374)
This commit is contained in:
parent
492ab00ad7
commit
6ae261d840
|
@ -116,8 +116,8 @@
|
|||
// if no callback, return promise
|
||||
if (typeof callback !== 'function' && window.Promise) {
|
||||
promise = new window.Promise((resolve, reject) => {
|
||||
callback = function(valid) {
|
||||
valid ? resolve(valid) : reject(valid);
|
||||
callback = function(valid, invalidFields) {
|
||||
valid ? resolve(valid) : reject(invalidFields);
|
||||
};
|
||||
});
|
||||
}
|
||||
|
|
|
@ -921,8 +921,8 @@ describe('Form', () => {
|
|||
};
|
||||
}
|
||||
}, true);
|
||||
vm.$refs.form.validate().catch(validFailed => {
|
||||
expect(validFailed).to.false;
|
||||
vm.$refs.form.validate().catch(invalidFields => {
|
||||
expect(invalidFields.name[0].message).to.be.equal('长度至少为5');
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue