Commit 6ae261d8 authored by 好多大米's avatar 好多大米 Committed by GitHub

Form: validate method reject error info (#21374)

parent 492ab00a
......@@ -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();
});
});
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment