Skip to content

Commit f0c2281

Browse files
committed
updated tests for modified label logic
1 parent 8ecc851 commit f0c2281

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

test/unit/specs/VueFormGenerator.spec.js

+16-5
Original file line numberDiff line numberDiff line change
@@ -1095,20 +1095,31 @@ describe("VueFormGenerator.vue", () => {
10951095
});
10961096

10971097
it("should return true", () => {
1098-
expect(form.fieldTypeHasLabel({ type: "input", inputType: "checkbox"})).to.be.true;
1099-
expect(form.fieldTypeHasLabel({ type: "input", inputType: "text"})).to.be.true;
1100-
expect(form.fieldTypeHasLabel({ type: "checklist" })).to.be.true;
1101-
expect(form.fieldTypeHasLabel({ type: "input", inputType: "image"})).to.be.true;
1098+
expect(form.fieldTypeHasLabel({ type: "input", inputType: "checkbox", label: "checkbox"})).to.be.true;
1099+
expect(form.fieldTypeHasLabel({ type: "input", inputType: "text", label: "text"})).to.be.true;
1100+
expect(form.fieldTypeHasLabel({ type: "checklist",label: "checklist"})).to.be.true;
1101+
expect(form.fieldTypeHasLabel({ type: "input", inputType: "image", label: "image"})).to.be.true;
11021102
});
11031103

11041104
it("should return false", () => {
1105+
// with label text defined
1106+
expect(form.fieldTypeHasLabel({ type: "input", inputType: "button", label: "button"})).to.be.false;
1107+
expect(form.fieldTypeHasLabel({ type: "input", inputType: "submit", label: "submit"})).to.be.false;
1108+
expect(form.fieldTypeHasLabel({ type: "input", inputType: "reset", label: "reset"})).to.be.false;
1109+
1110+
// without label text defined
1111+
expect(form.fieldTypeHasLabel({ type: "input", inputType: "checkbox"})).to.be.false;
1112+
expect(form.fieldTypeHasLabel({ type: "input", inputType: "text"})).to.be.false;
1113+
expect(form.fieldTypeHasLabel({ type: "checklist"})).to.be.false;
1114+
expect(form.fieldTypeHasLabel({ type: "input", inputType: "image"})).to.be.false;
11051115
expect(form.fieldTypeHasLabel({ type: "input", inputType: "button"})).to.be.false;
11061116
expect(form.fieldTypeHasLabel({ type: "input", inputType: "submit"})).to.be.false;
11071117
expect(form.fieldTypeHasLabel({ type: "input", inputType: "reset"})).to.be.false;
11081118
});
11091119

11101120
it("should default to true for unknown types", () => {
1111-
expect(form.fieldTypeHasLabel({ type: "input", inputType: "unsupported-or-unknown"})).to.be.true;
1121+
expect(form.fieldTypeHasLabel({ type: "input", inputType: "unsupported-or-unknown", label:"unsupported"})).to.be.true;
1122+
expect(form.fieldTypeHasLabel({ type: "input", inputType: "unsupported-or-unknown"})).to.be.false;
11121123
});
11131124
});
11141125

0 commit comments

Comments
 (0)