Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: rails/jquery-ujs
base: 298f69ecf8
...
head fork: rails/jquery-ujs
compare: 897f6966ee
Checking mergeability… Don't worry, you can still create the pull request.
  • 4 commits
  • 3 files changed
  • 0 commit comments
  • 2 contributors
View
91 test/public/test/call-remote-callbacks.js
@@ -192,52 +192,52 @@ asyncTest('blank required form input for non-remote form with "novalidate" attri
});
function skipIt() {
- // This test cannot work due to the security feature in browsers which makes the value
- // attribute of file input fields readonly, so it cannot be set with default value.
- // This is what the test would look like though if browsers let us automate this test.
- asyncTest('non-blank file form input field should abort remote request, but submit normally', 5, function() {
- var form = $('form[data-remote]')
- .append($('<input type="file" name="attachment" value="default.png">'))
- .bind('ajax:beforeSend', function() {
- ok(false, 'ajax:beforeSend should not run');
- })
- .bind('iframe:loading', function() {
- ok(true, 'form should get submitted');
- })
- .bind('ajax:aborted:file', function(e,data) {
- ok(data.length == 1, 'ajax:aborted:file event is passed all non-blank file inputs (jQuery objects)');
- ok(data.first().is('input[name="attachment"]') , 'ajax:aborted:file adds non-blank file input to data');
- ok(true, 'ajax:aborted:file event should run');
- })
- .trigger('submit');
-
- setTimeout(function() {
- form.find('input[type="file"]').val('');
- form.unbind('ajax:beforeSend');
- submit();
- }, 13);
- });
+ // This test cannot work due to the security feature in browsers which makes the value
+ // attribute of file input fields readonly, so it cannot be set with default value.
+ // This is what the test would look like though if browsers let us automate this test.
+ asyncTest('non-blank file form input field should abort remote request, but submit normally', 5, function() {
+ var form = $('form[data-remote]')
+ .append($('<input type="file" name="attachment" value="default.png">'))
+ .bind('ajax:beforeSend', function() {
+ ok(false, 'ajax:beforeSend should not run');
+ })
+ .bind('iframe:loading', function() {
+ ok(true, 'form should get submitted');
+ })
+ .bind('ajax:aborted:file', function(e,data) {
+ ok(data.length == 1, 'ajax:aborted:file event is passed all non-blank file inputs (jQuery objects)');
+ ok(data.first().is('input[name="attachment"]') , 'ajax:aborted:file adds non-blank file input to data');
+ ok(true, 'ajax:aborted:file event should run');
+ })
+ .trigger('submit');
+
+ setTimeout(function() {
+ form.find('input[type="file"]').val('');
+ form.unbind('ajax:beforeSend');
+ submit();
+ }, 13);
+ });
asyncTest('blank file input field should abort request entirely if handler bound to "ajax:aborted:file" event that returns false', 1, function() {
- var form = $('form[data-remote]')
- .append($('<input type="file" name="attachment" value="default.png">'))
- .bind('ajax:beforeSend', function() {
- ok(false, 'ajax:beforeSend should not run');
- })
- .bind('iframe:loading', function() {
- ok(false, 'form should not get submitted');
- })
- .bind('ajax:aborted:file', function() {
- return false;
- })
- .trigger('submit');
-
- setTimeout(function() {
- form.find('input[type="file"]').val('');
- form.unbind('ajax:beforeSend');
- submit();
- }, 13);
- });
+ var form = $('form[data-remote]')
+ .append($('<input type="file" name="attachment" value="default.png">'))
+ .bind('ajax:beforeSend', function() {
+ ok(false, 'ajax:beforeSend should not run');
+ })
+ .bind('iframe:loading', function() {
+ ok(false, 'form should not get submitted');
+ })
+ .bind('ajax:aborted:file', function() {
+ return false;
+ })
+ .trigger('submit');
+
+ setTimeout(function() {
+ form.find('input[type="file"]').val('');
+ form.unbind('ajax:beforeSend');
+ submit();
+ }, 13);
+ });
}
asyncTest('"ajax:beforeSend" can be observed and stopped with event delegation', 1, function() {
@@ -281,7 +281,8 @@ asyncTest('"ajax:beforeSend", "ajax:error" and "ajax:complete" are triggered on
form.bind('ajax:error', function(e, xhr, status, error) {
ok(xhr.getResponseHeader, 'first argument to "ajax:error" should be an XHR object');
equal(status, 'error', 'second argument to ajax:error should be a status string');
- equal(error, 'Forbidden', 'third argument to ajax:error should be an HTTP status response');
+ // Firefox 8 returns "Forbidden " with trailing space
+ equal($.trim(error), 'Forbidden', 'third argument to ajax:error should be an HTTP status response');
// Opera returns "0" for HTTP code
equal(xhr.status, window.opera ? 0 : 403, 'status code should be 403');
});
View
2  test/public/test/data-method.js
@@ -29,7 +29,7 @@ asyncTest('link with "data-method" and CSRF', 1, function() {
$('#qunit-fixture')
.append('<meta name="csrf-param" content="authenticity_token"/>')
.append('<meta name="csrf-token" content="cf50faa3fe97702ca1ae"/>');
-
+
submit(function(data) {
equal(data.params.authenticity_token, 'cf50faa3fe97702ca1ae');
});
View
4 test/public/test/data-remote.js
@@ -96,12 +96,12 @@ asyncTest('changing a select option with data-remote attribute', 5, function() {
App.assert_callback_invoked('ajax:success');
App.assert_request_path(data, '/echo');
equal(data.params.user_data, 'optionValue2', 'ajax arguments should have key term with right value');
- equal(data.params.data1, 'value1', 'ajax arguments should have key data1 with right value');
+ equal(data.params.data1, 'value1', 'ajax arguments should have key data1 with right value');
App.assert_get_request(data);
})
.bind('ajax:complete', function() { start() })
.val('optionValue2')
- .trigger('change');
+ .trigger('change');
});
asyncTest('submitting form with data-remote attribute', 4, function() {

No commit comments for this range

Something went wrong with that request. Please try again.