Skip to content

Commit 8db23f8

Browse files
committed
fix some test
1 parent 94a2199 commit 8db23f8

File tree

3 files changed

+5
-9
lines changed

3 files changed

+5
-9
lines changed

src/fields/abstractField.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { get as objGet, each, isFunction, isString, isArray, isUndefined } from "lodash";
1+
import { get as objGet, each, isFunction, isString, isArray } from "lodash";
22

33
export default {
44
props: [

src/formGenerator.vue

+1-6
Original file line numberDiff line numberDiff line change
@@ -265,12 +265,7 @@ div
265265
266266
fieldErrors(field) {
267267
let res = this.errors.filter(e => e.field == field);
268-
if (res.length > 0)
269-
console.log("res", res);
270-
let res2 = res.map(item => item.error);
271-
if (res2.length > 0)
272-
console.log("res2", res2);
273-
return res2;
268+
return res.map(item => item.error);
274269
}
275270
}
276271
};

test/unit/specs/VueFormGenerator.spec.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ describe("VueFormGenerator.vue", () => {
109109
});
110110

111111
it("should be error class", (done) => {
112-
Vue.set(vm.schema.fields[0], "errors", [ "!!!" ]);
112+
vm.$refs.form.errors.push({ field: vm.schema.fields[0], error: "Validation error!" });
113113
vm.$nextTick(() => {
114114
expect(group.classList.contains("error")).to.be.true;
115115
done();
@@ -207,7 +207,8 @@ describe("VueFormGenerator.vue", () => {
207207
});
208208

209209
it("should be .errors div if there are errors in fields", (done) => {
210-
vm.schema.fields[0].errors.push("Some error!", "Another error!");
210+
vm.$refs.form.errors.push({ field: vm.schema.fields[0], error: "Some error!" });
211+
vm.$refs.form.errors.push({ field: vm.schema.fields[0], error: "Another error!" });
211212
vm.$nextTick(() => {
212213
let div = group.querySelector(".errors");
213214
expect(div).to.be.exist;

0 commit comments

Comments
 (0)