Skip to content

Commit 143f0c6

Browse files
authored
test: update test case for form (#12886)
1 parent 58bb0a3 commit 143f0c6

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

test/unit/specs/form.spec.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -912,6 +912,10 @@ describe('Form', () => {
912912
name: null,
913913
addr: null
914914
},
915+
error: {
916+
name: null,
917+
addr: null
918+
},
915919
rules: {
916920
name: [
917921
{ required: true, message: '请输入活动名称', trigger: 'change', min: 3, max: 6 }
@@ -923,8 +927,9 @@ describe('Form', () => {
923927
};
924928
},
925929
methods: {
926-
onValidate(prop, valid) {
930+
onValidate(prop, valid, msg) {
927931
this.valid[prop] = valid;
932+
this.error[prop] = msg;
928933
},
929934
setValue(prop, value) {
930935
this.form[prop] = value;
@@ -934,12 +939,15 @@ describe('Form', () => {
934939
vm.setValue('name', '1');
935940
setTimeout(() => {
936941
expect(vm.valid.name).to.equal(false);
942+
expect(vm.error.name).to.equal('请输入活动名称');
937943
vm.setValue('addr', '1');
938944
setTimeout(() => {
939945
expect(vm.valid.addr).to.equal(true);
946+
expect(vm.error.addr).to.equal(null);
940947
vm.setValue('name', '111');
941948
setTimeout(() => {
942949
expect(vm.valid.name).to.equal(true);
950+
expect(vm.error.name).to.equal(null);
943951
done();
944952
}, DELAY);
945953
}, DELAY);

0 commit comments

Comments
 (0)