Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 15 additions & 5 deletions test/unit/ajax.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,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!)" );
});
Expand Down Expand Up @@ -1288,7 +1290,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 {
Expand Down Expand Up @@ -1389,7 +1393,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;
Expand Down Expand Up @@ -1699,7 +1705,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"
});
Expand Down Expand Up @@ -2086,7 +2094,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 );
});

Expand Down
7 changes: 5 additions & 2 deletions test/unit/attributes.js
Original file line number Diff line number Diff line change
Expand Up @@ -734,7 +734,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");
Expand Down Expand Up @@ -1452,7 +1453,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( "<option/>" ).val();
ok( true );
Expand Down
12 changes: 9 additions & 3 deletions test/unit/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,9 @@ test( "globalEval with 'use strict'", function() {
equal( window.strictEvalTest, 1, "Test variable declarations are global (strict mode)" );
});

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" );

Expand Down Expand Up @@ -1198,7 +1200,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 );
Expand Down Expand Up @@ -1477,7 +1481,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( "<p>A <b>well-formed</b> xml string</p>" );
Expand Down
24 changes: 18 additions & 6 deletions test/unit/css.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,9 @@ test("css(String|Hash)", function() {
"Make sure that a string z-index is returned from css('z-index') (#14432)." );
});

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 });
Expand Down Expand Up @@ -203,7 +205,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" ),
Expand Down Expand Up @@ -903,7 +907,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("<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')." );
});
}
Expand Down Expand Up @@ -1111,7 +1117,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( "<div />" ),
fixture = jQuery( "#qunit-fixture" );

Expand All @@ -1130,7 +1138,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( "<div/>" );

$elem.css( "order", 2 );
Expand All @@ -1139,7 +1149,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" );
Expand Down
32 changes: 24 additions & 8 deletions test/unit/data.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,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 );
Expand All @@ -137,37 +139,49 @@ 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" );

dataTests( window );
});

test("jQuery.data(document)", 25, function() {
test("jQuery.data(document)", function() {
expect( 25 );

dataTests( document );

QUnit.expectJqData( this, document, "foo" );
});

test("jQuery.data(<embed>)", 25, function() {
test("jQuery.data(<embed>)", function() {
expect( 25 );

dataTests( document.createElement("embed") );
});

test("jQuery.data(object/flash)", 25, function() {
test("jQuery.data(object/flash)", function() {
expect( 25 );

var flash = document.createElement("object");
flash.setAttribute( "classid", "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" );

dataTests( flash );
});

// 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);
});
Expand Down Expand Up @@ -826,7 +840,9 @@ test("jQuery.acceptData", function() {
"form with aliased DOM properties" );
});

test("Check proper data removal of non-element descendants nodes (#8335)", 1, function() {
test("Check proper data removal of non-element descendants nodes (#8335)", function() {
expect( 1 );

var div = jQuery("<div>text</div>"),
text = div.contents();

Expand Down
8 changes: 6 additions & 2 deletions test/unit/dimensions.js
Original file line number Diff line number Diff line change
Expand Up @@ -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("<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 );
Expand Down Expand Up @@ -460,7 +462,9 @@ testIframe( "dimensions/documentLarge", "window vs. large document", function( j
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" );

Expand Down
Loading