Permalink
Browse files

Fixed failing test with cleanup in teardown. Rejustified spacing.

Signed-off-by: Neeraj Singh <neeraj@railsdog.com>
  • Loading branch information...
JangoSteve authored and Neeraj Singh committed Mar 9, 2011
1 parent 5b23c3d commit f9b21b3a3c7c46840fed8127a90def26911fad3d
Showing with 16 additions and 15 deletions.
  1. +16 −15 test/public/test/call-remote-callbacks.js
@@ -8,6 +8,7 @@ module('call-remote-callbacks', {
},
teardown: function() {
$('form[data-remote]').die('ajax:beforeSend');
+ $('form[data-remote]').die('ajax:before');
}
});
@@ -24,23 +25,23 @@ function submit(fn) {
asyncTest('modifying form fields with "ajax:before" sends modified data in request', 4, function(){
$('form[data-remote]')
- .append($('<input type="text" name="user_name" value="john">'))
- .append($('<input type="text" name="removed_user_name" value="john">'))
- .live('ajax:before', function() {
- var form = $(this);
- form
- .append($('<input />',{name: 'other_user_name',value: 'jonathan'}))
- .find('input[name="removed_user_name"]').remove();
- form
- .find('input[name="user_name"]').val('steve');
- });
-
+ .append($('<input type="text" name="user_name" value="john">'))
+ .append($('<input type="text" name="removed_user_name" value="john">'))
+ .live('ajax:before', function() {
+ var form = $(this);
+ form
+ .append($('<input />',{name: 'other_user_name',value: 'jonathan'}))
+ .find('input[name="removed_user_name"]').remove();
+ form
+ .find('input[name="user_name"]').val('steve');
+ });
+
submit(function(form) {
form.bind('ajax:success', function(e, data, status, xhr) {
- equal(data.params.user_name, 'steve', 'modified field value should have been submitted');
- equal(data.params.other_user_name, 'jonathan', 'added field value should have been submitted');
- equal(data.params.removed_user_name, undefined, 'removed field value should be undefined');
- });
+ equal(data.params.user_name, 'steve', 'modified field value should have been submitted');
+ equal(data.params.other_user_name, 'jonathan', 'added field value should have been submitted');
+ equal(data.params.removed_user_name, undefined, 'removed field value should be undefined');
+ });
});
});

0 comments on commit f9b21b3

Please sign in to comment.