Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Test: Update index.html to new QUnit format. Close gh-1061.

Depends on jquery/sizzle#177, included with the Sizzle submodule in this commit.
  • Loading branch information...
commit 55313d32a22246fa1e09c3d66713632359848806 1 parent d41b983
Timo Tijhof Krinkle authored dmethvin committed
2  src/sizzle
... ... @@ -1 +1 @@
1   -Subproject commit 8d91687e64f137fac70a8f88d361c5bbb688299f
  1 +Subproject commit 71467207315eaac67dc6ba00992fe0f7998a8cb4
4 test/data/testrunner.js
@@ -94,7 +94,7 @@ function testSubproject( label, url, risTests ) {
94 94 fixture = page.find("[id='qunit-fixture']");
95 95 fixtureHTML = fixture.html();
96 96 fixture.empty();
97   - while ( fixture.length && !fixture.prevAll("[id^='qunit-']").length ) {
  97 + while ( fixture.length && !fixture.prevAll("[id='qunit']").length ) {
98 98 fixture = fixture.parent();
99 99 }
100 100 fixture = fixture.add( fixture.nextAll() );
@@ -112,7 +112,7 @@ function testSubproject( label, url, risTests ) {
112 112
113 113 // Replace the current fixture, including content outside of #qunit-fixture
114 114 var oldFixture = originaljQuery("#qunit-fixture");
115   - while ( oldFixture.length && !oldFixture.prevAll("[id^='qunit-']").length ) {
  115 + while ( oldFixture.length && !oldFixture.prevAll("[id='qunit']").length ) {
116 116 oldFixture = oldFixture.parent();
117 117 }
118 118 oldFixture.nextAll().remove();
12 test/index.html
@@ -82,16 +82,9 @@
82 82 </head>
83 83
84 84 <body id="body">
85   - <h1 id="qunit-header"><a href="/jquery/test/index.html">jQuery Test Suite</a></h1>
86   - <h2 id="qunit-banner"></h2>
87   - <div id="qunit-testrunner-toolbar"></div>
88   - <h2 id="qunit-userAgent"></h2>
89   - <ol id="qunit-tests"></ol>
  85 + <div id="qunit"></div>
90 86
91 87 <!-- Test HTML -->
92   - <div id="nothiddendiv" style="height:1px;background:white;" class="nothiddendiv">
93   - <div id="nothiddendivchild"></div>
94   - </div>
95 88 <!-- this iframe is outside the #qunit-fixture so it won't reload constantly wasting time, but it means the tests must be "safe" and clean up after themselves -->
96 89 <iframe id="loadediframe" name="loadediframe" style="display:none;" src="data/iframe.html"></iframe>
97 90 <dl id="dl" style="position:absolute;top:-32767px;left:-32767px;width:1px">
@@ -110,6 +103,9 @@ <h2 id="qunit-userAgent"></h2>
110 103 <p id="sap">This link has <code><a href="#2" id="anchor2">class="blog"</a></code>: <a href="http://simon.incutio.com/" class="blog link" id="simon">Simon Willison's Weblog</a></p>
111 104
112 105 </div>
  106 + <div id="nothiddendiv" style="height:1px;background:white;" class="nothiddendiv">
  107 + <div id="nothiddendivchild"></div>
  108 + </div>
113 109 <span id="name+value"></span>
114 110 <p id="first">Try them out:</p>
115 111 <ul id="firstUL"></ul>
12 test/unit/attributes.js
@@ -978,7 +978,7 @@ test( "val(select) after form.reset() (Bug #2551)", function() {
978 978 var testAddClass = function( valueObj ) {
979 979 expect( 9 );
980 980
981   - var div = jQuery("div");
  981 + var div = jQuery("#qunit-fixture div");
982 982 div.addClass( valueObj("test") );
983 983 var pass = true;
984 984 for ( var i = 0; i < div.size(); i++ ) {
@@ -1029,8 +1029,8 @@ test( "addClass(Function)", function() {
1029 1029 });
1030 1030
1031 1031 test( "addClass(Function) with incoming value", function() {
1032   - expect( 54 );
1033   - var div = jQuery("div"),
  1032 + expect( 52 );
  1033 + var div = jQuery("#qunit-fixture div"),
1034 1034 old = div.map(function() {
1035 1035 return jQuery(this).attr("class") || "";
1036 1036 });
@@ -1054,7 +1054,7 @@ test( "addClass(Function) with incoming value", function() {
1054 1054 var testRemoveClass = function(valueObj) {
1055 1055 expect( 8 );
1056 1056
1057   - var $set = jQuery("div"),
  1057 + var $set = jQuery("#qunit-fixture div"),
1058 1058 div = document.createElement("div");
1059 1059
1060 1060 $set.addClass("test").removeClass( valueObj("test") );
@@ -1102,9 +1102,9 @@ test( "removeClass(Function) - simple", function() {
1102 1102 });
1103 1103
1104 1104 test( "removeClass(Function) with incoming value", function() {
1105   - expect( 54 );
  1105 + expect( 52 );
1106 1106
1107   - var $divs = jQuery("div").addClass("test"), old = $divs.map(function() {
  1107 + var $divs = jQuery("#qunit-fixture div").addClass("test"), old = $divs.map(function() {
1108 1108 return jQuery( this ).attr("class");
1109 1109 });
1110 1110
20 test/unit/event.js
@@ -1491,8 +1491,8 @@ test(".live()/.die()", function() {
1491 1491
1492 1492 var submit = 0, div = 0, livea = 0, liveb = 0;
1493 1493
1494   - jQuery("div").live("submit", function(){ submit++; return false; });
1495   - jQuery("div").live("click", function(){ div++; });
  1494 + jQuery("#qunit-fixture div").live("submit", function(){ submit++; return false; });
  1495 + jQuery("#qunit-fixture div").live("click", function(){ div++; });
1496 1496 jQuery("div#nothiddendiv").live("click", function(){ livea++; });
1497 1497 jQuery("div#nothiddendivchild").live("click", function(){ liveb++; });
1498 1498
@@ -1571,13 +1571,13 @@ test(".live()/.die()", function() {
1571 1571
1572 1572 jQuery("div#nothiddendivchild").die("click");
1573 1573 jQuery("div#nothiddendiv").die("click");
1574   - jQuery("div").die("click");
1575   - jQuery("div").die("submit");
  1574 + jQuery("#qunit-fixture div").die("click");
  1575 + jQuery("#qunit-fixture div").die("submit");
1576 1576
1577 1577 // Test binding with a different context
1578 1578 var clicked = 0, container = jQuery("#qunit-fixture")[0];
1579 1579 jQuery("#foo", container).live("click", function(e){ clicked++; });
1580   - jQuery("div").trigger("click");
  1580 + jQuery("#qunit-fixture div").trigger("click");
1581 1581 jQuery("#foo").trigger("click");
1582 1582 jQuery("#qunit-fixture").trigger("click");
1583 1583 jQuery("body").trigger("click");
@@ -2022,8 +2022,8 @@ test(".delegate()/.undelegate()", function() {
2022 2022
2023 2023 var submit = 0, div = 0, livea = 0, liveb = 0;
2024 2024
2025   - jQuery("#body").delegate("div", "submit", function(){ submit++; return false; });
2026   - jQuery("#body").delegate("div", "click", function(){ div++; });
  2025 + jQuery("#body").delegate("#qunit-fixture div", "submit", function(){ submit++; return false; });
  2026 + jQuery("#body").delegate("#qunit-fixture div", "click", function(){ div++; });
2027 2027 jQuery("#body").delegate("div#nothiddendiv", "click", function(){ livea++; });
2028 2028 jQuery("#body").delegate("div#nothiddendivchild", "click", function(){ liveb++; });
2029 2029
@@ -2102,13 +2102,13 @@ test(".delegate()/.undelegate()", function() {
2102 2102
2103 2103 jQuery("#body").undelegate("div#nothiddendivchild", "click");
2104 2104 jQuery("#body").undelegate("div#nothiddendiv", "click");
2105   - jQuery("#body").undelegate("div", "click");
2106   - jQuery("#body").undelegate("div", "submit");
  2105 + jQuery("#body").undelegate("#qunit-fixture div", "click");
  2106 + jQuery("#body").undelegate("#qunit-fixture div", "submit");
2107 2107
2108 2108 // Test binding with a different context
2109 2109 var clicked = 0, container = jQuery("#qunit-fixture")[0];
2110 2110 jQuery("#qunit-fixture").delegate("#foo", "click", function(e){ clicked++; });
2111   - jQuery("div").trigger("click");
  2111 + jQuery("#qunit-fixture div").trigger("click");
2112 2112 jQuery("#foo").trigger("click");
2113 2113 jQuery("#qunit-fixture").trigger("click");
2114 2114 jQuery("body").trigger("click");
4 test/unit/manipulation.js
@@ -1459,7 +1459,7 @@ test( "clone()", function() {
1459 1459 equal( jQuery(form).clone().children().length, 1, "Make sure we just get the form back." );
1460 1460
1461 1461 body = jQuery("body").clone();
1462   - equal( body.children()[ 0 ].id, "qunit-header", "Make sure cloning body works" );
  1462 + equal( body.children()[ 0 ].id, "qunit", "Make sure cloning body works" );
1463 1463 body.remove();
1464 1464 });
1465 1465
@@ -1612,7 +1612,7 @@ var testHtml = function( valueObj ) {
1612 1612 expected.push("B");
1613 1613 actual.push( childNodeNames( this ) );
1614 1614 });
1615   - equal( expected.length, 6, "Expecting many parents" );
  1615 + equal( expected.length, 7, "Expecting many parents" );
1616 1616 deepEqual( actual, expected, "Correct childNodes after setting HTML" );
1617 1617
1618 1618 actual = []; expected = [];
6 test/unit/offset.js
@@ -487,13 +487,13 @@ test("offsetParent", function(){
487 487 equal( body.length, 1, "Only one offsetParent found." );
488 488 equal( body[0], document.documentElement, "The html element is the offsetParent of the body." );
489 489
490   - var header = jQuery("#qunit-header").offsetParent();
  490 + var header = jQuery("#qunit").offsetParent();
491 491 equal( header.length, 1, "Only one offsetParent found." );
492   - equal( header[0], document.documentElement, "The html element is the offsetParent of the body." );
  492 + equal( header[0], document.documentElement, "The html element is the offsetParent of #qunit." );
493 493
494 494 var div = jQuery("#nothiddendivchild").offsetParent();
495 495 equal( div.length, 1, "Only one offsetParent found." );
496   - equal( div[0], document.documentElement, "The html element is the offsetParent of the body." );
  496 + equal( div[0], document.getElementById("qunit-fixture"), "The #qunit-fixture is the offsetParent of #nothiddendivchild." );
497 497
498 498 jQuery("#nothiddendiv").css("position", "relative");
499 499
12 test/unit/selector.js
@@ -7,10 +7,12 @@ module("selector - jQuery only", { teardown: moduleTeardown });
7 7 test("element - jQuery only", function() {
8 8 expect( 7 );
9 9
10   - deepEqual( jQuery("p", document.getElementsByTagName("div")).get(), q("firstp","ap","sndp","en","sap","first"), "Finding elements with a context." );
11   - deepEqual( jQuery("p", "div").get(), q("firstp","ap","sndp","en","sap","first"), "Finding elements with a context." );
12   - deepEqual( jQuery("p", jQuery("div")).get(), q("firstp","ap","sndp","en","sap","first"), "Finding elements with a context." );
13   - deepEqual( jQuery("div").find("p").get(), q("firstp","ap","sndp","en","sap","first"), "Finding elements with a context." );
  10 + var fixture = document.getElementById("qunit-fixture");
  11 +
  12 + deepEqual( jQuery("p", fixture).get(), q("firstp","ap","sndp","en","sap","first"), "Finding elements with a Node context." );
  13 + deepEqual( jQuery("p", "#qunit-fixture").get(), q("firstp","ap","sndp","en","sap","first"), "Finding elements with a selector context." );
  14 + deepEqual( jQuery("p", jQuery("#qunit-fixture")).get(), q("firstp","ap","sndp","en","sap","first"), "Finding elements with a jQuery object context." );
  15 + deepEqual( jQuery("#qunit-fixture").find("p").get(), q("firstp","ap","sndp","en","sap","first"), "Finding elements with a context via .find()." );
14 16
15 17 ok( jQuery("#length").length, "<input name=\"length\"> cannot be found under IE, see #945" );
16 18 ok( jQuery("#lengthtest input").length, "<input name=\"length\"> cannot be found under IE, see #945" );
@@ -44,7 +46,7 @@ if ( jQuery.css ) {
44 46 test("pseudo - visibility", function() {
45 47 expect( 9 );
46 48
47   - t( "Is Visible", "div:visible:not(#qunit-testrunner-toolbar):lt(2)", ["nothiddendiv", "nothiddendivchild"] );
  49 + t( "Is Visible", "#qunit-fixture div:visible:lt(2)", ["foo", "nothiddendiv"] );
48 50 t( "Is Not Hidden", "#qunit-fixture:hidden", [] );
49 51 t( "Is Hidden", "#form input:hidden", ["hidden1","hidden2"] );
50 52
12 test/unit/traversing.js
@@ -9,7 +9,7 @@ test( "find(String)", function() {
9 9 equal( j.find("div").length, 0, "Check node,textnode,comment to find zero divs" );
10 10 equal( j.find("div").andSelf().length, 3, "Check node,textnode,comment to find zero divs, but preserves pushStack" );
11 11
12   - deepEqual( jQuery("#qunit-fixture").find("> div").get(), q( "foo", "moretests", "tabindex-tests", "liveHandlerOrder", "siblingTest", "fx-test-group" ), "find child elements" );
  12 + deepEqual( jQuery("#qunit-fixture").find("> div").get(), q( "foo", "nothiddendiv", "moretests", "tabindex-tests", "liveHandlerOrder", "siblingTest", "fx-test-group" ), "find child elements" );
13 13 deepEqual( jQuery("#qunit-fixture").find("> #foo, > #moretests").get(), q( "foo", "moretests" ), "find child elements" );
14 14 deepEqual( jQuery("#qunit-fixture").find("> #foo > p").get(), q( "sndp", "en", "sap" ), "find child elements" );
15 15
@@ -286,8 +286,8 @@ test("closest()", function() {
286 286 deepEqual( jQuery("body").closest("div").get(), [], "closest(div)" );
287 287 deepEqual( jQuery("#qunit-fixture").closest("span,#html").get(), q("html"), "closest(span,#html)" );
288 288
289   - deepEqual( jQuery("div:eq(1)").closest("div:first").get(), [], "closest(div:first)" );
290   - deepEqual( jQuery("div").closest("body:first div:last").get(), q("fx-tests"), "closest(body:first div:last)" );
  289 + deepEqual( jQuery("#qunit-fixture").closest("div:first").get(), [], "closest(div:first)" );
  290 + deepEqual( jQuery("#qunit-fixture div").closest("body:first div:last").get(), q("fx-tests"), "closest(body:first div:last)" );
291 291
292 292 // Test .closest() limited by the context
293 293 var jq = jQuery("#nothiddendivchild");
@@ -312,15 +312,15 @@ test("closest(jQuery)", function() {
312 312 expect(8);
313 313 var $child = jQuery("#nothiddendivchild"),
314 314 $parent = jQuery("#nothiddendiv"),
315   - $main = jQuery("#qunit-fixture"),
  315 + $sibling = jQuery("#foo"),
316 316 $body = jQuery("body");
317 317 ok( $child.closest( $parent ).is("#nothiddendiv"), "closest( jQuery('#nothiddendiv') )" );
318 318 ok( $child.closest( $parent[0] ).is("#nothiddendiv"), "closest( jQuery('#nothiddendiv') ) :: node" );
319 319 ok( $child.closest( $child ).is("#nothiddendivchild"), "child is included" );
320 320 ok( $child.closest( $child[0] ).is("#nothiddendivchild"), "child is included :: node" );
321 321 equal( $child.closest( document.createElement("div") ).length, 0, "created element is not related" );
322   - equal( $child.closest( $main ).length, 0, "Main not a parent of child" );
323   - equal( $child.closest( $main[0] ).length, 0, "Main not a parent of child :: node" );
  322 + equal( $child.closest( $sibling ).length, 0, "Sibling not a parent of child" );
  323 + equal( $child.closest( $sibling[0] ).length, 0, "Sibling not a parent of child :: node" );
324 324 ok( $child.closest( $body.add($parent) ).is("#nothiddendiv"), "Closest ancestor retrieved." );
325 325 });
326 326

0 comments on commit 55313d3

Markus Staab

shouldn't you use #qunit as selctor?

Markus Staab

shouldn't you use #qunit as selctor?

Please sign in to comment.
Something went wrong with that request. Please try again.