Commit a4fc2eda authored by timmywil's avatar timmywil

Update Sizzle and add tests from the Sizzle suite that require jQuery for the...

Update Sizzle and add tests from the Sizzle suite that require jQuery for the selection to jquery/test/unit/selector.js
parent d0763a37
Subproject commit feebbd7e053bff426444c7b348c776c99c7490ee Subproject commit 5e4e75511d1238a8924dace6982401ab0c253202
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
<script src="unit/exports.js"></script> <script src="unit/exports.js"></script>
<script> <script>
// html5shiv, enabling HTML5 elements to be used with jQuery // html5shiv, enabling HTML5 elements to be used with jQuery
( "abbr article aside audio bdi canvas data details figcaption figure footer header hgroup " + ( "abbr article aside audio bdi canvas data details figcaption figure footer header hgroup " +
"mark meter nav output progress section summary time video" "mark meter nav output progress section summary time video"
).replace(/\w+/g, function(n) { ).replace(/\w+/g, function(n) {
......
/** /**
* This test page is for selector tests that address selector issues that have already been addressed in jQuery functions * This test page is for selector tests that require jQuery in order to do the selection
* and which only work because jQuery has hooked into Sizzle.
* These tests may or may not fail in an independent Sizzle.
*/ */
module("selector - jQuery only", { teardown: moduleTeardown }); 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 ) { testIframe("selector/html5_selector", "attributes - jQuery.attr", function( jQuery, window, document ) {
expect(34); expect(34);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment