Skip to content

Commit

Permalink
Fixed not to use 'form' global.
Browse files Browse the repository at this point in the history
'form' being global caused the tests to pass when they should have
failed for address undefined 'form'.
  • Loading branch information
ratnikov committed Feb 27, 2009
1 parent ae5faef commit 8d7d311
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/form.js
Expand Up @@ -75,7 +75,7 @@ AjaxResource.Form.prototype.submit = function() {
var self = this;
if (this.semaphore().available()) {
// update the model from the attributes within the form
this.model().parse_json(form.parse_fields());
this.model().parse_json(this.parse_fields());

this.model().save(function(saved_model) {
if (saved_model.valid()) {
Expand Down
4 changes: 2 additions & 2 deletions test/form_test.js
@@ -1,6 +1,6 @@
jQuery(document).ready(function() {
var model = {};
form = new AjaxResource.Form('.form', {
var form = new AjaxResource.Form('.form', {
model : model
});

Expand Down Expand Up @@ -125,7 +125,7 @@ jQuery(document).ready(function() {
equals(on_save_model, saved_model, "Should have invoked on_save callback with model specified"); on_save_model = null;
ok(errors.cleared, "Should have cleared the errors in a successful save"); errors.cleared = false;

var saved_model = { valid: function() { return false; }, errors: function() { return [ [ "foo", "is not awesome enough" ]] } };
saved_model = { valid: function() { return false; }, errors: function() { return [ [ "foo", "is not awesome enough" ]]; } };
save_callback(saved_model);
ok(semaphore_decremented, "Should decrement semaphore for error request as well"); semaphore_decremented = false;
equals(on_save_model, null, "Should not invoke on_save callback, since the model contained errors");
Expand Down

0 comments on commit 8d7d311

Please sign in to comment.