diff --git a/test/unit/ajax.js b/test/unit/ajax.js index e934b22b1..a08a3755f 100644 --- a/test/unit/ajax.js +++ b/test/unit/ajax.js @@ -20,7 +20,9 @@ module( "ajax", { }); (function() { - test("Unit Testing Environment", 2, function () { + test("Unit Testing Environment", function () { + expect( 2 ); + ok( hasPHP, "Running in an environment with PHP support. The AJAX tests only run if the environment supports PHP!" ); ok( !isLocal, "Unit tests are not ran from file:// (especially in Chrome. If you must test from file:// with Chrome, run it with the --allow-file-access-from-files flag!)" ); }); @@ -1318,7 +1320,9 @@ module( "ajax", { } }); - test( "#7531 - jQuery.ajax() - Location object as url", 1, function () { + test( "#7531 - jQuery.ajax() - Location object as url", function () { + expect( 1 ); + var xhr, success = false; try { @@ -1424,7 +1428,9 @@ module( "ajax", { }); }); - test( "#9887 - jQuery.ajax() - Context with circular references (#9887)", 2, function () { + test( "#9887 - jQuery.ajax() - Context with circular references (#9887)", function () { + expect( 2 ); + var success = false, context = {}; context.field = context; @@ -1720,7 +1726,9 @@ module( "ajax", { //----------- jQuery.domManip() - test( "#11264 - jQuery.domManip() - no side effect because of ajaxSetup or global events", 1, function() { + test( "#11264 - jQuery.domManip() - no side effect because of ajaxSetup or global events", function() { + expect( 1 ); + jQuery.ajaxSetup({ type: "POST" }); @@ -2126,7 +2134,9 @@ module( "ajax", { //----------- jQuery.active - test( "jQuery.active", 1, function() { + test( "jQuery.active", function() { + expect( 1 ); + ok( jQuery.active === 0, "ajax active counter should be zero: " + jQuery.active ); }); diff --git a/test/unit/attributes.js b/test/unit/attributes.js index 43ccaacdf..cb0322834 100644 --- a/test/unit/attributes.js +++ b/test/unit/attributes.js @@ -732,7 +732,8 @@ test( "prop('tabindex')", function() { equal( jQuery("#linkWithNoHrefWithNegativeTabIndex").prop("tabindex"), -1, "anchor without href, no tabindex set" ); }); -test( "prop('tabindex', value)", 10, function() { +test( "prop('tabindex', value)", function() { + expect( 10 ); var clone, element = jQuery("#divWithNoTabIndex"); @@ -1450,7 +1451,9 @@ test( "coords returns correct values in IE6/IE7, see #10828", function() { equal( area.attr("coords"), "0,0,0,0", "did not retrieve coords correctly" ); }); -test( "should not throw at $(option).val() (#14686)", 1, function() { +test( "should not throw at $(option).val() (#14686)", function() { + expect( 1 ); + try { jQuery( "" ).val(); ok( true ); diff --git a/test/unit/core.js b/test/unit/core.js index 1c52bde3b..688fe97a6 100644 --- a/test/unit/core.js +++ b/test/unit/core.js @@ -166,7 +166,9 @@ test( "globalEval", function() { equal( window.globalEvalTest, 3, "Test context (this) is the window object" ); }); -test( "globalEval execution after script injection (#7862)", 1, function() { +test( "globalEval execution after script injection (#7862)", function() { + expect( 1 ); + var now, script = document.createElement( "script" ); @@ -1182,7 +1184,9 @@ test("jQuery.each(Object,Function)", function() { equal( i, document.styleSheets.length, "Iteration over document.styleSheets" ); }); -test("jQuery.each/map(undefined/null,Function)", 1, function() { +test("jQuery.each/map(undefined/null,Function)", function() { + expect( 1 ); + try { jQuery.each( undefined, jQuery.noop ); jQuery.each( null, jQuery.noop ); @@ -1458,7 +1462,9 @@ test("jQuery.parseJSON", function() { strictEqual( jQuery.parseJSON([ 0 ]), 0, "Input cast to string" ); }); -test("jQuery.parseXML", 8, function(){ +test("jQuery.parseXML", function(){ + expect( 8 ); + var xml, tmp; try { xml = jQuery.parseXML( "
A well-formed xml string
" ); diff --git a/test/unit/css.js b/test/unit/css.js index 43361e2d4..b4ee1e403 100644 --- a/test/unit/css.js +++ b/test/unit/css.js @@ -119,7 +119,9 @@ test("css(String|Hash)", function() { "Make sure that a string z-index is returned from css('z-index') (#14432)." ); }); -test( "css(String) computed values", 3, function() { +test( "css(String) computed values", function() { + expect( 3 ); + var div = jQuery( "" ).addClass( "get-computed-value" ), fixture = document.getElementById( "qunit-fixture" ); @@ -130,7 +132,9 @@ test( "css(String) computed values", 3, function() { }); -test( "css() explicit and relative values", 29, function() { +test( "css() explicit and relative values", function() { + expect( 29 ); + var $elem = jQuery("#nothiddendiv"); $elem.css({ "width": 1, "height": 1, "paddingLeft": "1px", "opacity": 1 }); @@ -217,7 +221,9 @@ test( "css() explicit and relative values", 29, function() { equal( $elem.css("opacity"), "1", "'+=0.5' on opacity (params)" ); }); -test( "css() non-px relative values (gh-1711)", 17, function() { +test( "css() non-px relative values (gh-1711)", function() { + expect( 17 ); + var cssCurrent, units = {}, $child = jQuery( "#nothiddendivchild" ), @@ -962,7 +968,9 @@ test("certain css values of 'normal' should be convertable to a number, see #862 // only run this test in IE9 if ( document.documentMode === 9 ) { - test( ".css('filter') returns a string in IE9, see #12537", 1, function() { + test( ".css('filter') returns a string in IE9, see #12537", function() { + expect( 1 ); + equal( jQuery("").css("filter"), "progid:DXImageTransform.Microsoft.gradient(startColorstr=#FFFFFF, endColorstr=#ECECEC)", "IE9 returns the correct value from css('filter')." ); }); } @@ -1170,7 +1178,9 @@ asyncTest( "Clearing a Cloned Element's Style Shouldn't Clear the Original Eleme window.setTimeout( start, 1000 ); }); -test( "show() after hide() should always set display to initial value (#14750)", 1, function() { +test( "show() after hide() should always set display to initial value (#14750)", function() { + expect( 1 ); + var div = jQuery( "" ), fixture = jQuery( "#qunit-fixture" ); @@ -1189,7 +1199,9 @@ test( "show() after hide() should always set display to initial value (#14750)", exist = "order" in style || "WebkitOrder" in style; if ( exist ) { - test( "Don't append px to CSS \"order\" value (#14049)", 1, function() { + test( "Don't append px to CSS \"order\" value (#14049)", function() { + expect( 1 ); + var $elem = jQuery( "" ); $elem.css( "order", 2 ); @@ -1198,7 +1210,9 @@ test( "show() after hide() should always set display to initial value (#14750)", } })(); -test( "Do not throw on frame elements from css method (#15098)", 1, function() { +test( "Do not throw on frame elements from css method (#15098)", function() { + expect( 1 ); + var frameWin, frameDoc, frameElement = document.createElement( "iframe" ), frameWrapDiv = document.createElement( "div" ); @@ -1221,7 +1235,9 @@ test( "Do not throw on frame elements from css method (#15098)", 1, function() { } }); -test( "get upper case alpha opacity in IE8", 1, function() { +test( "get upper case alpha opacity in IE8", function() { + expect( 1 ); + var div = document.createElement( "div" ), fixture = document.getElementById( "qunit-fixture" ); diff --git a/test/unit/data.js b/test/unit/data.js index 68eb589ea..1b4affb32 100644 --- a/test/unit/data.js +++ b/test/unit/data.js @@ -70,7 +70,9 @@ function dataTests( elem ) { equal( jQuery._data(elem, "foo"), "foo2", "(sanity check) jQuery.removeData for user data does not remove internal data" ); } -test("jQuery.data(div)", 25, function() { +test("jQuery.data(div)", function() { + expect( 25 ); + var div = document.createElement("div"); dataTests( div ); @@ -81,11 +83,15 @@ test("jQuery.data(div)", 25, function() { QUnit.expectJqData( this, div, "foo" ); }); -test("jQuery.data({})", 25, function() { +test("jQuery.data({})", function() { + expect( 25 ); + dataTests( {} ); }); -test("jQuery.data(window)", 25, function() { +test("jQuery.data(window)", function() { + expect( 25 ); + // remove bound handlers from window object to stop potential false positives caused by fix for #5280 in // transports/xhr.js jQuery( window ).off( "unload" ); @@ -93,13 +99,17 @@ test("jQuery.data(window)", 25, function() { dataTests( window ); }); -test("jQuery.data(document)", 25, function() { +test("jQuery.data(document)", function() { + expect( 25 ); + dataTests( document ); QUnit.expectJqData( this, document, "foo" ); }); -test("Expando cleanup", 4, function() { +test("Expando cleanup", function() { + expect( 4 ); + var div = document.createElement("div"); function assertExpandoAbsent(message) { @@ -161,7 +171,9 @@ test("jQuery.acceptData", function() { }); // attempting to access the data of an undefined jQuery element should be undefined -test("jQuery().data() === undefined (#14101)", 2, function() { +test("jQuery().data() === undefined (#14101)", function() { + expect( 2 ); + strictEqual(jQuery().data(), undefined); strictEqual(jQuery().data("key"), undefined); }); diff --git a/test/unit/dimensions.js b/test/unit/dimensions.js index f4a35981b..2eb6e73df 100644 --- a/test/unit/dimensions.js +++ b/test/unit/dimensions.js @@ -306,7 +306,9 @@ test("getting dimensions shouldn't modify runtimeStyle see #9233", function() { $div.remove(); }); -test( "table dimensions", 2, function() { +test( "table dimensions", function() { + expect( 2 ); + var table = jQuery("| a | |
| a |