Update Sizzle and add tests from the Sizzle suite that require jQuery for the selection to jquery/test/unit/selector.js

This commit is contained in:
timmywil 2012-05-28 12:18:40 -04:00
parent d0763a37c6
commit a4fc2edaab
3 changed files with 57 additions and 5 deletions

@ -1 +1 @@
Subproject commit feebbd7e053bff426444c7b348c776c99c7490ee
Subproject commit 5e4e75511d1238a8924dace6982401ab0c253202

View File

@ -1,11 +1,63 @@
/**
* This test page is for selector tests that address selector issues that have already been addressed in jQuery functions
* and which only work because jQuery has hooked into Sizzle.
* These tests may or may not fail in an independent Sizzle.
* This test page is for selector tests that require jQuery in order to do the selection
*/
module("selector - jQuery only", { teardown: moduleTeardown });
test("element - jQuery only", function() {
expect( 5 );
deepEqual( jQuery("p", document.getElementsByTagName("div")).get(), q("firstp","ap","sndp","en","sap","first"), "Finding elements with a context." );
deepEqual( jQuery("p", "div").get(), q("firstp","ap","sndp","en","sap","first"), "Finding elements with a context." );
deepEqual( jQuery("p", jQuery("div")).get(), q("firstp","ap","sndp","en","sap","first"), "Finding elements with a context." );
deepEqual( jQuery("div").find("p").get(), q("firstp","ap","sndp","en","sap","first"), "Finding elements with a context." );
//#7533
equal( jQuery("<div id=\"A'B~C.D[E]\"><p>foo</p></div>").find("p").length, 1, "Find where context root is a node and has an ID with CSS3 meta characters" );
});
test("class - jQuery only", function() {
expect( 4 );
deepEqual( jQuery(".blog", document.getElementsByTagName("p")).get(), q("mark", "simon"), "Finding elements with a context." );
deepEqual( jQuery(".blog", "p").get(), q("mark", "simon"), "Finding elements with a context." );
deepEqual( jQuery(".blog", jQuery("p")).get(), q("mark", "simon"), "Finding elements with a context." );
deepEqual( jQuery("p").find(".blog").get(), q("mark", "simon"), "Finding elements with a context." );
});
test("pseudo - visibility", function() {
expect(9);
t( "Is Visible", "div:visible:not(#qunit-testrunner-toolbar):lt(2)", ["nothiddendiv", "nothiddendivchild"] );
t( "Is Not Hidden", "#qunit-fixture:hidden", [] );
t( "Is Hidden", "#form input:hidden", ["hidden1","hidden2"] );
var $div = jQuery('<div/>').appendTo("body");
$div.css({ fontSize: 0, lineHeight: 0 });// IE also needs to set font-size and line-height to 0
$div.width(1).height(0);
t( "Is Visible", '#nothiddendivchild:visible', ['nothiddendivchild'] );
t( "Is Not Visible", '#nothiddendivchild:hidden', [] );
$div.width(0).height(1);
t( "Is Visible", '#nothiddendivchild:visible', ['nothiddendivchild'] );
t( "Is Not Visible", '#nothiddendivchild:hidden', [] );
$div.width(1).height(1);
t( "Is Visible", '#nothiddendivchild:visible', ['nothiddendivchild'] );
t( "Is Not Visible", '#nothiddendivchild:hidden', [] );
$div.remove();
});
test("disconnected nodes", function() {
expect(4);
var $opt = jQuery('<option></option>').attr("value", "whipit").appendTo("#qunit-fixture").detach();
equal( $opt.val(), "whipit", "option value" );
equal( $opt.is(":selected"), false, "unselected option" );
$opt.attr("selected", true);
equal( $opt.is(":selected"), true, "selected option" );
var $div = jQuery( '<div/>' );
equal( $div.is("div"), true, "Make sure .is('nodeName') works on disconnect nodes." );
});
testIframe("selector/html5_selector", "attributes - jQuery.attr", function( jQuery, window, document ) {
expect(34);