Skip to content

Commit

Permalink
Fixed failing test with cleanup in teardown. Rejustified spacing.
Browse files Browse the repository at this point in the history
Signed-off-by: Neeraj Singh <[email protected]>
  • Loading branch information
JangoSteve authored and Neeraj Singh committed Mar 9, 2011
1 parent 5b23c3d commit f9b21b3
Showing 1 changed file with 16 additions and 15 deletions.
31 changes: 16 additions & 15 deletions test/public/test/call-remote-callbacks.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ module('call-remote-callbacks', {
},
teardown: function() {
$('form[data-remote]').die('ajax:beforeSend');
$('form[data-remote]').die('ajax:before');
}
});

Expand All @@ -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');
});
});
});

Expand Down

0 comments on commit f9b21b3

Please sign in to comment.