From: Richard Gibson Date: Thu, 1 Nov 2012 21:32:08 +0000 (-0400) Subject: No ticket: remove test suite external dependencies X-Git-Tag: 1.9.0b1~127 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=3f515045808dda2b4320a82894e875eb61d255e2;p=jquery.git No ticket: remove test suite external dependencies --- diff --git a/test/.jshintrc b/test/.jshintrc index ec1b4fa1e..41198067b 100644 --- a/test/.jshintrc +++ b/test/.jshintrc @@ -54,6 +54,7 @@ "isLocal": true, "originaljQuery": true, "$": true, - "original$": true + "original$": true, + "externalHost": true, } } diff --git a/test/data/manipulation/iframe-denied.html b/test/data/manipulation/iframe-denied.html index f2e3e83a4..da205ff49 100644 --- a/test/data/manipulation/iframe-denied.html +++ b/test/data/manipulation/iframe-denied.html @@ -10,7 +10,7 @@ + diff --git a/test/data/support/testElementCrash.html b/test/data/support/testElementCrash.html index 1ede71c71..315a5ddd0 100644 --- a/test/data/support/testElementCrash.html +++ b/test/data/support/testElementCrash.html @@ -4,7 +4,7 @@ diff --git a/test/data/testinit.js b/test/data/testinit.js index 1e6b33334..e5fc2c038 100644 --- a/test/data/testinit.js +++ b/test/data/testinit.js @@ -1,12 +1,12 @@ /*jshint multistr:true */ -var originaljQuery = this.jQuery || "jQuery", +var amdDefined, fireNative, + originaljQuery = this.jQuery || "jQuery", original$ = this.$ || "$", hasPHP = true, - // Disable Ajax tests to reduce network strain - // Re-enabled (at least the variable should be declared) isLocal = window.location.protocol === "file:", - amdDefined; + // see RFC 2606 + externalHost = "example.com"; // For testing .noConflict() this.jQuery = originaljQuery; @@ -58,7 +58,7 @@ function t( a, b, c ) { deepEqual(f, q.apply( q, c ), a + " (" + b + ")"); } -var createDashboardXML = function() { +function createDashboardXML() { var string = ' \ \ \ @@ -74,17 +74,17 @@ var createDashboardXML = function() { return jQuery.parseXML(string); }; -var createWithFriesXML = function() { +function createWithFriesXML() { var string = ' \ \ \ - \ - \ + \ + \ \ \ - \ + \ \ \ 1 \ @@ -101,10 +101,10 @@ var createWithFriesXML = function() { \ '; - return jQuery.parseXML(string); + return jQuery.parseXML( string.replace( /\{\{\s*externalHost\s*\}\}/g, externalHost ) ); }; -var createXMLFragment = function() { +function createXMLFragment() { var xml, frag; if ( window.ActiveXObject ) { xml = new ActiveXObject("msxml2.domdocument"); @@ -119,19 +119,16 @@ var createXMLFragment = function() { return frag; }; -var fireNative; -if ( document.createEvent ) { - fireNative = function( node, type ) { +fireNative = document.createEvent ? + function( node, type ) { var event = document.createEvent('HTMLEvents'); event.initEvent( type, true, true ); node.dispatchEvent( event ); - }; -} else { - fireNative = function( node, type ) { + } : + function( node, type ) { var event = document.createEventObject(); node.fireEvent( 'on' + type, event ); }; -} /** * Add random number to url to stop caching @@ -201,6 +198,8 @@ function url( value ) { ).appendTo( "body" ); }); }; + + window.iframeCallback = undefined; }()); // Sandbox start for great justice diff --git a/test/data/with_fries.xml b/test/data/with_fries.xml index 42f425706..dc42ddfc4 100644 --- a/test/data/with_fries.xml +++ b/test/data/with_fries.xml @@ -3,11 +3,11 @@ xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - - + + - + 1 diff --git a/test/unit/ajax.js b/test/unit/ajax.js index c5185efb3..9367320d2 100644 --- a/test/unit/ajax.js +++ b/test/unit/ajax.js @@ -621,7 +621,7 @@ if ( jQuery.ajax && ( !isLocal || hasPHP ) ) { jQuery.ajax({ dataType: "jsonp", - url: loc.protocol + "//somewebsitethatdoesnotexist-656329477541.com:" + ( loc.port || 80 ), + url: loc.protocol + "//example.invalid:" + ( loc.port || 80 ), beforeSend: function( _, s ) { ok( s.crossDomain, "Test different hostnames are detected as cross-domain" ); return false; @@ -2377,7 +2377,8 @@ if ( jQuery.ajax && ( !isLocal || hasPHP ) ) { var i = 1; jQuery.ajax({ - url: "http://somewebsitethatdoesnotexist-67864863574657654.com", + // see RFC 2606 + url: "http://example.invalid", success: function() { ok( false, "success" ); }, @@ -2398,7 +2399,7 @@ if ( jQuery.ajax && ( !isLocal || hasPHP ) ) { var i = 1; jQuery.ajax({ - url: "http://www.google.com", + url: "http://" + externalHost, success: function() { ok( false, "success" ); }, diff --git a/test/unit/attributes.js b/test/unit/attributes.js index 59b34a7a4..f171e896e 100644 --- a/test/unit/attributes.js +++ b/test/unit/attributes.js @@ -119,7 +119,7 @@ test( "attr(String)", function() { equal( jQuery( option ).attr("selected"), "selected", "Make sure that a single option is selected, even when in an optgroup." ); - var $img = jQuery("").appendTo("body"); + var $img = jQuery("").appendTo("body"); equal( $img.attr("width"), "215", "Retrieve width attribute an an element with display:none." ); equal( $img.attr("height"), "53", "Retrieve height attribute an an element with display:none." ); diff --git a/test/unit/core.js b/test/unit/core.js index 2e386b0e8..3d22b3d9e 100644 --- a/test/unit/core.js +++ b/test/unit/core.js @@ -218,16 +218,16 @@ test("noConflict", function() { var $$ = jQuery; - equal( jQuery, jQuery.noConflict(), "noConflict returned the jQuery object" ); - equal( window["jQuery"], $$, "Make sure jQuery wasn't touched." ); - equal( window["$"], original$, "Make sure $ was reverted." ); + strictEqual( jQuery, jQuery.noConflict(), "noConflict returned the jQuery object" ); + strictEqual( window["jQuery"], $$, "Make sure jQuery wasn't touched." ); + strictEqual( window["$"], original$, "Make sure $ was reverted." ); jQuery = $ = $$; - equal( jQuery.noConflict(true), $$, "noConflict returned the jQuery object" ); - equal( window["jQuery"], originaljQuery, "Make sure jQuery was reverted." ); - equal( window["$"], original$, "Make sure $ was reverted." ); - ok( $$("#qunit-fixture").html("test"), "Make sure that jQuery still works." ); + strictEqual( jQuery.noConflict(true), $$, "noConflict returned the jQuery object" ); + strictEqual( window["jQuery"], originaljQuery, "Make sure jQuery was reverted." ); + strictEqual( window["$"], original$, "Make sure $ was reverted." ); + ok( $$().pushStack([]), "Make sure that jQuery still works." ); window["jQuery"] = jQuery = $$; }); diff --git a/test/unit/css.js b/test/unit/css.js index 3dc9653ba..94d972793 100644 --- a/test/unit/css.js +++ b/test/unit/css.js @@ -746,7 +746,7 @@ test("widows & orphans #8936", function () { test("can't get css for disconnected in IE<9, see #10254 and #8388", function() { expect( 2 ); - var span = jQuery( "" ).css( "background-image", "url(http://static.jquery.com/files/rocker/images/logo_jquery_215x53.gif)" ); + var span = jQuery( "" ).css( "background-image", "url(data/1x1.jpg)" ); notEqual( span.css( "background-image" ), null, "can't get background-image in IE<9, see #10254" ); var div = jQuery( "
" ).css( "top", 10 );