]> source.dussan.org Git - jquery.git/commitdiff
Build:Tests: Fix custom build tests, verify on Travis
authorMichał Gołębiowski-Owczarek <m.goleb@gmail.com>
Tue, 7 Jan 2020 22:59:08 +0000 (23:59 +0100)
committerGitHub <noreply@github.com>
Tue, 7 Jan 2020 22:59:08 +0000 (23:59 +0100)
This commit fixes unit tests for the following builds:

1. The no-deprecated build: `custom:-deprecated`
2. The current slim build: `custom:-ajax,-effects`
3. The future (#4553) slim build: `custom:-ajax,-callbacks,-deferred,-effects`

It also adds separate Travis jobs for the no-deprecated & slim builds.

Closes gh-4577

27 files changed:
.gitignore
.travis.yml
Gruntfile.js
build/tasks/node_smoke_tests.js
package.json
src/ajax.js
src/ajax/parseXML.js [deleted file]
src/core/parseXML.js [new file with mode: 0644]
src/jquery.js
test/data/core/dynamic_ready.html
test/data/offset/absolute.html
test/data/offset/body.html
test/data/offset/fixed.html
test/data/offset/relative.html
test/data/offset/scroll.html
test/data/offset/static.html
test/data/offset/table.html
test/data/qunit-fixture.js [deleted file]
test/unit/ajax.js
test/unit/callbacks.js
test/unit/deferred.js
test/unit/deprecated.js
test/unit/event.js
test/unit/manipulation.js
test/unit/queue.js
test/unit/ready.js
test/unit/serialize.js

index a6685904e3badaa64c9c65d119132d61a5bbe06a..836cb81c451e2850c93328a81c42492a1dd4ffc9 100644 (file)
@@ -21,3 +21,4 @@ npm-debug.log*
 /node_modules
 
 /test/data/core/jquery-iterability-transpiled.js
+/test/data/qunit-fixture.js
index 114a9e9b268218b40e9d558f819ca50819c06c22..02a0e04dd8df9fd906d76537ff7042156eb4dc74 100644 (file)
@@ -17,6 +17,20 @@ matrix:
       addons:
         chrome: stable
         firefox: latest
+    # Run tests against the slim build.
+    - node_js: "12"
+      env:
+        - NPM_SCRIPT="test:slim"
+        - BROWSERS="ChromeHeadless"
+      addons:
+        chrome: stable
+    # Run tests against the no-deprecated build.
+    - node_js: "12"
+      env:
+        - NPM_SCRIPT="test:no-deprecated"
+        - BROWSERS="ChromeHeadless"
+      addons:
+        chrome: stable
     # Run ES module tests.
     - node_js: "12"
       env:
index 2a6226a03f0d03d6b4243b5038e2905ca0729d22..c966ef99e4e59758aa5725d15fc0158991187bfe 100644 (file)
@@ -41,7 +41,7 @@ module.exports = function( grunt ) {
                                retainLines: true,
                                plugins: [ "@babel/transform-for-of" ]
                        },
-                       nodeSmokeTests: {
+                       tests: {
                                files: {
                                        "test/data/core/jquery-iterability-transpiled.js":
                                                "test/data/core/jquery-iterability-transpiled-es6.js"
@@ -314,7 +314,13 @@ module.exports = function( grunt ) {
                "karma:jsdom"
        ] );
 
+       grunt.registerTask( "test:prepare", [
+               "qunit_fixture",
+               "babel:tests"
+       ] );
+
        grunt.registerTask( "test", [
+               "test:prepare",
                "test:fast",
                "test:slow"
        ] );
@@ -336,7 +342,7 @@ module.exports = function( grunt ) {
                "uglify",
                "remove_map_comment",
                "dist:*",
-               "qunit_fixture",
+               "test:prepare",
                "eslint:dist",
                "test:fast",
                "compare_size"
index 40c49a4d98a83a404da180d84f230ca7fcdc7890..574a63b4a48a978a8ec6a59bc70bc75f66b8ef05 100644 (file)
@@ -4,7 +4,7 @@ module.exports = ( grunt ) => {
        const fs = require( "fs" );
        const spawnTest = require( "./lib/spawn_test.js" );
        const testsDir = "./test/node_smoke_tests/";
-       const nodeSmokeTests = [ "babel:nodeSmokeTests" ];
+       const nodeSmokeTests = [];
 
        // Fire up all tests defined in test/node_smoke_tests/*.js in spawned sub-processes.
        // All the files under test/node_smoke_tests/*.js are supposed to exit with 0 code
index 73789b2c2f700752fa9f134277d3b5bd947f791d..6500d445876a5ba2052ee71ff14dbc70b6c33397 100644 (file)
@@ -74,7 +74,9 @@
     "test:browser": "grunt && grunt karma:main",
     "test:esmodules": "grunt && grunt karma:esmodules",
     "test:amd": "grunt && grunt karma:amd",
-    "test": "grunt && grunt test:slow && grunt karma:main && grunt karma:esmodules && grunt karma:amd",
+    "test:no-deprecated": "grunt test:prepare && grunt custom:-deprecated && grunt karma:main",
+    "test:slim": "grunt test:prepare && grunt custom:slim && grunt karma:main",
+    "test": "npm run test:slim && npm run test:no-deprecated && grunt && grunt test:slow && grunt karma:main && grunt karma:esmodules && grunt karma:amd",
     "jenkins": "npm run test:browserless"
   },
   "commitplease": {
index 3d4ce017ba9d1e1cbccc44b8060a5c74ccec5409..44ec6e83b6603f9abd01e9b83c3c3bc0a6e27201 100644 (file)
@@ -6,7 +6,7 @@ import nonce from "./ajax/var/nonce.js";
 import rquery from "./ajax/var/rquery.js";
 
 import "./core/init.js";
-import "./ajax/parseXML.js";
+import "./core/parseXML.js";
 import "./event/trigger.js";
 import "./deferred.js";
 import "./serialize.js"; // jQuery.param
diff --git a/src/ajax/parseXML.js b/src/ajax/parseXML.js
deleted file mode 100644 (file)
index d547eab..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-import jQuery from "../core.js";
-
-// Cross-browser xml parsing
-jQuery.parseXML = function( data ) {
-       var xml;
-       if ( !data || typeof data !== "string" ) {
-               return null;
-       }
-
-       // Support: IE 9 - 11+
-       // IE throws on parseFromString with invalid input.
-       try {
-               xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" );
-       } catch ( e ) {
-               xml = undefined;
-       }
-
-       if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) {
-               jQuery.error( "Invalid XML: " + data );
-       }
-       return xml;
-};
-
-export default jQuery.parseXML;
diff --git a/src/core/parseXML.js b/src/core/parseXML.js
new file mode 100644 (file)
index 0000000..d547eab
--- /dev/null
@@ -0,0 +1,24 @@
+import jQuery from "../core.js";
+
+// Cross-browser xml parsing
+jQuery.parseXML = function( data ) {
+       var xml;
+       if ( !data || typeof data !== "string" ) {
+               return null;
+       }
+
+       // Support: IE 9 - 11+
+       // IE throws on parseFromString with invalid input.
+       try {
+               xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" );
+       } catch ( e ) {
+               xml = undefined;
+       }
+
+       if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) {
+               jQuery.error( "Invalid XML: " + data );
+       }
+       return xml;
+};
+
+export default jQuery.parseXML;
index 24e58a93ccc83b27810177f7b6aa969c7f230c32..53515267bff384a59fd5303f25ee0704349ef221 100644 (file)
@@ -21,8 +21,9 @@ import "./ajax.js";
 import "./ajax/xhr.js";
 import "./ajax/script.js";
 import "./ajax/jsonp.js";
-import "./core/parseHTML.js";
 import "./ajax/load.js";
+import "./core/parseXML.js";
+import "./core/parseHTML.js";
 import "./event/ajax.js";
 import "./effects.js";
 import "./effects/animatedSelector.js";
index e8180cd2b0fd1d6afa6a0fba8ef08fb390ffbce1..fade7adc2d67bb18194249a3ad59024618b2f380 100644 (file)
@@ -2,7 +2,7 @@
 <html>
 <head>
        <meta charset="utf-8">
-       <script src="../../jquery.js"></script>
+       <script src="../jquery-1.9.1.js"></script>
        <script>var $j = jQuery.noConflict();</script>
        <script src="../iframeTest.js"></script>
 </head>
index 9d87004652cfd16cd51a24d24bb751c1aa539de2..4883e81befc2800cac352ef0584de07fe9d73629 100644 (file)
                <script src="../../jquery.js"></script>
                <script src="../iframeTest.js"></script>
                <script type="text/javascript" charset="utf-8">
-                       jQuery(function($) {
-                               $(".absolute").click(function() {
-                                       $("#marker").css( $(this).offset() );
-                                       var pos = $(this).position();
-                                       $(this).css({ top: pos.top, left: pos.left });
+                       jQuery( function( $ ) {
+                               $( ".absolute" ).on( "click", function() {
+                                       $( "#marker" ).css( $( this ).offset() );
+                                       var pos = $( this ).position();
+                                       $( this ).css( { top: pos.top, left: pos.left } );
                                        return false;
-                               });
+                               } );
                                startIframeTest();
-                       });
+                       } );
                </script>
        </head>
        <body>
index 75757d7e605dc2b2327599f85cdb2ed4d8398ea1..a27e242affbe0c22bca0bd6f28026e8dd4d3d75b 100644 (file)
                <script src="../../jquery.js"></script>
                <script src="../iframeTest.js"></script>
                <script type="text/javascript" charset="utf-8">
-                       jQuery(function($) {
-                               $("body").click(function() {
-                                       $("marker").css( $(this).offset() );
+                       jQuery( function( $ ) {
+                               $( "body" ).on( "click", function() {
+                                       $( "#marker" ).css( $( this ).offset() );
                                        return false;
-                               });
+                               } );
                                startIframeTest();
-                       });
+                       } );
                </script>
        </head>
        <body>
index 48a2c479756956ae77e833cfc1371fd21c9fd8ba..9016f87a9857fb19cccfbe07f5c1d9e7b1913367 100644 (file)
                <script src="../../jquery.js"></script>
                <script src="../iframeTest.js"></script>
                <script type="text/javascript" charset="utf-8">
-                       jQuery(function($) {
-                               window.scrollTo(1000,1000);
-                               $(".fixed").click(function() {
-                                       $("#marker").css( $(this).offset() );
+                       jQuery( function( $ ) {
+                               window.scrollTo( 1000, 1000 );
+                               $( ".fixed" ).on( "click", function() {
+                                       $( "#marker" ).css( $( this ).offset() );
                                        return false;
                                });
                                startIframeTest();
index 288fd4ea3828fe6b24f393db7ebc1adb82564e09..0a092375de8ef57fce21bfa2a3a3b6d244d1d8ad 100644 (file)
                <script src="../../jquery.js"></script>
                <script src="../iframeTest.js"></script>
                <script type="text/javascript" charset="utf-8">
-                       jQuery(function($) {
-                               $(".relative").click(function() {
-                                       $("#marker").css( $(this).offset() );
-                                       var pos = $(this).position();
-                                       $(this).css({ position: 'absolute', top: pos.top, left: pos.left });
+                       jQuery( function( $ ) {
+                               $( ".relative" ).on( "click", function() {
+                                       $( "#marker" ).css( $( this ).offset() );
+                                       var pos = $( this ).position();
+                                       $( this ).css( { position: 'absolute', top: pos.top, left: pos.left } );
                                        return false;
-                               });
+                               } );
                                startIframeTest();
-                       });
+                       } );
                </script>
        </head>
        <body>
index 28cade1c377c299848ba3f099306548ff8b308f7..3b9848fe49c234e11341b487768459ae913b785a 100644 (file)
                <script src="../../jquery.js"></script>
                <script src="../iframeTest.js"></script>
                <script type="text/javascript" charset="utf-8">
-                       jQuery(function($) {
-                               window.scrollTo(1000,1000);
-                               $("#scroll-1")[0].scrollLeft = 5;
-                               $("#scroll-1")[0].scrollTop = 5;
-                               $(".scroll").click(function() {
-                                       $("#marker").css( $(this).offset() );
+                       jQuery( function( $ ) {
+                               window.scrollTo( 1000, 1000 );
+                               $( "#scroll-1" )[ 0 ].scrollLeft = 5;
+                               $( "#scroll-1" )[ 0 ].scrollTop = 5;
+                               $( ".scroll" ).on( "click", function() {
+                                       $( "#marker" ).css( $( this ).offset() );
                                        return false;
-                               });
+                               } );
                                startIframeTest();
-                       });
+                       } );
                </script>
        </head>
        <body>
index 1f4c3dc3dc5e3b1d0ad8df0872e70e3a504e8ae6..913f9d260d6afcd5d92c50f1d8af241dc3eed971 100644 (file)
                <script src="../../jquery.js"></script>
                <script src="../iframeTest.js"></script>
                <script type="text/javascript" charset="utf-8">
-                       jQuery(function($) {
-                               $(".static").click(function() {
-                                       $("#marker").css( $(this).offset() );
-                                       var pos = $(this).position();
-                                       $(this).css({ position: 'absolute', top: pos.top, left: pos.left });
+                       jQuery( function( $ ) {
+                               $( ".static" ).on( "click", function() {
+                                       $( "#marker" ).css( $( this ).offset() );
+                                       var pos = $( this ).position();
+                                       $( this ).css( { position: 'absolute', top: pos.top, left: pos.left } );
                                        return false;
-                               });
+                               } );
                                startIframeTest();
-                       });
+                       } );
                </script>
        </head>
        <body>
index eeac19b77c7e3ef56c73b197eb4019c2a8c5e24a..1650e729726278c8c0364ab6406e6982feba407d 100644 (file)
                <script src="../../jquery.js"></script>
                <script src="../iframeTest.js"></script>
                <script type="text/javascript" charset="utf-8">
-                       jQuery(function($) {
-                               $("table, th, td").click(function() {
-                                       $("#marker").css( $(this).offset() );
+                       jQuery( function( $ ) {
+                               $( "table, th, td" ).on( "click", function() {
+                                       $( "#marker" ).css( $( this ).offset() );
                                        return false;
-                               });
+                               } );
                                startIframeTest();
-                       });
+                       } );
                </script>
        </head>
        <body>
diff --git a/test/data/qunit-fixture.js b/test/data/qunit-fixture.js
deleted file mode 100644 (file)
index 9ec615c..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-// Generated by build/tasks/qunit_fixture.js
-QUnit.config.fixture = "<p id=\"firstp\">See <a id=\"simon1\" href=\"https://simon.incutio.com/archive/2003/03/25/#getElementsBySelector\" rel=\"bookmark\">this blog entry</a> for more information.</p>\n<p id=\"ap\">\n\tHere are some [links] in a normal paragraph: <a id=\"google\" href=\"https://www.google.com/\" title=\"Google!\">Google</a>,\n\t<a id=\"groups\" href=\"https://groups.google.com/\" class=\"GROUPS\">Google Groups (Link)</a>.\n\tThis link has <code id=\"code1\"><a href=\"https://smin\" id=\"anchor1\">class=\"blog\"</a></code>:\n\t<a href=\"https://diveintomark.org/\" class=\"blog\" hreflang=\"en\" id=\"mark\">diveintomark</a>\n\n</p>\n<div id=\"foo\">\n\t<p id=\"sndp\">Everything inside the red border is inside a div with <code>id=\"foo\"</code>.</p>\n\t<p lang=\"en\" id=\"en\">This is a normal link: <a id=\"yahoo\" href=\"https://www.yahoo.com/\" class=\"blogTest\">Yahoo</a></p>\n\t<p id=\"sap\">This link has <code><a href=\"#2\" id=\"anchor2\">class=\"blog\"</a></code>: <a href=\"https://simon.incutio.com/\" class=\"blog link\" id=\"simon\">Simon Willison's Weblog</a></p>\n\n</div>\n<div id=\"nothiddendiv\" style=\"height:1px;background:white;\" class=\"nothiddendiv\">\n\t<div id=\"nothiddendivchild\"></div>\n</div>\n<span id=\"name+value\"></span>\n<p id=\"first\">Try them out:</p>\n<ul id=\"firstUL\"></ul>\n<ol id=\"empty\"></ol>\n<form id=\"form\" action=\"formaction\">\n\t<label for=\"action\" id=\"label-for\">Action:</label>\n\t<input type=\"text\" name=\"action\" value=\"Test\" id=\"text1\" maxlength=\"30\"/>\n\t<input type=\"text\" name=\"text2\" value=\"Test\" id=\"text2\" disabled=\"disabled\"/>\n\t<input type=\"radio\" name=\"radio1\" id=\"radio1\" value=\"on\"/>\n\n\t<input type=\"radio\" name=\"radio2\" id=\"radio2\" checked=\"checked\"/>\n\t<input type=\"checkbox\" name=\"check\" id=\"check1\" checked=\"checked\"/>\n\t<input type=\"checkbox\" id=\"check2\" value=\"on\"/>\n\n\t<input type=\"hidden\" name=\"hidden\" id=\"hidden1\"/>\n\t<input type=\"text\" style=\"display:none;\" name=\"foo[bar]\" id=\"hidden2\"/>\n\n\t<input type=\"text\" id=\"name\" name=\"name\" value=\"name\" />\n\t<input type=\"search\" id=\"search\" name=\"search\" value=\"search\" />\n\n\t<button id=\"button\" name=\"button\" type=\"button\">Button</button>\n\n\t<textarea id=\"area1\" maxlength=\"30\">foobar</textarea>\n\n\t<select name=\"select1\" id=\"select1\">\n\t\t<option id=\"option1a\" class=\"emptyopt\" value=\"\">Nothing</option>\n\t\t<option id=\"option1b\" value=\"1\">1</option>\n\t\t<option id=\"option1c\" value=\"2\">2</option>\n\t\t<option id=\"option1d\" value=\"3\">3</option>\n\t</select>\n\t<select name=\"select2\" id=\"select2\">\n\t\t<option id=\"option2a\" class=\"emptyopt\" value=\"\">Nothing</option>\n\t\t<option id=\"option2b\" value=\"1\">1</option>\n\t\t<option id=\"option2c\" value=\"2\">2</option>\n\t\t<option id=\"option2d\" selected=\"selected\" value=\"3\">3</option>\n\t</select>\n\t<select name=\"select3\" id=\"select3\" multiple=\"multiple\">\n\t\t<option id=\"option3a\" class=\"emptyopt\" value=\"\">Nothing</option>\n\t\t<option id=\"option3b\" selected=\"selected\" value=\"1\">1</option>\n\t\t<option id=\"option3c\" selected=\"selected\" value=\"2\">2</option>\n\t\t<option id=\"option3d\" value=\"3\">3</option>\n\t\t<option id=\"option3e\">no value</option>\n\t</select>\n\t<select name=\"select4\" id=\"select4\" multiple=\"multiple\">\n\t\t<optgroup disabled=\"disabled\">\n\t\t\t<option id=\"option4a\" class=\"emptyopt\" value=\"\">Nothing</option>\n\t\t\t<option id=\"option4b\" disabled=\"disabled\" selected=\"selected\" value=\"1\">1</option>\n\t\t\t<option id=\"option4c\" selected=\"selected\" value=\"2\">2</option>\n\t\t</optgroup>\n\t\t<option selected=\"selected\" disabled=\"disabled\" id=\"option4d\" value=\"3\">3</option>\n\t\t<option id=\"option4e\">no value</option>\n\t</select>\n\t<select name=\"select5\" id=\"select5\">\n\t\t<option id=\"option5a\" value=\"3\">1</option>\n\t\t<option id=\"option5b\" value=\"2\">2</option>\n\t\t<option id=\"option5c\" value=\"1\" data-attr=\"\">3</option>\n\t</select>\n\n\t<object id=\"object1\" codebase=\"stupid\">\n\t\t<param name=\"p1\" value=\"x1\" />\n\t\t<param name=\"p2\" value=\"x2\" />\n\t</object>\n\n\t<span id=\"台北Táiběi\"><span id=\"台北Táiběi-child\"></span></span>\n\t<span id=\"台北\" lang=\"中文\"></span>\n\t<span id=\"utf8class1\" class=\"台北Táiběi 台北\">\"'台北Táiběi\"'</span>\n\t<span id=\"utf8class2\" class=\"台北\"></span>\n\t<span id=\"foo:bar\" class=\"foo:bar\"><span id=\"foo_descendant\"></span></span>\n\t<span id=\"test.foo[5]bar\" class=\"test.foo[5]bar\"></span>\n\n\t<foo_bar id=\"foobar\">test element</foo_bar>\n</form>\n<b id=\"floatTest\">Float test.</b>\n<iframe id=\"iframe\" name=\"iframe\"></iframe>\n<form id=\"lengthtest\">\n\t<input type=\"text\" id=\"length\" name=\"test\"/>\n\t<input type=\"text\" id=\"idTest\" name=\"id\"/>\n</form>\n<table id=\"table\"></table>\n\n<form id=\"name-tests\">\n\t<!-- Inputs with a grouped name attribute. -->\n\t<input name=\"types[]\" id=\"types_all\" type=\"checkbox\" value=\"all\" />\n\t<input name=\"types[]\" id=\"types_anime\" type=\"checkbox\" value=\"anime\" />\n\t<input name=\"types[]\" id=\"types_movie\" type=\"checkbox\" value=\"movie\" />\n</form>\n\n<form id=\"testForm\" action=\"#\" method=\"get\">\n\t<textarea name=\"T3\" rows=\"2\" cols=\"15\">?\nZ</textarea>\n\t<input type=\"hidden\" name=\"H1\" value=\"x\" />\n\t<input type=\"hidden\" name=\"H2\" />\n\t<input name=\"PWD\" type=\"password\" value=\"\" />\n\t<input name=\"T1\" type=\"text\" />\n\t<input name=\"T2\" type=\"text\" value=\"YES\" readonly=\"readonly\" />\n\t<input type=\"checkbox\" name=\"C1\" value=\"1\" />\n\t<input type=\"checkbox\" name=\"C2\" />\n\t<input type=\"radio\" name=\"R1\" value=\"1\" />\n\t<input type=\"radio\" name=\"R1\" value=\"2\" />\n\t<input type=\"text\" name=\"My Name\" value=\"me\" />\n\t<input type=\"reset\" name=\"reset\" value=\"NO\" />\n\t<div class=\"empty-name-container\">\n\t\t<div id=\"empty-name-parent\">\n\t\t\t<input type=\"text\" id=\"name-empty\" name=\"\" value=\"\" />\n\t\t</div>\n\t</div>\n\t<select name=\"S1\">\n\t\t<option value=\"abc\">ABC</option>\n\t\t<option value=\"abc\">ABC</option>\n\t\t<option value=\"abc\">ABC</option>\n\t</select>\n\t<select name=\"S2\" multiple=\"multiple\" size=\"3\">\n\t\t<option value=\"abc\">ABC</option>\n\t\t<option value=\"abc\">ABC</option>\n\t\t<option value=\"abc\">ABC</option>\n\t</select>\n\t<select name=\"S3\">\n\t\t<option selected=\"selected\">YES</option>\n\t</select>\n\t<select name=\"S4\">\n\t\t<option value=\"\" selected=\"selected\">NO</option>\n\t</select>\n\t<input type=\"submit\" name=\"sub1\" value=\"NO\" />\n\t<input type=\"submit\" name=\"sub2\" value=\"NO\" />\n\t<input type=\"image\" name=\"sub3\" value=\"NO\" />\n\t<button name=\"sub4\" type=\"submit\" value=\"NO\">NO</button>\n\t<input name=\"D1\" type=\"text\" value=\"NO\" disabled=\"disabled\" />\n\t<input type=\"checkbox\" checked=\"checked\" disabled=\"disabled\" name=\"D2\" value=\"NO\" />\n\t<input type=\"radio\" name=\"D3\" value=\"NO\" checked=\"checked\" disabled=\"disabled\" />\n\t<select name=\"D4\" disabled=\"disabled\">\n\t\t<option selected=\"selected\" value=\"NO\">NO</option>\n\t</select>\n\t<input id=\"list-test\" type=\"text\" />\n\t<datalist id=\"datalist\">\n\t\t<option value=\"option\"></option>\n\t</datalist>\n</form>\n<div id=\"moretests\">\n\t<form>\n\t\t<div id=\"checkedtest\" style=\"display:none;\">\n\t\t\t<input type=\"radio\" name=\"checkedtestradios\" checked=\"checked\"/>\n\t\t\t<input type=\"radio\" name=\"checkedtestradios\" value=\"on\"/>\n\t\t\t<input type=\"checkbox\" name=\"checkedtestcheckboxes\" checked=\"checked\"/>\n\t\t\t<input type=\"checkbox\" name=\"checkedtestcheckboxes\" />\n\t\t</div>\n\t</form>\n\t<div id=\"nonnodes\"><span id=\"nonnodesElement\">hi</span> there <!-- mon ami --></div>\n\t<div id=\"t2037\">\n\t\t<div><div class=\"hidden\">hidden</div></div>\n\t</div>\n\t<div id=\"t6652\">\n\t\t<div></div>\n\t</div>\n\t<div id=\"t12087\">\n\t\t<input type=\"hidden\" id=\"el12087\" data-comma=\"0,1\"/>\n\t</div>\n\t<div id=\"no-clone-exception\"><object><embed></embed></object></div>\n\t<div id=\"names-group\">\n\t\t<span id=\"name-is-example\" name=\"example\"></span>\n\t\t<span id=\"name-is-div\" name=\"div\"></span>\n\t</div>\n\t<div id=\"id-name-tests\">\n\t\t<a id=\"tName1ID\" name=\"tName1\"><span></span></a>\n\t\t<a id=\"tName2ID\" name=\"tName2\"><span></span></a>\n\t\t<div id=\"tName1\"><span id=\"tName1-span\">C</span></div>\n\t</div>\n\t<div id=\"whitespace-lists\">\n\t\t<input id=\"t15233-single\" data-15233=\"foo\"/>\n\t\t<input id=\"t15233-double\" data-15233=\"foo bar\"/>\n\t\t<input id=\"t15233-double-tab\" data-15233=\"foo\tbar\"/>\n\t\t<input id=\"t15233-double-nl\" data-15233=\"foo&#xA;bar\"/>\n\t\t<input id=\"t15233-triple\" data-15233=\"foo bar baz\"/>\n\t</div>\n</div>\n\n<div id=\"tabindex-tests\">\n\t<ol id=\"listWithTabIndex\" tabindex=\"5\">\n\t\t<li id=\"foodWithNegativeTabIndex\" tabindex=\"-1\">Rice</li>\n\t\t<li id=\"foodNoTabIndex\">Beans</li>\n\t\t<li>Blinis</li>\n\t\t<li>Tofu</li>\n\t</ol>\n\n\t<div id=\"divWithNoTabIndex\">I'm hungry. I should...</div>\n\t<span>...</span><a href=\"#\" id=\"linkWithNoTabIndex\">Eat lots of food</a><span>...</span> |\n\t<span>...</span><a href=\"#\" id=\"linkWithTabIndex\" tabindex=\"2\">Eat a little food</a><span>...</span> |\n\t<span>...</span><a href=\"#\" id=\"linkWithNegativeTabIndex\" tabindex=\"-1\">Eat no food</a><span>...</span>\n\t<span>...</span><a id=\"linkWithNoHrefWithNoTabIndex\">Eat a burger</a><span>...</span>\n\t<span>...</span><a id=\"linkWithNoHrefWithTabIndex\" tabindex=\"1\">Eat some funyuns</a><span>...</span>\n\t<span>...</span><a id=\"linkWithNoHrefWithNegativeTabIndex\" tabindex=\"-1\">Eat some funyuns</a><span>...</span>\n\t<input id=\"inputWithoutTabIndex\"/>\n\t<button id=\"buttonWithoutTabIndex\"></button>\n\t<textarea id=\"textareaWithoutTabIndex\"></textarea>\n\t<menu type=\"popup\">\n\t\t<menuitem id=\"menuitemWithoutTabIndex\" command=\"submitbutton\" default/>\n\t</menu>\n</div>\n\n<div id=\"liveHandlerOrder\">\n\t<span id=\"liveSpan1\"><a href=\"#\" id=\"liveLink1\"></a></span>\n\t<span id=\"liveSpan2\"><a href=\"#\" id=\"liveLink2\"></a></span>\n</div>\n\n<form id=\"disabled-tests\">\n\t<fieldset id=\"disabled-fieldset\" disabled=\"disabled\">\n\t\t<a id=\"disabled-fieldset-a\" href=\"#\"></a>\n\t\t<input id=\"disabled-fieldset-input\" name=\"disabled-fieldset-input\" type=\"text\" />\n\t\t<textarea id=\"disabled-fieldset-textarea\" name=\"disabled-fieldset-textarea\" ></textarea>\n\t\t<button id=\"disabled-fieldset-button\" name=\"disabled-fieldset-button\">Go</button>\n\t\t<!-- exclude <select> because IE6 is bugged and fails\n\t\t<select id=\"disabled-fieldset-select\" name=\"disabled-fieldset-select\"></select>\n\t\t-->\n\t\t<span id=\"disabled-fieldset-span\">Neither enabled nor disabled</span>\n\t</fieldset>\n\t<fieldset id=\"enabled-fieldset\">\n\t\t<a id=\"disabled-a\" href=\"#\" disabled=\"disabled\"></a>\n\t\t<input id=\"disabled-input\" name=\"disabled-input\" type=\"text\" disabled=\"disabled\"/>\n\t\t<textarea id=\"disabled-textarea\" name=\"disabled-textarea\" disabled=\"disabled\"></textarea>\n\t\t<button id=\"disabled-button\" name=\"disabled-button\" disabled=\"disabled\">Go</button>\n\t\t<select id=\"disabled-select\" name=\"disabled-select\" disabled=\"disabled\">\n\t\t\t<optgroup id=\"disabled-optgroup\" label=\"and\" disabled=\"disabled\">\n\t\t\t\t<option id=\"disabled-option\" disabled=\"disabled\">Black</option>\n\t\t\t</optgroup>\n\t\t</select>\n\t\t<input id=\"enabled-input\" name=\"enabled-input\" type=\"text\"/>\n\t\t<textarea id=\"enabled-textarea\" name=\"enabled-textarea\"></textarea>\n\t\t<button id=\"enabled-button\" name=\"enabled-button\">Go</button>\n\t\t<select id=\"enabled-select\" name=\"enabled-select\">\n\t\t\t<optgroup id=\"enabled-optgroup\" label=\"and\">\n\t\t\t\t<option id=\"enabled-option\">Gold</option>\n\t\t\t</optgroup>\n\t\t</select>\n\t\t<span id=\"enabled-fieldset-span\">Neither enabled nor disabled</span>\n\t</fieldset>\n\t<select id=\"disabled-select-inherit\" name=\"disabled-select-inherit\" disabled=\"disabled\">\n\t\t<optgroup id=\"disabled-optgroup-inherit\" label=\"and\" disabled=\"disabled\">\n\t\t\t<option id=\"disabled-optgroup-option\">Black</option>\n\t\t</optgroup>\n\t\t<optgroup id=\"enabled-optgroup-inherit\" label=\"and\">\n\t\t\t<option id=\"enabled-optgroup-option\">Gold</option>\n\t\t</optgroup>\n\t</select>\n\t<select id=\"enabled-select-inherit\" name=\"enabled-select-inherit\">\n\t\t<optgroup id=\"en_disabled-optgroup-inherit\" label=\"and\" disabled=\"disabled\">\n\t\t\t<option id=\"en_disabled-optgroup-option\">Black</option>\n\t\t</optgroup>\n\t\t<option id=\"enabled-select-option\">Black</option>\n\t</select>\n</form>\n\n<div id=\"siblingTest\">\n\t<em id=\"siblingfirst\">1</em>\n\t<em id=\"siblingnext\">2</em>\n\t<em id=\"siblingthird\">\n\t\t<em id=\"siblingchild\">\n\t\t\t<em id=\"siblinggrandchild\">\n\t\t\t\t<em id=\"siblinggreatgrandchild\"></em>\n\t\t\t</em>\n\t\t</em>\n\t</em>\n\t<span id=\"siblingspan\"></span>\n</div>\n<div id=\"fx-test-group\" style=\"position: absolute; width: 1px; height: 1px; overflow: hidden;\">\n\t<div id=\"fx-queue\" name=\"test\">\n\t\t<div id=\"fadein\" class='chain-test'>fadeIn<div>fadeIn</div></div>\n\t\t<div id=\"fadeout\" class='chain-test chain-test-out'>fadeOut<div>fadeOut</div></div>\n\n\t\t<div id=\"show\" class='chain-test'>show<div>show</div></div>\n\t\t<div id=\"hide\" class='chain-test chain-test-out'>hide<div>hide</div></div>\n\t\t<div id=\"easehide\" class='chain-test chain-test-out'>hide<div>hide</div></div>\n\n\t\t<div id=\"togglein\" class='chain-test'>togglein<div>togglein</div></div>\n\t\t<div id=\"toggleout\" class='chain-test chain-test-out'>toggleout<div>toggleout</div></div>\n\t\t<div id=\"easetoggleout\" class='chain-test chain-test-out'>toggleout<div>toggleout</div></div>\n\n\t\t<div id=\"slideup\" class='chain-test'>slideUp<div>slideUp</div></div>\n\t\t<div id=\"slidedown\" class='chain-test chain-test-out'>slideDown<div>slideDown</div></div>\n\t\t<div id=\"easeslideup\" class='chain-test'>slideUp<div>slideUp</div></div>\n\n\t\t<div id=\"slidetogglein\" class='chain-test'>slideToggleIn<div>slideToggleIn</div></div>\n\t\t<div id=\"slidetoggleout\" class='chain-test chain-test-out'>slideToggleOut<div>slideToggleOut</div></div>\n\n\t\t<div id=\"fadetogglein\" class='chain-test'>fadeToggleIn<div>fadeToggleIn</div></div>\n\t\t<div id=\"fadetoggleout\" class='chain-test chain-test-out'>fadeToggleOut<div>fadeToggleOut</div></div>\n\n\t\t<div id=\"fadeto\" class='chain-test'>fadeTo<div>fadeTo</div></div>\n\t</div>\n\n\t<div id=\"fx-tests\"></div>\n\t<span id=\"display\"></span>\n</div>\n<br id=\"last\"/>\n";
index a2cc34e3277bc8de309021dd96d6cfc74e70b95c..e1f290f32c21ec8e097f6f1422861f1253d6ba16 100644 (file)
@@ -255,7 +255,7 @@ QUnit.module( "ajax", {
        ajaxTest( "jQuery.ajax() - headers", 8, function( assert ) {
                return {
                        setup: function() {
-                               jQuery( document ).ajaxSend( function( evt, xhr ) {
+                               jQuery( document ).on( "ajaxSend", function( evt, xhr ) {
                                        xhr.setRequestHeader( "ajax-send", "test" );
                                } );
                        },
@@ -580,10 +580,10 @@ QUnit.module( "ajax", {
                return {
                        setup: function() {
                                jQuery( context ).appendTo( "#foo" )
-                                       .ajaxSend( event )
-                                       .ajaxComplete( event )
-                                       .ajaxError( event )
-                                       .ajaxSuccess( event );
+                                       .on( "ajaxSend", event )
+                                       .on( "ajaxComplete", event )
+                                       .on( "ajaxError", event )
+                                       .on( "ajaxSuccess", event );
                        },
                        requests: [ {
                                url: url( "name.html" ),
@@ -2539,7 +2539,7 @@ if ( typeof window.ArrayBuffer === "undefined" || typeof new XMLHttpRequest().re
                var done = assert.async();
 
                addGlobalEvents( "ajaxStart ajaxStop ajaxSend ajaxComplete ajaxError", assert )();
-               jQuery( document ).ajaxStop( done );
+               jQuery( document ).on( "ajaxStop", done );
                jQuery( "<div/>" ).load( baseURL + "404.txt", function() {
                        assert.ok( true, "complete" );
                } );
@@ -2727,7 +2727,7 @@ if ( typeof window.ArrayBuffer === "undefined" || typeof new XMLHttpRequest().re
                jQuery.ajaxSetup( {
                        dataType: "json"
                } );
-               jQuery( document ).ajaxComplete( function( e, xml, s ) {
+               jQuery( document ).on( "ajaxComplete", function( e, xml, s ) {
                        assert.strictEqual( s.dataType, "html", "Verify the load() dataType was html" );
                        jQuery( document ).off( "ajaxComplete" );
                        done();
@@ -2748,7 +2748,7 @@ if ( typeof window.ArrayBuffer === "undefined" || typeof new XMLHttpRequest().re
                        }
                } );
                jQuery( "#foo" ).load( baseURL + "mock.php?action=echoQuery", data );
-               jQuery( document ).ajaxComplete( function( event, jqXHR, options ) {
+               jQuery( document ).on( "ajaxComplete", function( event, jqXHR, options ) {
                        assert.ok( ~options.data.indexOf( "foo=bar" ), "Data from ajaxSettings was used" );
                        done();
                } );
index b440f382278411ef16e745dc6de659812a2f39af..c1a6eacf6c0a2befc09824e17db6e4f4bbed4b63 100644 (file)
@@ -4,6 +4,12 @@ QUnit.module( "callbacks", {
 
 ( function() {
 
+if ( !jQuery.Callbacks ) {
+       return;
+}
+
+( function() {
+
 var output,
        addToOutput = function( string ) {
                return function() {
@@ -387,3 +393,5 @@ QUnit.test( "jQuery.Callbacks() - list with memory stays locked (gh-3469)", func
        cb.fire();
        assert.equal( fired, 11, "Post-lock() fire ignored" );
 } );
+
+} )();
index 27a91321666d69bcccf877cbf7de474d5698fc4d..2063ac82ccd4263fc1e16a4649ef4b1b78763bb1 100644 (file)
@@ -2,6 +2,12 @@ QUnit.module( "deferred", {
        afterEach: moduleTeardown
 } );
 
+( function() {
+
+if ( !jQuery.Deferred ) {
+       return;
+}
+
 jQuery.each( [ "", " - new operator" ], function( _, withNew ) {
 
        function createDeferred( fn ) {
@@ -1111,3 +1117,5 @@ QUnit.test( "jQuery.when(...) - opportunistically synchronous", function( assert
 
        when = "after";
 } );
+
+} )();
index df9d5ffa856ad2de4fea88aba4f566e7ffee766c..d5a577ffb05855cd2c3cdc6f8313ede405d78858 100644 (file)
@@ -1,7 +1,7 @@
 QUnit.module( "deprecated", { afterEach: moduleTeardown } );
 
 
-QUnit.test( "bind/unbind", function( assert ) {
+QUnit[ jQuery.fn.bind ? "test" : "skip" ]( "bind/unbind", function( assert ) {
        assert.expect( 4 );
 
        var markup = jQuery(
@@ -22,7 +22,7 @@ QUnit.test( "bind/unbind", function( assert ) {
                .remove();
 } );
 
-QUnit.test( "delegate/undelegate", function( assert ) {
+QUnit[ jQuery.fn.delegate ? "test" : "skip" ]( "delegate/undelegate", function( assert ) {
        assert.expect( 2 );
 
        var markup = jQuery(
@@ -95,6 +95,45 @@ QUnit[ jQuery.fn.click ? "test" : "skip" ]( "trigger() shortcuts", function( ass
        assert.equal( clickCounter, 1, "Check that click, triggers onclick event handler on an a tag also" );
 } );
 
+if ( jQuery.ajax && jQuery.fn.ajaxSend ) {
+       ajaxTest( "jQuery.ajax() - events with context", 12, function( assert ) {
+               var context = document.createElement( "div" );
+
+               function event( e ) {
+                       assert.equal( this, context, e.type );
+               }
+
+               function callback( msg ) {
+                       return function() {
+                               assert.equal( this, context, "context is preserved on callback " + msg );
+                       };
+               }
+
+               return {
+                       setup: function() {
+                               jQuery( context ).appendTo( "#foo" )
+                                       .ajaxSend( event )
+                                       .ajaxComplete( event )
+                                       .ajaxError( event )
+                                       .ajaxSuccess( event );
+                       },
+                       requests: [ {
+                               url: url( "name.html" ),
+                               context: context,
+                               beforeSend: callback( "beforeSend" ),
+                               success: callback( "success" ),
+                               complete: callback( "complete" )
+                       }, {
+                               url: url( "404.txt" ),
+                               context: context,
+                               beforeSend: callback( "beforeSend" ),
+                               error: callback( "error" ),
+                               complete: callback( "complete" )
+                       } ]
+               };
+       } );
+}
+
 QUnit[ jQuery.fn.click ? "test" : "skip" ]( "Event aliases", function( assert ) {
 
        // Explicitly skipping focus/blur events due to their flakiness
@@ -113,7 +152,7 @@ QUnit[ jQuery.fn.click ? "test" : "skip" ]( "Event aliases", function( assert )
        } );
 } );
 
-QUnit.test( "jQuery.proxy", function( assert ) {
+QUnit[ jQuery.proxy ? "test" : "skip" ]( "jQuery.proxy", function( assert ) {
        assert.expect( 9 );
 
        var test2, test3, test4, fn, cb,
@@ -161,7 +200,7 @@ QUnit.test( "jQuery.proxy", function( assert ) {
        cb.call( thisObject, "arg3" );
 } );
 
-QUnit.test( "trim", function( assert ) {
+QUnit[ jQuery.trim ? "test" : "skip" ]( "trim", function( assert ) {
        assert.expect( 13 );
 
        var nbsp = String.fromCharCode( 160 );
index 4019fbe814b6adb423611afedae6ea43e4179f76..cecad3f345d667a1eec79d1abed85cd4edd28a23 100644 (file)
@@ -1317,7 +1317,7 @@ QUnit.test( "Delegated events with malformed selectors (gh-3071)", function( ass
                jQuery( "#foo" ).on( "click", "nonexistent:not", function() {} );
        }, "short-circuitable malformed selector throws on attach" );
 
-       jQuery( "#foo > :first-child" ).click();
+       jQuery( "#foo > :first-child" ).trigger( "click" );
        assert.ok( true, "malformed selector does not throw on event" );
 } );
 
@@ -2495,7 +2495,7 @@ QUnit.test( "drag/drop events copy mouse-related event properties (gh-1925, gh-2
 
        fireNative( $fixture[ 0 ], "drop" );
 
-       $fixture.unbind( "dragmove drop" ).remove();
+       $fixture.off( "dragmove drop" ).remove();
 } );
 
 QUnit.test( "focusin using non-element targets", function( assert ) {
@@ -2548,7 +2548,8 @@ testIframe(
        function( assert, jQuery, window, document, isOk ) {
                assert.expect( 1 );
                assert.ok( isOk, "$.when( $.ready ) works" );
-       }
+       },
+       jQuery.when ? QUnit.test : QUnit.skip
 );
 
 // need PHP here to make the incepted IFRAME hang
index fa944bcebf4b5ee632a2871c21f0843434f1801a..b71a547992cc1bad4511b51bdc7a5dd4eb618738 100644 (file)
@@ -2400,7 +2400,6 @@ QUnit.test( "html() - script exceptions bubble (#11743)", function( assert ) {
                        assert.ok( true, "Exception ignored" );
                } else {
                        assert.ok( true, "No jQuery.ajax" );
-                       assert.ok( true, "No jQuery.ajax" );
                }
        };
 
@@ -2490,7 +2489,7 @@ QUnit.test( "script evaluation (#11795)", function( assert ) {
        }
 } );
 
-QUnit.test( "jQuery._evalUrl (#12838)", function( assert ) {
+QUnit[ jQuery.ajax ? "test" : "skip" ]( "jQuery._evalUrl (#12838)", function( assert ) {
 
        assert.expect( 5 );
 
@@ -2788,7 +2787,8 @@ QUnit.test( "Make sure tags with single-character names are found (gh-4124)", fu
        assert.strictEqual( htmlOut, htmlIn );
 } );
 
-QUnit.test( "Insert script with data-URI (gh-1887)", function( assert ) {
+// The AJAX module is needed for jQuery._evalUrl.
+QUnit[ jQuery.ajax ? "test" : "skip" ]( "Insert script with data-URI (gh-1887)", function( assert ) {
        assert.expect( 1 );
 
        Globals.register( "testFoo" );
@@ -2869,10 +2869,11 @@ testIframe(
                } );
        },
 
+       // The AJAX module is needed for jQuery._evalUrl.
        // Support: Edge <=18+
        // Edge doesn't support nonce in non-inline scripts.
        // See https://web.archive.org/web/20171203124125/https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/13246371/
-       QUnit[ /\bedge\//i.test( navigator.userAgent ) ? "skip" : "test" ]
+       QUnit[ jQuery.ajax && !/\bedge\//i.test( navigator.userAgent ) ? "test" : "skip" ]
 );
 
 testIframe(
index df7eaf4ca7b42f2bc773efc5f2bdf2081650d8e6..7735544bce34004729ac24ca1694d149329128ba 100644 (file)
@@ -1,5 +1,11 @@
 QUnit.module( "queue", { afterEach: moduleTeardown } );
 
+( function() {
+
+if ( !jQuery.fn.queue ) {
+       return;
+}
+
 QUnit.test( "queue() with other types", function( assert ) {
        var done = assert.async( 2 );
        assert.expect( 14 );
@@ -329,3 +335,5 @@ QUnit[ jQuery.fn.stop ? "test" : "skip" ]( "queue stop hooks", function( assert
 
        foo.stop( false, true );
 } );
+
+} )();
index d3396b1c49731a556d760b3a05f81356cce22079..fd33c0a18fc887de5005a577319d5cec6be0c248 100644 (file)
@@ -2,7 +2,7 @@ QUnit.module( "ready" );
 
 ( function() {
        var notYetReady, noEarlyExecution,
-               whenified = jQuery.when( jQuery.ready ),
+               whenified = jQuery.when && jQuery.when( jQuery.ready ),
                promisified = Promise.resolve( jQuery.ready ),
                start = new Date(),
                order = [],
@@ -105,7 +105,7 @@ QUnit.module( "ready" );
                } );
        } );
 
-       QUnit.test( "jQuery.when(jQuery.ready)", function( assert ) {
+       QUnit[ jQuery.when ? "test" : "skip" ]( "jQuery.when(jQuery.ready)", function( assert ) {
                assert.expect( 2 );
                var done = jQuery.map( new Array( 2 ), function() { return assert.async(); } );
 
@@ -149,15 +149,18 @@ QUnit.module( "ready" );
                } );
        } );
 
-       testIframe(
-               "holdReady test needs to be a standalone test since it deals with DOM ready",
-               "readywait.html",
-               function( assert, jQuery, window, document, releaseCalled ) {
-                       assert.expect( 2 );
-                       var now = new Date();
-                       assert.ok( now - start >= 300, "Needs to have waited at least half a second" );
-                       assert.ok( releaseCalled, "The release function was called, which resulted in ready" );
-               }
-       );
+       // jQuery.holdReady is deprecated, skip the test if it was excluded.
+       if ( jQuery.holdReady ) {
+               testIframe(
+                       "holdReady test needs to be a standalone test since it deals with DOM ready",
+                       "readywait.html",
+                       function( assert, jQuery, window, document, releaseCalled ) {
+                               assert.expect( 2 );
+                               var now = new Date();
+                               assert.ok( now - start >= 300, "Needs to have waited at least half a second" );
+                               assert.ok( releaseCalled, "The release function was called, which resulted in ready" );
+                       }
+               );
+       }
 
 } )();
index d23421ddd26752773b6bbfb5c6bf54f8707a91fc..c4e6a6c5ed71adca29679bc90dd788d492bdef7b 100644 (file)
@@ -77,7 +77,7 @@ QUnit.test( "jQuery.param()", function( assert ) {
        assert.equal( jQuery.param( params ), "", "jQuery.param( undefined ) === empty string" );
 } );
 
-QUnit.test( "jQuery.param() not affected by ajaxSettings", function( assert ) {
+QUnit[ jQuery.ajax ? "test" : "skip" ]( "jQuery.param() not affected by ajaxSettings", function( assert ) {
        assert.expect( 1 );
 
        var oldTraditional = jQuery.ajaxSettings.traditional;