/node_modules
/test/data/core/jquery-iterability-transpiled.js
+/test/data/qunit-fixture.js
- NPM_SCRIPT=test:browserless
matrix:
include:
- # Run browser tests only on one Node.js version to save time.
- - node_js: "12"
+ - name: "Browser tests: full build, Chrome & Firefox stable"
+ node_js: "12"
env:
- NPM_SCRIPT="test:browser"
- BROWSERS="ChromeHeadless,FirefoxHeadless"
addons:
chrome: stable
firefox: latest
- # Run AMD tests.
- - node_js: "12"
+ - name: "Browser tests: slim build, Chrome stable"
+ node_js: "12"
+ env:
+ - NPM_SCRIPT="test:slim"
+ - BROWSERS="ChromeHeadless"
+ addons:
+ chrome: stable
+ - name: "Browser tests: no-deprecated build, Chrome stable"
+ node_js: "12"
+ env:
+ - NPM_SCRIPT="test:no-deprecated"
+ - BROWSERS="ChromeHeadless"
+ addons:
+ chrome: stable
+ - name: "Browser tests: AMD build, Chrome stable"
+ node_js: "12"
env:
- NPM_SCRIPT="test:amd"
- BROWSERS="ChromeHeadless"
addons:
chrome: stable
- # Run tests on Firefox ESR as well.
- - node_js: "12"
+ - name: "Browser tests: full build, Firefox ESR"
+ node_js: "12"
env:
- NPM_SCRIPT="test:browser"
- BROWSERS="FirefoxHeadless"
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"
"karma:jsdom"
] );
+ grunt.registerTask( "test:prepare", [
+ "qunit_fixture",
+ "babel:tests"
+ ] );
+
grunt.registerTask( "test", [
+ "test:prepare",
"test:fast",
"test:slow"
] );
"uglify",
"remove_map_comment",
"dist:*",
- "qunit_fixture",
+ "test:prepare",
"eslint:dist",
"test:fast",
"compare_size"
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
"test:browserless": "grunt && grunt test:slow",
"test:browser": "grunt && grunt karma:main",
"test:amd": "grunt && grunt karma:amd",
- "test": "grunt && grunt test:slow && grunt karma:main && 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:amd",
"jenkins": "npm run test:browserless"
},
"commitplease": {
"./ajax/var/rquery",
"./core/init",
- "./ajax/parseXML",
+ "./core/parseXML",
"./event/trigger",
"./deferred",
"./serialize" // jQuery.param
+++ /dev/null
-define( [
- "../core"
-], function( jQuery ) {
-
-"use strict";
-
-// Cross-browser xml parsing
-jQuery.parseXML = function( data ) {
- var xml;
- if ( !data || typeof data !== "string" ) {
- return null;
- }
-
- // Support: IE 9 - 11 only
- // 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;
-};
-
-return jQuery.parseXML;
-
-} );
--- /dev/null
+define( [
+ "../core"
+], function( jQuery ) {
+
+"use strict";
+
+// Cross-browser xml parsing
+jQuery.parseXML = function( data ) {
+ var xml;
+ if ( !data || typeof data !== "string" ) {
+ return null;
+ }
+
+ // Support: IE 9 - 11 only
+ // 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;
+};
+
+return jQuery.parseXML;
+
+} );
"./ajax/script",
"./ajax/jsonp",
"./ajax/load",
+ "./core/parseXML",
+ "./core/parseHTML",
"./effects",
"./effects/animatedSelector",
"./offset",
<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>
<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>
<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>
<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();
<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>
<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>
<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>
<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>
+++ /dev/null
-// Generated by build/tasks/qunit_fixture.js
-QUnit.config.fixture = "<p id=\"firstp\">See <a id=\"simon1\" href=\"http://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=\"http://www.google.com/\" title=\"Google!\">Google</a>,\n\t<a id=\"groups\" href=\"http://groups.google.com/\" class=\"GROUPS\">Google Groups (Link)</a>.\n\tThis link has <code><a href=\"http://smin\" id=\"anchor1\">class=\"blog\"</a></code>:\n\t<a href=\"http://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=\"http://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=\"http://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>\n\t<span id=\"台北\" lang=\"中文\"></span>\n\t<span id=\"utf8class1\" class=\"台北Táiběi 台北\"></span>\n\t<span id=\"utf8class2\" class=\"台北\"></span>\n\t<span id=\"foo:bar\" class=\"foo:bar\"></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<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=\"no-clone-exception\"><object><embed></embed></object></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<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' name='div'>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";
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" );
} );
},
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" ),
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" );
} );
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();
}
} );
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();
} );
( function() {
+if ( !jQuery.Callbacks ) {
+ return;
+}
+
+( function() {
+
var output,
addToOutput = function( string ) {
return function() {
cb.fire();
assert.equal( fired, 11, "Post-lock() fire ignored" );
} );
+
+} )();
QUnit.test( ".data supports interoperable removal of hyphenated/camelCase properties", function( assert ) {
var div = jQuery( "<div/>", { id: "hyphened" } ).appendTo( "#qunit-fixture" ),
+ rdashAlpha = /-([a-z])/g,
datas = {
"non-empty": "a string",
"empty-string": "",
assert.expect( 27 );
+ function fcamelCase( all, letter ) {
+ return letter.toUpperCase();
+ }
+
jQuery.each( datas, function( key, val ) {
div.data( key, val );
assert.deepEqual( div.data( key ), val, "get: " + key );
- assert.deepEqual( div.data( jQuery.camelCase( key ) ), val, "get: " + jQuery.camelCase( key ) );
+ assert.deepEqual(
+ div.data( key.replace( rdashAlpha, fcamelCase ) ),
+ val,
+ "get: " + key.replace( rdashAlpha, fcamelCase )
+ );
div.removeData( key );
afterEach: moduleTeardown
} );
+( function() {
+
+if ( !jQuery.Deferred ) {
+ return;
+}
+
jQuery.each( [ "", " - new operator" ], function( _, withNew ) {
function createDeferred( fn ) {
when = "after";
} );
+
+} )();
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(
.remove();
} );
-QUnit.test( "delegate/undelegate", function( assert ) {
+QUnit[ jQuery.fn.delegate ? "test" : "skip" ]( "delegate/undelegate", function( assert ) {
assert.expect( 2 );
var markup = jQuery(
.remove();
} );
-if ( jQuery.fn.hover ) {
- QUnit.test( "hover() mouseenter mouseleave", function( assert ) {
- assert.expect( 1 );
-
- var times = 0,
- handler1 = function() { ++times; },
- handler2 = function() { ++times; };
-
- jQuery( "#firstp" )
- .hover( handler1, handler2 )
- .mouseenter().mouseleave()
- .off( "mouseenter", handler1 )
- .off( "mouseleave", handler2 )
- .hover( handler1 )
- .mouseenter().mouseleave()
- .off( "mouseenter mouseleave", handler1 )
- .mouseenter().mouseleave();
-
- assert.equal( times, 4, "hover handlers fired" );
+QUnit[ jQuery.fn.hover ? "test" : "skip" ]( "hover() mouseenter mouseleave", function( assert ) {
+ assert.expect( 1 );
- } );
-}
+ var times = 0,
+ handler1 = function() { ++times; },
+ handler2 = function() { ++times; };
+
+ jQuery( "#firstp" )
+ .hover( handler1, handler2 )
+ .mouseenter().mouseleave()
+ .off( "mouseenter", handler1 )
+ .off( "mouseleave", handler2 )
+ .hover( handler1 )
+ .mouseenter().mouseleave()
+ .off( "mouseenter mouseleave", handler1 )
+ .mouseenter().mouseleave();
+
+ assert.equal( times, 4, "hover handlers fired" );
+} );
QUnit[ jQuery.fn.click ? "test" : "skip" ]( "trigger() shortcuts", function( assert ) {
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
} );
} );
-QUnit.test( "jQuery.parseJSON", function( assert ) {
+QUnit[ jQuery.parseJSON ? "test" : "skip" ]( "jQuery.parseJSON", function( assert ) {
assert.expect( 20 );
assert.strictEqual( jQuery.parseJSON( null ), null, "primitive null" );
assert.strictEqual( jQuery.parseJSON( [ 0 ] ), 0, "Input cast to string" );
} );
-QUnit.test( "jQuery.isArray", function( assert ) {
+QUnit[ jQuery.isArray ? "test" : "skip" ]( "jQuery.isArray", function( assert ) {
assert.expect( 1 );
assert.strictEqual( jQuery.isArray, Array.isArray, "Array.isArray equals jQuery.isArray" );
} );
-QUnit.test( "jQuery.nodeName", function( assert ) {
+QUnit[ jQuery.nodeName ? "test" : "skip" ]( "jQuery.nodeName", function( assert ) {
assert.expect( 8 );
assert.strictEqual( typeof jQuery.nodeName, "function", "jQuery.nodeName is a function" );
} );
-QUnit.test( "type", function( assert ) {
+QUnit[ jQuery.type ? "test" : "skip" ]( "type", function( assert ) {
assert.expect( 28 );
assert.equal( jQuery.type( null ), "null", "null" );
assert.equal( jQuery.type( new MyObject() ), "object", "Object" );
} );
-QUnit[ typeof Symbol === "function" ? "test" : "skip" ]( "type for `Symbol`", function( assert ) {
+QUnit[ jQuery.type && typeof Symbol === "function" ? "test" : "skip" ](
+ "type for `Symbol`", function( assert ) {
assert.expect( 2 );
assert.equal( jQuery.type( Symbol() ), "symbol", "Symbol" );
assert.equal( jQuery.type( Object( Symbol() ) ), "symbol", "Symbol" );
} );
-QUnit.test( "isFunction", function( assert ) {
+QUnit[ jQuery.isFunction ? "test" : "skip" ]( "isFunction", function( assert ) {
assert.expect( 20 );
var mystr, myarr, myfunction, fn, obj, nodes, first, input, a;
} );
} );
-QUnit.test( "isFunction(cross-realm function)", function( assert ) {
+QUnit[ jQuery.isFunction ? "test" : "skip" ]( "isFunction(cross-realm function)", function( assert ) {
assert.expect( 1 );
var iframe, doc,
fn = Function( "return " + source )();
} catch ( e ) {}
- QUnit[ fn ? "test" : "skip" ]( "isFunction(" + subclass + ")",
+ QUnit[ jQuery.isFunction && fn ? "test" : "skip" ]( "isFunction(" + subclass + ")",
function( assert ) {
assert.expect( 1 );
}
);
-QUnit[ typeof Symbol === "function" && Symbol.toStringTag ? "test" : "skip" ](
+QUnit[ jQuery.isFunction && typeof Symbol === "function" && Symbol.toStringTag ? "test" : "skip" ](
"isFunction(custom @@toStringTag)",
function( assert ) {
assert.expect( 2 );
}
);
-QUnit.test( "jQuery.isWindow", function( assert ) {
+QUnit[ jQuery.isWindow ? "test" : "skip" ]( "jQuery.isWindow", function( assert ) {
assert.expect( 14 );
assert.ok( jQuery.isWindow( window ), "window" );
assert.ok( !jQuery.isWindow( function() {} ), "function" );
} );
-QUnit.test( "jQuery.camelCase()", function( assert ) {
+QUnit[ jQuery.camelCase ? "test" : "skip" ]( "jQuery.camelCase()", function( assert ) {
var tests = {
"foo-bar": "fooBar",
} );
} );
-QUnit.test( "jQuery.now", function( assert ) {
+QUnit[ jQuery.now ? "test" : "skip" ]( "jQuery.now", function( assert ) {
assert.expect( 1 );
assert.ok( typeof jQuery.now() === "number", "jQuery.now is a function" );
} );
-QUnit.test( "jQuery.proxy", function( assert ) {
+QUnit[ jQuery.proxy ? "test" : "skip" ]( "jQuery.proxy", function( assert ) {
assert.expect( 9 );
var test2, test3, test4, fn, cb,
cb.call( thisObject, "arg3" );
} );
-QUnit.test( "isNumeric", function( assert ) {
+QUnit[ jQuery.isNumeric ? "test" : "skip" ]( "isNumeric", function( assert ) {
assert.expect( 43 );
var t = jQuery.isNumeric,
assert.equal( t( new Date() ), false, "Instance of a Date" );
} );
-QUnit[ typeof Symbol === "function" ? "test" : "skip" ]( "isNumeric(Symbol)", function( assert ) {
+QUnit[ jQuery.isNumeric && typeof Symbol === "function" ? "test" : "skip" ](
+ "isNumeric(Symbol)", function( assert ) {
assert.expect( 2 );
assert.equal( jQuery.isNumeric( Symbol() ), false, "Symbol" );
assert.equal( jQuery.isNumeric( Object( Symbol() ) ), false, "Symbol inside an object" );
} );
-QUnit.test( "trim", function( assert ) {
+QUnit[ jQuery.trim ? "test" : "skip" ]( "trim", function( assert ) {
assert.expect( 13 );
var nbsp = String.fromCharCode( 160 );
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" );
} );
fireNative( $fixture[ 0 ], "drop" );
- $fixture.unbind( "dragmove drop" ).remove();
+ $fixture.off( "dragmove drop" ).remove();
} );
QUnit.test( "focusin using non-element targets", function( assert ) {
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
assert.ok( true, "Exception ignored" );
} else {
assert.ok( true, "No jQuery.ajax" );
- assert.ok( true, "No jQuery.ajax" );
}
};
}
} );
-QUnit.test( "jQuery._evalUrl (#12838)", function( assert ) {
+QUnit[ jQuery.ajax ? "test" : "skip" ]( "jQuery._evalUrl (#12838)", function( assert ) {
assert.expect( 5 );
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" );
Globals.register( "testSrcFoo" );
} );
},
+ // The AJAX module is needed for jQuery._evalUrl.
// Support: Edge 18+, iOS 7-9 only, Android 4.0-4.4 only
// 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/
// Old iOS & Android Browser versions support script-src but not nonce, making this test
// impossible to run. Browsers not supporting CSP at all are not a problem as they'll skip
// script-src restrictions completely.
- QUnit[ /\bedge\/|iphone os [789]|android 4\./i.test( navigator.userAgent ) ? "skip" : "test" ]
+ QUnit[ jQuery.ajax && !/\bedge\/|iphone os [789]|android 4\./i.test( navigator.userAgent ) ? "test" : "skip" ]
);
testIframe(
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 );
assert.strictEqual( promise, obj, ".promise(type, obj) returns obj" );
} );
-if ( jQuery.fn.stop ) {
- QUnit.test( "delay() can be stopped", function( assert ) {
- var done = assert.async();
- assert.expect( 3 );
- var storage = {};
- jQuery( {} )
- .queue( "alternate", function( next ) {
- storage.alt1 = true;
- assert.ok( true, "This first function was dequeued" );
- next();
- } )
- .delay( 1000, "alternate" )
- .queue( "alternate", function() {
- storage.alt2 = true;
- assert.ok( true, "The function was dequeued immediately, the delay was stopped" );
- } )
- .dequeue( "alternate" )
-
- // stop( "alternate", false ) will NOT clear the queue, so it should automatically dequeue the next
- .stop( "alternate", false, false )
-
- // this test
- .delay( 1 )
- .queue( function() {
- storage.default1 = true;
- assert.ok( false, "This queue should never run" );
- } )
-
- // stop( clearQueue ) should clear the queue
- .stop( true, false );
-
- assert.deepEqual( storage, { alt1: true, alt2: true }, "Queue ran the proper functions" );
+QUnit[ jQuery.fn.stop ? "test" : "skip" ]( "delay() can be stopped", function( assert ) {
+ var done = assert.async();
+ assert.expect( 3 );
+ var storage = {};
+ jQuery( {} )
+ .queue( "alternate", function( next ) {
+ storage.alt1 = true;
+ assert.ok( true, "This first function was dequeued" );
+ next();
+ } )
+ .delay( 1000, "alternate" )
+ .queue( "alternate", function() {
+ storage.alt2 = true;
+ assert.ok( true, "The function was dequeued immediately, the delay was stopped" );
+ } )
+ .dequeue( "alternate" )
- setTimeout( function() {
- done();
- }, 1500 );
- } );
+ // stop( "alternate", false ) will NOT clear the queue, so it should automatically dequeue the next
+ .stop( "alternate", false, false )
- QUnit.test( "queue stop hooks", function( assert ) {
- assert.expect( 2 );
- var done = assert.async();
- var foo = jQuery( "#foo" );
+ // this test
+ .delay( 1 )
+ .queue( function() {
+ storage.default1 = true;
+ assert.ok( false, "This queue should never run" );
+ } )
- foo.queue( function( next, hooks ) {
- hooks.stop = function( gotoEnd ) {
- assert.equal( !!gotoEnd, false, "Stopped without gotoEnd" );
- };
- } );
- foo.stop();
+ // stop( clearQueue ) should clear the queue
+ .stop( true, false );
- foo.queue( function( next, hooks ) {
- hooks.stop = function( gotoEnd ) {
- assert.equal( gotoEnd, true, "Stopped with gotoEnd" );
- done();
- };
- } );
+ assert.deepEqual( storage, { alt1: true, alt2: true }, "Queue ran the proper functions" );
+
+ setTimeout( function() {
+ done();
+ }, 1500 );
+} );
+
+QUnit[ jQuery.fn.stop ? "test" : "skip" ]( "queue stop hooks", function( assert ) {
+ assert.expect( 2 );
+ var done = assert.async();
+ var foo = jQuery( "#foo" );
+
+ foo.queue( function( next, hooks ) {
+ hooks.stop = function( gotoEnd ) {
+ assert.equal( !!gotoEnd, false, "Stopped without gotoEnd" );
+ };
+ } );
+ foo.stop();
- foo.stop( false, true );
+ foo.queue( function( next, hooks ) {
+ hooks.stop = function( gotoEnd ) {
+ assert.equal( gotoEnd, true, "Stopped with gotoEnd" );
+ done();
+ };
} );
-} // if ( jQuery.fn.stop )
+ foo.stop( false, true );
+} );
+
+} )();
( 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 = [],
} );
} );
- 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(); } );
} );
} );
- 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" );
+ }
+ );
+ }
} )();
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;
);
( function() {
- var expected,
+ var browserKey, expected,
userAgent = window.navigator.userAgent,
expectedMap = {
edge: {
}
};
+ // Make the slim build pass tests.
+ for ( browserKey in expectedMap ) {
+ if ( !jQuery.ajax ) {
+ delete expectedMap[ browserKey ].ajax;
+ delete expectedMap[ browserKey ].cors;
+ }
+ }
+
if ( /edge\//i.test( userAgent ) ) {
expected = expectedMap.edge;
} else if ( /(msie 10\.0|trident\/7\.0)/i.test( userAgent ) ) {