Skip to content

Commit

Permalink
added "getLabelClasses" and unit test, using the fieldClasses unit te…
Browse files Browse the repository at this point in the history
…st as an example
  • Loading branch information
zoul0813 committed Nov 11, 2017
1 parent acdbb6c commit 8c01307
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/fields/abstractField.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,10 @@ export default {
return this.schema.fieldClasses || [];
},

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

formatValueToField(value) {
return value;
},
Expand Down
24 changes: 24 additions & 0 deletions test/unit/specs/fields/abstractField.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -503,4 +503,28 @@ 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 8c01307

Please sign in to comment.