Skip to content

Commit

Permalink
Fixing a typo for text area binding attribute when configuring all bi…
Browse files Browse the repository at this point in the history
…nding attributes
  • Loading branch information
tanordheim committed Aug 24, 2011
1 parent 4c2ff3a commit 237a3a0
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
2 changes: 1 addition & 1 deletion backbone.modelbinding.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ Backbone.ModelBinding.Configuration = (function(){
configureAllBindingAttributes: function(attribute){
this.storeBindingAttrConfig();
bindingAttrConfig.text = attribute;
bindingAttrConfig.texarea = attribute;
bindingAttrConfig.textarea = attribute;
bindingAttrConfig.password = attribute;
bindingAttrConfig.radio = attribute;
bindingAttrConfig.checkbox = attribute;
Expand Down
22 changes: 22 additions & 0 deletions spec/javascripts/configureAllBindingAttributes.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ describe("configure all binding attributes", function(){
beforeEach(function(){
this.model = new AModel({
name: "some dude",
bio: "not much",
education: "graduate",
graduated: "maybe",
drivers_license: true
Expand Down Expand Up @@ -36,6 +37,27 @@ describe("configure all binding attributes", function(){
});
});

describe("textarea element binding using configurable attribute", function(){
it("bind view changes to the model's field, by configurable convention", function(){
var el = this.view.$("#v_bio");
el.val("biography");
el.trigger('change');

expect(this.model.get('bio')).toEqual("biography");
});

it("bind model field changes to the form input, by convention of id", function(){
this.model.set({bio: "biography, schmiography"});
var el = this.view.$("#v_bio");
expect(el.val()).toEqual("biography, schmiography");
});

it("binds the model's value to the form field on render", function(){
var el = this.view.$("#v_bio");
expect(el.val()).toEqual("not much");
});
});

describe("radio element binding using configurable attribute", function(){
it("bind view changes to the model's field, by configurable convention", function(){
var el = this.view.$("#graduated_no");
Expand Down

0 comments on commit 237a3a0

Please sign in to comment.