Skip to content

Commit d618958

Browse files
author
Duncan Lock
committed
Make fieldTypeHasLabel test actually work & test default path
1 parent c61b941 commit d618958

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

test/unit/specs/VueFormGenerator.spec.js

+13-9
Original file line numberDiff line numberDiff line change
@@ -1018,23 +1018,27 @@ describe("VueFormGenerator.vue", () => {
10181018
});
10191019

10201020
describe("check fieldTypeHasLabel function", () => {
1021+
let form;
10211022
before( () => {
10221023
createFormGenerator({ fields: [] }, {});
1024+
form = vm.$refs.form;
10231025
});
10241026

1025-
10261027
it("should return true", () => {
1027-
console.log(vm);
1028-
expect(vm.fieldTypeHasLabel({ type: "input", inputType: "checkbox"})).to.be.true;
1029-
expect(vm.fieldTypeHasLabel({ type: "input", inputType: "text"})).to.be.true;
1030-
expect(vm.fieldTypeHasLabel({ type: "checklist" })).to.be.true;
1028+
expect(form.fieldTypeHasLabel({ type: "input", inputType: "checkbox"})).to.be.true;
1029+
expect(form.fieldTypeHasLabel({ type: "input", inputType: "text"})).to.be.true;
1030+
expect(form.fieldTypeHasLabel({ type: "checklist" })).to.be.true;
10311031
});
10321032

10331033
it("should return false", () => {
1034-
expect(vm.fieldTypeHasLabel({ type: "input", inputType: "button"})).to.be.false;
1035-
expect(vm.fieldTypeHasLabel({ type: "input", inputType: "image"})).to.be.false;
1036-
expect(vm.fieldTypeHasLabel({ type: "input", inputType: "submit"})).to.be.false;
1037-
expect(vm.fieldTypeHasLabel({ type: "input", inputType: "reset"})).to.be.false;
1034+
expect(form.fieldTypeHasLabel({ type: "input", inputType: "button"})).to.be.false;
1035+
expect(form.fieldTypeHasLabel({ type: "input", inputType: "image"})).to.be.false;
1036+
expect(form.fieldTypeHasLabel({ type: "input", inputType: "submit"})).to.be.false;
1037+
expect(form.fieldTypeHasLabel({ type: "input", inputType: "reset"})).to.be.false;
1038+
});
1039+
1040+
it("should default to true for unknown types", () => {
1041+
expect(form.fieldTypeHasLabel({ type: "input", inputType: "unsupported-or-unknown"})).to.be.true;
10381042
});
10391043
});
10401044

0 commit comments

Comments
 (0)