});
(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!)" );
});
}
});
- 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 {
});
});
- 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;
//----------- 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"
});
//----------- 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 );
});
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");
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( "<option/>" ).val();
ok( true );
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" );
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 );
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( "<p>A <b>well-formed</b> xml string</p>" );
"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( "<div/>" ).addClass( "get-computed-value" ),
fixture = document.getElementById( "qunit-fixture" );
});
-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 });
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" ),
// 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("<div style='-ms-filter:\"progid:DXImageTransform.Microsoft.gradient(startColorstr=#FFFFFF, endColorstr=#ECECEC)\";'></div>").css("filter"), "progid:DXImageTransform.Microsoft.gradient(startColorstr=#FFFFFF, endColorstr=#ECECEC)", "IE9 returns the correct value from css('filter')." );
});
}
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( "<div />" ),
fixture = jQuery( "#qunit-fixture" );
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( "<div/>" );
$elem.css( "order", 2 );
}
})();
-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" );
}
});
-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" );
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 );
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" );
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) {
});
// 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);
});
$div.remove();
});
-test( "table dimensions", 2, function() {
+test( "table dimensions", function() {
+ expect( 2 );
+
var table = jQuery("<table><colgroup><col/><col/></colgroup><tbody><tr><td></td><td>a</td></tr><tr><td></td><td>a</td></tr></tbody></table>").appendTo("#qunit-fixture"),
tdElem = table.find("td").first(),
colElem = table.find("col").first().width( 300 );
ok( jQuery( document ).width() > jQuery( window ).width(), "document width is larger than window width" );
});
-test( "allow modification of coordinates argument (gh-1848)", 1, function() {
+test( "allow modification of coordinates argument (gh-1848)", function() {
+ expect( 1 );
+
var offsetTop,
element = jQuery( "<div/>" ).appendTo( "#qunit-fixture" );
equal( jQuery("#dl:visible, #qunit-fixture:visible, #foo:visible").length, 3, "QUnit state is correct for testing effects" );
});
-test("show() basic", 1, function() {
+test("show() basic", function() {
+ expect( 1 );
+
var div = jQuery("<div>").hide().appendTo("#qunit-fixture").show();
equal( div.css("display"), "block", "Make sure pre-hidden divs show" );
div.remove();
});
-test("show()", 27, function () {
+test("show()", function () {
+ expect( 27 );
+
var div, speeds, test,
displaysActual, displaysExpected,
hiddendiv = jQuery("div.hidden");
ok( x.is(":visible"), "is visible again" );
});
-test( "jQuery.fx.prototype.cur() - <1.8 Back Compat", 7, function() {
+test( "jQuery.fx.prototype.cur() - <1.8 Back Compat", function() {
+ expect( 7 );
+
var div = jQuery( "<div></div>" ).appendTo( "#qunit-fixture" ).css({
color: "#ABC",
border: "5px solid black",
this.clock.tick( 10 );
});
-test("animate unit-less properties (#4966)", 2, function() {
+test("animate unit-less properties (#4966)", function() {
+ expect( 2 );
+
var div = jQuery( "<div style='z-index: 0; position: absolute;'></div>" ).appendTo( "#qunit-fixture" );
equal( div.css( "z-index" ), "0", "z-index is 0" );
div.animate({ zIndex: 2 }, function() {
this.clock.tick( 400 );
});
-test( "animate properties missing px w/ opacity as last (#9074)", 2, function() {
+test( "animate properties missing px w/ opacity as last (#9074)", function() {
+ expect( 2 );
+
expect( 6 );
var ml, l,
div = jQuery( "<div style='position: absolute; margin-left: 0; left: 0px;'></div>" )
});
});
-test("Do not append px to 'fill-opacity' #9548", 1, function() {
+test("Do not append px to 'fill-opacity' #9548", function() {
+ expect( 1 );
+
var $div = jQuery("<div>").appendTo("#qunit-fixture");
$div.css("fill-opacity", 0).animate({ "fill-opacity": 1.0 }, 0, function () {
});
});
-test("line-height animates correctly (#13855)", 12, function() {
+test("line-height animates correctly (#13855)", function() {
+ expect( 12 );
+
var t0,
clock = this.clock,
longDuration = 2000,
});
// Start 1.8 Animation tests
-test( "jQuery.Animation( object, props, opts )", 4, function() {
+test( "jQuery.Animation( object, props, opts )", function() {
+ expect( 4 );
+
var animation,
testObject = {
"foo": 0,
this.clock.tick( 10 );
});
-test( "Animate Option: step: function( percent, tween )", 1, function() {
+test( "Animate Option: step: function( percent, tween )", function() {
+ expect( 1 );
+
var counter = {};
jQuery( "#foo" ).animate({
prop1: 1,
this.clock.tick( 10 );
});
-test( "Animate callbacks have correct context", 2, function() {
+test( "Animate callbacks have correct context", function() {
+ expect( 2 );
+
var foo = jQuery( "#foo" );
foo.animate({
height: 10
this.clock.tick( 10 );
});
-test( "User supplied callback called after show when fx off (#8892)", 2, function() {
+test( "User supplied callback called after show when fx off (#8892)", function() {
+ expect( 2 );
+
var foo = jQuery( "#foo" );
jQuery.fx.off = true;
foo.hide();
clock.tick( 400 );
});
-test("Animation callback should not show animated element as :animated (#7157)", 1, function() {
+test("Animation callback should not show animated element as :animated (#7157)", function() {
+ expect( 1 );
+
var foo = jQuery( "#foo" );
foo.animate({
this.clock.tick( 100 );
});
-test("Initial step callback should show element as :animated (#14623)", 1, function() {
+test("Initial step callback should show element as :animated (#14623)", function() {
+ expect( 1 );
+
var foo = jQuery( "#foo" );
foo.animate({
foo.stop();
});
-test( "hide called on element within hidden parent should set display to none (#10045)", 3, function() {
+test( "hide called on element within hidden parent should set display to none (#10045)", function() {
+ expect( 3 );
+
var hidden = jQuery(".hidden"),
elems = jQuery("<div>hide</div><div>hide0</div><div>hide1</div>");
this.clock.tick( 10 );
});
-test( "hide, fadeOut and slideUp called on element width height and width = 0 should set display to none", 5, function() {
+test( "hide, fadeOut and slideUp called on element width height and width = 0 should set display to none", function() {
+ expect( 5 );
+
var foo = jQuery("#foo"),
i = 0,
elems = jQuery();
this.clock.tick( 400 );
});
-test( "hide should not leave hidden inline elements visible (#14848)", 2, function() {
+test( "hide should not leave hidden inline elements visible (#14848)", function() {
+ expect( 2 );
+
var el = jQuery("#simon1");
el.hide( 1, function() {
this.clock.tick( 100 );
});
-test( "Handle queue:false promises", 10, function() {
+test( "Handle queue:false promises", function() {
+ expect( 10 );
+
var foo = jQuery( "#foo" ).clone().addBack(),
step = 1;
this.clock.tick( 10 );
});
-test( "multiple unqueued and promise", 4, function() {
+test( "multiple unqueued and promise", function() {
+ expect( 4 );
+
var foo = jQuery( "#foo" ),
step = 1;
foo.animate({
this.clock.tick( 1000 );
});
-test( "animate does not change start value for non-px animation (#7109)", 1, function() {
+test( "animate does not change start value for non-px animation (#7109)", function() {
+ expect( 1 );
+
var parent = jQuery( "<div><div></div></div>" ).css({ width: 284, height: 1 }).appendTo( "#qunit-fixture" ),
child = parent.children().css({ fontSize: "98.6in", width: "0.01em", height: 1 }),
actual = parseFloat( child.css( "width" ) ),
this.clock.tick( 10 );
});
-test( "non-px animation handles non-numeric start (#11971)", 2, function() {
+test( "non-px animation handles non-numeric start (#11971)", function() {
+ expect( 2 );
+
var foo = jQuery("#foo"),
initial = foo.css("backgroundPositionX");
this.clock.tick( 10 );
});
-test("Animation callbacks (#11797)", 15, function() {
+test("Animation callbacks (#11797)", function() {
+ expect( 15 );
+
var targets = jQuery("#foo").children(),
done = false,
expectedProgress = 0;
this.clock.tick( 10 );
});
-test( "Animate properly sets overflow hidden when animating width/height (#12117)", 8, function() {
+test( "Animate properly sets overflow hidden when animating width/height (#12117)", function() {
+ expect( 8 );
+
jQuery.each( [ "height", "width" ], function( _, prop ) {
jQuery.each( [ 100, 0 ], function( _, value ) {
var div = jQuery("<div>").css( "overflow", "auto" ),
tmp.stop();
});
-test( "Animations with 0 duration don't ease (#12273)", 1, function() {
+test( "Animations with 0 duration don't ease (#12273)", function() {
+ expect( 1 );
+
jQuery.easing.test = function() {
ok( false, "Called easing" );
};
this.clock.tick( 1500 );
});
-test( "slideDown() after stop() (#13483)", 2, function() {
+test( "slideDown() after stop() (#13483)", function() {
+ expect( 2 );
+
var ul = jQuery( "<ul style='height: 100px; display: block;'></ul>" )
.appendTo("#qunit-fixture"),
origHeight = ul.height(),
clock.tick( 10 );
});
-test( "Respect display value on inline elements (#14824)", 2, function() {
+test( "Respect display value on inline elements (#14824)", function() {
+ expect( 2 );
+
var clock = this.clock,
fromStyleSheet = jQuery( "<span id='span-14824' />" ),
fromStyleAttr = jQuery( "<span style='display: block;' />" );
}).trigger("change");
});
-test("on(), namespaced events, cloned events", 18, function() {
+test("on(), namespaced events, cloned events", function() {
+ expect( 18 );
+
var firstp = jQuery( "#firstp" );
firstp.on("custom.test",function(){
equal( triggered, 3, "foo.bar triggered" );
});
-test( "make sure events cloned correctly", 18, function() {
+test( "make sure events cloned correctly", function() {
+ expect( 18 );
+
var clone,
fixture = jQuery("#qunit-fixture"),
checkbox = jQuery("#check1"),
// This tests are unreliable in Firefox
if ( !(/firefox/i.test( window.navigator.userAgent )) ) {
- test( "Check order of focusin/focusout events", 2, function() {
+ test( "Check order of focusin/focusout events", function() {
+ expect( 2 );
+
var focus, blur,
input = jQuery( "#name" );
equal( jQuery("#nonnodes").contents().length, 0, "Check node,textnode,comment remove works" );
});
-test( "remove() event cleaning ", 1, function() {
+test( "remove() event cleaning ", function() {
+ expect( 1 );
+
var count, first, cleanUp;
count = 0;
cleanUp.remove();
});
-test( "remove() in document order #13779", 1, function() {
+test( "remove() in document order #13779", function() {
+ expect( 1 );
+
var last,
cleanData = jQuery.cleanData;
equal(jQuery("#nonnodes").contents().length, 0, "Check node,textnode,comment remove works");
});
-test( "detach() event cleaning ", 1, function() {
+test( "detach() event cleaning ", function() {
+ expect( 1 );
+
var count, first, cleanUp;
count = 0;
});
});
-test( "Index for function argument should be received (#13094)", 2, function() {
+test( "Index for function argument should be received (#13094)", function() {
+ expect( 2 );
+
var i = 0;
jQuery("<div/><div/>").before(function( index ) {
});
-test( "Make sure jQuery.fn.remove can work on elements in documentFragment", 1, function() {
+test( "Make sure jQuery.fn.remove can work on elements in documentFragment", function() {
+ expect( 1 );
+
var fragment = document.createDocumentFragment(),
div = fragment.appendChild( document.createElement("div") );
module( "queue", { teardown: moduleTeardown });
-test( "queue() with other types", 14, function() {
+test( "queue() with other types", function() {
+ expect( 14 );
+
stop();
var $div = jQuery({}),
});
-test( "wrapAll(Function)", 5, function() {
+test( "wrapAll(Function)", function() {
+ expect( 5 );
+
var prev = jQuery( "#firstp" )[ 0 ].previousSibling,
p = jQuery( "#firstp,#first" )[ 0 ].parentNode,
result = jQuery( "#firstp,#first" ).wrapAll(function() {
strictEqual( jQuery( "#first" ).parent().parent()[ 0 ].previousSibling, prev, "Correct Previous Sibling" );
});
-test( "wrapAll(Function) check execution characteristics", 3, function() {
+test( "wrapAll(Function) check execution characteristics", function() {
+ expect( 3 );
+
var i = 0;
jQuery( "non-existent" ).wrapAll(function() {
});
});
-test( "wrapAll(Function)", 5, function() {
+test( "wrapAll(Function)", function() {
+ expect( 5 );
+
var prev = jQuery( "#firstp" )[ 0 ].previousSibling,
p = jQuery( "#firstp,#first" )[ 0 ].parentNode,
result = jQuery( "#firstp,#first" ).wrapAll(function() {
strictEqual( jQuery( "#first" ).parent().parent()[ 0 ].previousSibling, prev, "Correct Previous Sibling" );
});
-test( "wrapAll(Function) check execution characteristics", 3, function() {
+test( "wrapAll(Function) check execution characteristics", function() {
+ expect( 3 );
+
var i = 0;
jQuery( "non-existent" ).wrapAll(function() {