Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Don't render <label> if schema title === false

  • Loading branch information...
commit 0e3622faf3d84c6a1fa24ecbb94856cd41eb9b8e 1 parent 0c4c54e
Phil Freo authored
Showing with 15 additions and 0 deletions.
  1. +5 −0 src/field.js
  2. +10 −0 test/field.js
5 src/field.js
View
@@ -102,6 +102,11 @@ Form.Field = (function() {
//Create the element
var $field = $(templates[schema.template](this.renderingContext(schema, editor)));
+
+ //Remove <label> if it's not wanted
+ if (schema.title === false) {
+ $field.find('label').first().remove();
+ }
//Render editor
$field.find('.bbf-tmp-editor').replaceWith(editor.render().el);
10 test/field.js
View
@@ -70,6 +70,16 @@ test("'schema.title' option - Defaults to formatted version of 'key' option", fu
equal($('label', field.el).html(), 'Camel Cased Title');
});
+test("'schema.title' false option - does not render a <label>", function() {
+ var field = new Field({
+ value: 'test',
+ key: 'title',
+ schema: { title: false }
+ }).render();
+
+ equal($('label', field.el).length, 0);
+});
+
test("'schema.help' option - Specifies help text", function() {
var field = new Field({
key: 'title',
Please sign in to comment.
Something went wrong with that request. Please try again.