]> source.dussan.org Git - jquery.git/commitdiff
No ticket: remove test suite external dependencies
authorRichard Gibson <richard.gibson@gmail.com>
Thu, 1 Nov 2012 21:32:08 +0000 (17:32 -0400)
committerRichard Gibson <richard.gibson@gmail.com>
Thu, 1 Nov 2012 21:32:08 +0000 (17:32 -0400)
test/.jshintrc
test/data/manipulation/iframe-denied.html
test/data/support/testElementCrash.html
test/data/testinit.js
test/data/with_fries.xml
test/unit/ajax.js
test/unit/attributes.js
test/unit/core.js
test/unit/css.js

index ec1b4fa1e70f5f45dc448332c288b5d211ca8c57..41198067b2ccb61c57ae6da7abf8ddef6263041a 100644 (file)
@@ -54,6 +54,7 @@
     "isLocal": true,
     "originaljQuery": true,
     "$": true,
-    "original$": true
+    "original$": true,
+    "externalHost": true,
   }
 }
index f2e3e83a4a7dcd400518b2ceb3ce5f36be081514..da205ff49a3565a590cdcd5cf39ac8cf8c0a2ce7 100644 (file)
@@ -10,7 +10,7 @@
                <script>
                        var script = document.getElementsByTagName( "script" )[ 0 ],
                                div = document.createElement( "div" ),
-                               src = "http://google.com",
+                               src = "http://" + window.parent.externalHost,
                                success = true,
                                error = "";
 
@@ -31,6 +31,6 @@
                                                ( error ? ": " + error : "" )
                                });
                        });
-                       </script>
+               </script>
        </body>
 </html>
index 1ede71c718579cd0e37fa8a9fe9581abd34dc6b0..315a5ddd0893b1bcd2b85797e9db4bffdceeba1e 100644 (file)
@@ -4,7 +4,7 @@
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
        <style>
                body {
-                       background: url('http://s1.postimage.org/2d2r8xih0/body_background.png');
+                       background: url('../1x1.jpg');
                }
        </style>
        <script src="../../../dist/jquery.js"></script>
index 1e6b333344c6952e44733baa84d96aef39b4fc6f..e5fc2c038757595424068c1dd45034d2f1f0073d 100644 (file)
@@ -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 = '<?xml version="1.0" encoding="UTF-8"?> \
        <dashboard> \
                <locations class="foo"> \
@@ -74,17 +74,17 @@ var createDashboardXML = function() {
        return jQuery.parseXML(string);
 };
 
-var createWithFriesXML = function() {
+function createWithFriesXML() {
        var string = '<?xml version="1.0" encoding="UTF-8"?> \
        <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" \
                xmlns:xsd="http://www.w3.org/2001/XMLSchema" \
                xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> \
                <soap:Body> \
-                       <jsconf xmlns="http://www.example.com/ns1"> \
-                               <response xmlns:ab="http://www.example.com/ns2"> \
+                       <jsconf xmlns="http://{{ externalHost }}/ns1"> \
+                               <response xmlns:ab="http://{{ externalHost }}/ns2"> \
                                        <meta> \
                                                <component id="seite1" class="component"> \
-                                                       <properties xmlns:cd="http://www.example.com/ns3"> \
+                                                       <properties xmlns:cd="http://{{ externalHost }}/ns3"> \
                                                                <property name="prop1"> \
                                                                        <thing /> \
                                                                        <value>1</value> \
@@ -101,10 +101,10 @@ var createWithFriesXML = function() {
                </soap:Body> \
        </soap:Envelope>';
 
-       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
index 42f425706eb492a07f93ec1c0da3ad8be2ad3a41..dc42ddfc4e3fd2e3a844f3d8dd2b55757bda1f88 100644 (file)
@@ -3,11 +3,11 @@
        xmlns:xsd="http://www.w3.org/2001/XMLSchema"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
        <soap:Body>
-               <jsconf xmlns="http://www.example.com/ns1">
-                       <response xmlns:ab="http://www.example.com/ns2">
+               <jsconf xmlns="http://example.com/ns1">
+                       <response xmlns:ab="http://example.com/ns2">
                                <meta>
                                        <component id="seite1" class="component">
-                                               <properties xmlns:cd="http://www.example.com/ns3">
+                                               <properties xmlns:cd="http://example.com/ns3">
                                                        <property name="prop1">
                                                                <thing />
                                                                <value>1</value>
index c5185efb380077c0be5f1de19b08a4fb65918306..9367320d2d3799fb34d310ad1118dde795a31387 100644 (file)
@@ -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" );
                        },
index 59b34a7a4f1d6c41935dc11910a2bc5df1d5e4fe..f171e896e6127076ebfd74780bf7c98c664ea5be 100644 (file)
@@ -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("<img style='display:none' width='215' height='53' src='http://static.jquery.com/files/rocker/images/logo_jquery_215x53.gif'/>").appendTo("body");
+       var $img = jQuery("<img style='display:none' width='215' height='53' src='data/1x1.jpg'/>").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." );
 
index 2e386b0e87df0425c284b24bc5ff1925cf2ced94..3d22b3d9eca4cbd127af6f81d5ecdce7281e1924 100644 (file)
@@ -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 = $$;
 });
index 3dc9653ba5a34b59a512bd5e6c4e1643d2a2c52e..94d972793b371d3d359920851f2853e87755d967 100644 (file)
@@ -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( "<span/>" ).css( "background-image", "url(http://static.jquery.com/files/rocker/images/logo_jquery_215x53.gif)" );
+       var span = jQuery( "<span/>" ).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( "<div/>" ).css( "top", 10 );