Permalink
Browse files

Fixed blank form href test for IE.

  • Loading branch information...
1 parent 1ebfd86 commit 0e742688c633bda274f8a09bf3248ffe33ecaf92 @JangoSteve JangoSteve committed Jun 22, 2011
Showing with 10 additions and 4 deletions.
  1. +10 −4 test/public/test/call-remote.js
@@ -84,17 +84,23 @@ asyncTest('allow empty "data-remote" attribute', 1, function() {
});
asyncTest('allow empty form "action"', 1, function() {
+ var currentLocation, ajaxLocation;
+
build_form({ action: '' });
$('#qunit-fixture').find('form')
.bind('ajax:beforeSend', function(e, xhr, settings) {
// Get current location (the same way jQuery does)
- var currentLocation = document.createElement( "a" );
- currentLocation.href = "";
- currentLocation = currentLocation.href;
+ try {
+ currentLocation = location.href;
+ } catch(e) {
+ currentLocation = document.createElement( "a" );
+ currentLocation.href = "";
+ currentLocation = currentLocation.href;
+ }
// Actual location (strip out settings.data that jQuery serializes and appends)
- var ajaxLocation = settings.url.replace(settings.data,"").replace(/&$/, "");
+ ajaxLocation = settings.url.replace(settings.data,"").replace(/&$/, "");
equal(ajaxLocation.match(/^(.*)/)[1], currentLocation, 'URL should be current page by default');
// Prevent the request from actually getting sent to the current page and

0 comments on commit 0e74268

Please sign in to comment.