Skip to content

Commit

Permalink
moved unit test to formGenerator, as labels are managed by formGenera…
Browse files Browse the repository at this point in the history
…tor and not the field components
  • Loading branch information
zoul0813 committed Nov 11, 2017
1 parent 8c01307 commit f102967
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 28 deletions.
4 changes: 0 additions & 4 deletions src/fields/abstractField.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,10 +176,6 @@ export default {
return this.schema.fieldClasses || [];
},

getLabelClasses() {
return this.schema.labelClasses || [];
},

formatValueToField(value) {
return value;
},
Expand Down
26 changes: 26 additions & 0 deletions test/unit/specs/VueFormGenerator.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,32 @@ describe("VueFormGenerator.vue", () => {

});

describe("check label classes", () => {
let schema = {
fields: [
{
type: "input",
inputType: "text",
label: "Name",
model: "name",
labelClasses: ["applied-class", "another-class"]
}
]
};
let label;

before( () => {
createFormGenerator(schema);
label = el.querySelector("label");
});

it("should be 2 classes", () => {
expect(label.classList.contains("applied-class")).to.be.true;
expect(label.classList.contains("another-class")).to.be.true;
});

});

describe("check form row caption cell", () => {
let group, label;
let schema = {
Expand Down
24 changes: 0 additions & 24 deletions test/unit/specs/fields/abstractField.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -503,28 +503,4 @@ describe("abstractField.vue", function() {

});


describe("check classes application to labels", () => {

let schema = {
type: "text",
label: "First Name",
model: "user__model",
inputName: "input_name",
labelClasses: ["applied-class", "another-class"]
};
let model = {};

before( () => {
createField(this, schema, model);
});

it("should have 2 classes ('applied-class' and 'another-class')", () => {
expect(field.getLabelClasses().length).to.be.equal(2);
expect(field.getLabelClasses()[0]).to.be.equal("applied-class");
expect(field.getLabelClasses()[1]).to.be.equal("another-class");
});

});

});

0 comments on commit f102967

Please sign in to comment.