mirror of
https://github.com/jquery/jquery.git
synced 2025-01-10 18:24:24 +00:00
Move size() test to deprecated.js and avoid in other tests. Close gh-1237.
This commit is contained in:
parent
bea0d9a49d
commit
52394ba986
@ -1799,8 +1799,7 @@ module( "ajax", {
|
||||
});
|
||||
|
||||
asyncTest( "jQuery.fn.load() - callbacks get the correct parameters", 8, function() {
|
||||
var slice = [].slice,
|
||||
completeArgs = {};
|
||||
var completeArgs = {};
|
||||
|
||||
jQuery.ajaxSetup({
|
||||
success: function( _, status, jqXHR ) {
|
||||
|
@ -1017,7 +1017,7 @@ var testAddClass = function( valueObj ) {
|
||||
var div = jQuery("#qunit-fixture div");
|
||||
div.addClass( valueObj("test") );
|
||||
var pass = true;
|
||||
for ( var i = 0; i < div.size(); i++ ) {
|
||||
for ( var i = 0; i < div.length; i++ ) {
|
||||
if ( !~div.get( i ).className.indexOf("test") ) {
|
||||
pass = false;
|
||||
}
|
||||
|
@ -677,11 +677,6 @@ test("length", function() {
|
||||
equal( jQuery("#qunit-fixture p").length, 6, "Get Number of Elements Found" );
|
||||
});
|
||||
|
||||
test("size()", function() {
|
||||
expect(1);
|
||||
equal( jQuery("#qunit-fixture p").size(), 6, "Get Number of Elements Found" );
|
||||
});
|
||||
|
||||
test("get()", function() {
|
||||
expect(1);
|
||||
deepEqual( jQuery("#qunit-fixture p").get(), q("firstp","ap","sndp","en","sap","first"), "Get All Elements" );
|
||||
@ -747,7 +742,7 @@ test("each(Function)", function() {
|
||||
var div = jQuery("div");
|
||||
div.each(function(){this.foo = "zoo";});
|
||||
var pass = true;
|
||||
for ( var i = 0; i < div.size(); i++ ) {
|
||||
for ( var i = 0; i < div.length; i++ ) {
|
||||
if ( div.get(i).foo != "zoo" ) {
|
||||
pass = false;
|
||||
}
|
||||
|
@ -528,7 +528,7 @@ test( "show() resolves correct default display for detached nodes", function(){
|
||||
equal( tr[ 0 ].style.display, trDisplay, "For detached tr elements, display should always be like for attached trs" );
|
||||
tr.remove();
|
||||
|
||||
span = span = jQuery("<span/>").hide().show();
|
||||
span = jQuery("<span/>").hide().show();
|
||||
equal( span[ 0 ].style.display, "inline", "For detached span elements, display should always be inline" );
|
||||
span.remove();
|
||||
});
|
||||
|
@ -63,7 +63,7 @@ test( "jQuery.hasData no side effects", function() {
|
||||
});
|
||||
|
||||
function dataTests (elem) {
|
||||
var oldCacheLength, dataObj, internalDataObj, expected, actual;
|
||||
var dataObj, internalDataObj;
|
||||
|
||||
equal( jQuery.data(elem, "foo"), undefined, "No data exists initially" );
|
||||
strictEqual( jQuery.hasData(elem), false, "jQuery.hasData agrees no data exists initially" );
|
||||
|
@ -1 +1,8 @@
|
||||
module("deprecated");
|
||||
module("deprecated", { teardown: moduleTeardown });
|
||||
|
||||
if ( jQuery.fn.size ) {
|
||||
test("size()", function() {
|
||||
expect(1);
|
||||
equal( jQuery("#qunit-fixture p").size(), 6, "Get Number of Elements Found" );
|
||||
});
|
||||
}
|
||||
|
18
test/unit/effects.js
vendored
18
test/unit/effects.js
vendored
@ -51,8 +51,6 @@ test("show()", 27, function () {
|
||||
|
||||
hiddendiv.css("display","");
|
||||
|
||||
var displaysActual = [],
|
||||
displaysExpected = [];
|
||||
div = jQuery("#fx-queue div").slice(0, 4);
|
||||
div.show().each(function() {
|
||||
notEqual(this.style.display, "none", "don't change any <div> with display block");
|
||||
@ -172,7 +170,7 @@ test("Persist correct display value", function() {
|
||||
|
||||
var $span = jQuery("#show-tests span"),
|
||||
displayNone = $span.css("display"),
|
||||
display = "", num = 0;
|
||||
display = "";
|
||||
|
||||
$span.show();
|
||||
|
||||
@ -609,8 +607,7 @@ test("stop() - several in queue", function() {
|
||||
expect( 5 );
|
||||
|
||||
var nw, time,
|
||||
$foo = jQuery( "#foo" ),
|
||||
w = 0;
|
||||
$foo = jQuery( "#foo" );
|
||||
|
||||
// default duration is 400ms, so 800px ensures we aren't 0 or 1 after 1ms
|
||||
$foo.hide().css( "width", 800 );
|
||||
@ -1283,8 +1280,9 @@ test("callbacks should fire in correct order (#9100)", function() {
|
||||
|
||||
stop();
|
||||
var a = 1,
|
||||
cb = 0,
|
||||
$lis = jQuery("<p data-operation='*2'></p><p data-operation='^2'></p>").appendTo("#qunit-fixture")
|
||||
cb = 0;
|
||||
|
||||
jQuery("<p data-operation='*2'></p><p data-operation='^2'></p>").appendTo("#qunit-fixture")
|
||||
// The test will always pass if no properties are animated or if the duration is 0
|
||||
.animate({fontSize: 12}, 13, function() {
|
||||
a *= jQuery(this).data("operation") === "*2" ? 2 : a;
|
||||
@ -1301,11 +1299,11 @@ asyncTest( "callbacks that throw exceptions will be removed (#5684)", function()
|
||||
|
||||
var foo = jQuery( "#foo" );
|
||||
|
||||
function testException() {
|
||||
function TestException() {
|
||||
}
|
||||
|
||||
foo.animate({ height: 1 }, 1, function() {
|
||||
throw new testException();
|
||||
throw new TestException();
|
||||
});
|
||||
|
||||
// this test thoroughly abuses undocumented methods - please feel free to update
|
||||
@ -1317,7 +1315,7 @@ asyncTest( "callbacks that throw exceptions will be removed (#5684)", function()
|
||||
setTimeout(function() {
|
||||
|
||||
// the first call to fx.tick should raise the callback exception
|
||||
raises( jQuery.fx.tick, testException, "Exception was thrown" );
|
||||
raises( jQuery.fx.tick, TestException, "Exception was thrown" );
|
||||
|
||||
// the second call shouldn't
|
||||
jQuery.fx.tick();
|
||||
|
@ -27,7 +27,7 @@ test( "queue() with other types", 14, function() {
|
||||
equal( ++counter, 4, "Dequeuing" );
|
||||
});
|
||||
|
||||
defer = $div.promise("foo").done(function() {
|
||||
$div.promise("foo").done(function() {
|
||||
equal( counter, 4, "Testing previous call to dequeue in deferred" );
|
||||
start();
|
||||
});
|
||||
@ -81,7 +81,6 @@ test("queue() passes in the next item in the queue as a parameter to fx queues",
|
||||
|
||||
div.queue(function(next) {
|
||||
equal(++counter, 1, "Dequeueing");
|
||||
var self = this;
|
||||
setTimeout(function() { next(); }, 500);
|
||||
}).queue(function(next) {
|
||||
equal(++counter, 2, "Next was called");
|
||||
@ -156,7 +155,7 @@ test("clearQueue(name) clears the queue", function() {
|
||||
counter++;
|
||||
jQuery(this).clearQueue("foo");
|
||||
next();
|
||||
}).queue("foo", function(next) {
|
||||
}).queue("foo", function( next ) {
|
||||
counter++;
|
||||
});
|
||||
|
||||
@ -180,7 +179,7 @@ test("clearQueue() clears the fx queue", function() {
|
||||
counter++;
|
||||
var self = this;
|
||||
setTimeout(function() { jQuery(self).clearQueue(); next(); }, 50);
|
||||
}).queue(function(next) {
|
||||
}).queue(function( next ) {
|
||||
counter++;
|
||||
});
|
||||
|
||||
|
@ -143,13 +143,14 @@ test("is() with :has() selectors", function() {
|
||||
test("is() with positional selectors", function() {
|
||||
expect(24);
|
||||
|
||||
var html = jQuery(
|
||||
"<p id='posp'><a class='firsta' href='#'><em>first</em></a><a class='seconda' href='#'><b>test</b></a><em></em></p>"
|
||||
).appendTo( "#qunit-fixture" ),
|
||||
isit = function(sel, match, expect) {
|
||||
var isit = function(sel, match, expect) {
|
||||
equal( jQuery( sel ).is( match ), expect, "jQuery('" + sel + "').is('" + match + "')" );
|
||||
};
|
||||
|
||||
jQuery(
|
||||
"<p id='posp'><a class='firsta' href='#'><em>first</em></a><a class='seconda' href='#'><b>test</b></a><em></em></p>"
|
||||
).appendTo( "#qunit-fixture" );
|
||||
|
||||
isit( "#posp", "#posp:first", true );
|
||||
isit( "#posp", "#posp:eq(2)", false );
|
||||
isit( "#posp", "#posp a:first", false );
|
||||
@ -271,7 +272,11 @@ test("filter(jQuery)", function() {
|
||||
test("filter() with positional selectors", function() {
|
||||
expect(19);
|
||||
|
||||
var html = jQuery( "" +
|
||||
var filterit = function(sel, filter, length) {
|
||||
equal( jQuery( sel ).filter( filter ).length, length, "jQuery( " + sel + " ).filter( " + filter + " )" );
|
||||
};
|
||||
|
||||
jQuery( "" +
|
||||
"<p id='posp'>" +
|
||||
"<a class='firsta' href='#'>" +
|
||||
"<em>first</em>" +
|
||||
@ -280,10 +285,7 @@ test("filter() with positional selectors", function() {
|
||||
"<b>test</b>" +
|
||||
"</a>" +
|
||||
"<em></em>" +
|
||||
"</p>" ).appendTo( "#qunit-fixture" ),
|
||||
filterit = function(sel, filter, length) {
|
||||
equal( jQuery( sel ).filter( filter ).length, length, "jQuery( " + sel + " ).filter( " + filter + " )" );
|
||||
};
|
||||
"</p>" ).appendTo( "#qunit-fixture" );
|
||||
|
||||
filterit( "#posp", "#posp:first", 1);
|
||||
filterit( "#posp", "#posp:eq(2)", 0 );
|
||||
@ -424,7 +426,7 @@ test("has(Element)", function() {
|
||||
deepEqual( detached.has( detached.find("i")[0] ).get(), detached.get(), "...Even when detached" );
|
||||
|
||||
var multipleParent = jQuery("#qunit-fixture, #header").has(jQuery("#sndp")[0]);
|
||||
deepEqual( obj.get(), q("qunit-fixture"), "Does not include elements that do not have the element as a descendant" );
|
||||
deepEqual( multipleParent.get(), q("qunit-fixture"), "Does not include elements that do not have the element as a descendant" );
|
||||
});
|
||||
|
||||
test("has(Selector)", function() {
|
||||
@ -459,7 +461,7 @@ test("has(Arrayish)", function() {
|
||||
deepEqual( multipleParent.get(), q("qunit-fixture"), "Does not include elements that do not have an element in the jQuery list as a descendant" );
|
||||
|
||||
var multipleHas = jQuery("#qunit-fixture").has(jQuery("#sndp, #first"));
|
||||
deepEqual( simple.get(), q("qunit-fixture"), "Only adds elements once" );
|
||||
deepEqual( multipleHas.get(), q("qunit-fixture"), "Only adds elements once" );
|
||||
});
|
||||
|
||||
test("addBack()", function() {
|
||||
|
Loading…
Reference in New Issue
Block a user