Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Test: Update index.html to new QUnit format #1061

Closed
wants to merge 1 commit into from

4 participants

@Krinkle

This fixes the annoying link bug if you have the jQuery repo under
a different URL.

QUnit simply generates this automatically now.

cc @jaubourg @gibson042

@gibson042
Collaborator

This causes a bunch of tests expecting qunit-whatever to fail, including in the Sizzle suite we pull forward. Can you patch those up and open a sister PR against Sizzle?

@mikesherov
Collaborator

@jquerybot retest

@mikesherov
Collaborator

@jquerybot retest

@Krinkle

@gibson042 I'm trying to fix that now.

The traversing, events and attributes test suites are horrible (Sizzle is even worse). They are everything but atomic. Touch one little detail in the all-too fragile index.html and its like a major kick in the nuts, failures all over the place.

Generic things like iterating over all "div" elements on the page. There is no reason why assertion X needs to be performed 56 times (once for each div).

I'm currently just confining it a little bit to make it pass, but one of these days we need to fix this big time.

@dmethvin
Owner

@Krinkle I feel your pain. For the event tests I have done over the past year or so I tend to inject new markup from within the test, rather than depend on some global markup. And yes, some of those traversing/Sizzle tests are pretty sensitive to even having anything changed in index.html. It's always a question of who will lose the lottery to fix them, since there's no glory there.

Sorry about your nuts.

@Krinkle Krinkle referenced this pull request from a commit in Krinkle/sizzle
@Krinkle Krinkle Test: Update index.html to new QUnit format
This is needed for jquery/jquery#1061.

Aside from the usual clusterfuck of inter tangled dependencies
between the different fixtures (primarily related to the stuff
outside #qunit-fixture), this also stabilises the situation a bit
in general. So in the future they should be a lot less dependent
on each other.
56db8a8
@Krinkle Krinkle referenced this pull request in jquery/sizzle
Closed

Test: Update index.html to new QUnit format #177

@Krinkle

All tests pass. Except for Sizzle, depends on jquery/sizzle#177, and 1 test failure in core.js introduced in master.

@dmethvin dmethvin referenced this pull request from a commit in dmethvin/sizzle
@Krinkle Krinkle Test: Update index.html to new QUnit format. Close gh-177.
This is needed for jquery/jquery#1061.

Aside from the usual clusterfuck of inter tangled dependencies
between the different fixtures (primarily related to the stuff
outside #qunit-fixture), this also stabilises the situation a bit
in general. So in the future they should be a lot less dependent
on each other.
7146720
@dmethvin dmethvin closed this pull request from a commit
@Krinkle Krinkle Test: Update index.html to new QUnit format. Close gh-1061.
Depends on jquery/sizzle#177, included with the Sizzle submodule in this commit.
55313d3
@dmethvin dmethvin closed this in 55313d3
@tp9 tp9 referenced this pull request from a commit
Commit has since been removed from the repository and is no longer available.
@markelog markelog referenced this pull request from a commit in markelog/sizzle
@Krinkle Krinkle Test: Update index.html to new QUnit format. Close gh-177.
This is needed for jquery/jquery#1061.

Aside from the usual clusterfuck of inter tangled dependencies
between the different fixtures (primarily related to the stuff
outside #qunit-fixture), this also stabilises the situation a bit
in general. So in the future they should be a lot less dependent
on each other.
b82ec2a
@mescoda mescoda referenced this pull request from a commit in mescoda/jquery
@Krinkle Krinkle Test: Update index.html to new QUnit format. Close gh-1061.
Depends on jquery/sizzle#177, included with the Sizzle submodule in this commit.
a5ea2d5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Dec 11, 2012
  1. @Krinkle
This page is out of date. Refresh to see the latest.
View
4 test/data/testrunner.js
@@ -94,7 +94,7 @@ function testSubproject( label, url, risTests ) {
fixture = page.find("[id='qunit-fixture']");
fixtureHTML = fixture.html();
fixture.empty();
- while ( fixture.length && !fixture.prevAll("[id^='qunit-']").length ) {
+ while ( fixture.length && !fixture.prevAll("[id='qunit']").length ) {
fixture = fixture.parent();
}
fixture = fixture.add( fixture.nextAll() );
@@ -112,7 +112,7 @@ function testSubproject( label, url, risTests ) {
// Replace the current fixture, including content outside of #qunit-fixture
var oldFixture = originaljQuery("#qunit-fixture");
- while ( oldFixture.length && !oldFixture.prevAll("[id^='qunit-']").length ) {
+ while ( oldFixture.length && !oldFixture.prevAll("[id='qunit']").length ) {
oldFixture = oldFixture.parent();
}
oldFixture.nextAll().remove();
View
12 test/index.html
@@ -82,16 +82,9 @@
</head>
<body id="body">
- <h1 id="qunit-header"><a href="/jquery/test/index.html">jQuery Test Suite</a></h1>
- <h2 id="qunit-banner"></h2>
- <div id="qunit-testrunner-toolbar"></div>
- <h2 id="qunit-userAgent"></h2>
- <ol id="qunit-tests"></ol>
+ <div id="qunit"></div>
<!-- Test HTML -->
- <div id="nothiddendiv" style="height:1px;background:white;" class="nothiddendiv">
- <div id="nothiddendivchild"></div>
- </div>
<!-- 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 -->
<iframe id="loadediframe" name="loadediframe" style="display:none;" src="data/iframe.html"></iframe>
<dl id="dl" style="position:absolute;top:-32767px;left:-32767px;width:1px">
@@ -110,6 +103,9 @@ <h2 id="qunit-userAgent"></h2>
<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>
</div>
+ <div id="nothiddendiv" style="height:1px;background:white;" class="nothiddendiv">
+ <div id="nothiddendivchild"></div>
+ </div>
<span id="name+value"></span>
<p id="first">Try them out:</p>
<ul id="firstUL"></ul>
View
12 test/unit/attributes.js
@@ -978,7 +978,7 @@ test( "val(select) after form.reset() (Bug #2551)", function() {
var testAddClass = function( valueObj ) {
expect( 9 );
- var div = jQuery("div");
+ var div = jQuery("#qunit-fixture div");
div.addClass( valueObj("test") );
var pass = true;
for ( var i = 0; i < div.size(); i++ ) {
@@ -1029,8 +1029,8 @@ test( "addClass(Function)", function() {
});
test( "addClass(Function) with incoming value", function() {
- expect( 54 );
- var div = jQuery("div"),
+ expect( 52 );
+ var div = jQuery("#qunit-fixture div"),
old = div.map(function() {
return jQuery(this).attr("class") || "";
});
@@ -1054,7 +1054,7 @@ test( "addClass(Function) with incoming value", function() {
var testRemoveClass = function(valueObj) {
expect( 8 );
- var $set = jQuery("div"),
+ var $set = jQuery("#qunit-fixture div"),
div = document.createElement("div");
$set.addClass("test").removeClass( valueObj("test") );
@@ -1102,9 +1102,9 @@ test( "removeClass(Function) - simple", function() {
});
test( "removeClass(Function) with incoming value", function() {
- expect( 54 );
+ expect( 52 );
- var $divs = jQuery("div").addClass("test"), old = $divs.map(function() {
+ var $divs = jQuery("#qunit-fixture div").addClass("test"), old = $divs.map(function() {
return jQuery( this ).attr("class");
});
View
20 test/unit/event.js
@@ -1491,8 +1491,8 @@ test(".live()/.die()", function() {
var submit = 0, div = 0, livea = 0, liveb = 0;
- jQuery("div").live("submit", function(){ submit++; return false; });
- jQuery("div").live("click", function(){ div++; });
+ jQuery("#qunit-fixture div").live("submit", function(){ submit++; return false; });
+ jQuery("#qunit-fixture div").live("click", function(){ div++; });
jQuery("div#nothiddendiv").live("click", function(){ livea++; });
jQuery("div#nothiddendivchild").live("click", function(){ liveb++; });
@@ -1571,13 +1571,13 @@ test(".live()/.die()", function() {
jQuery("div#nothiddendivchild").die("click");
jQuery("div#nothiddendiv").die("click");
- jQuery("div").die("click");
- jQuery("div").die("submit");
+ jQuery("#qunit-fixture div").die("click");
+ jQuery("#qunit-fixture div").die("submit");
// Test binding with a different context
var clicked = 0, container = jQuery("#qunit-fixture")[0];
jQuery("#foo", container).live("click", function(e){ clicked++; });
- jQuery("div").trigger("click");
+ jQuery("#qunit-fixture div").trigger("click");
jQuery("#foo").trigger("click");
jQuery("#qunit-fixture").trigger("click");
jQuery("body").trigger("click");
@@ -2022,8 +2022,8 @@ test(".delegate()/.undelegate()", function() {
var submit = 0, div = 0, livea = 0, liveb = 0;
- jQuery("#body").delegate("div", "submit", function(){ submit++; return false; });
- jQuery("#body").delegate("div", "click", function(){ div++; });
+ jQuery("#body").delegate("#qunit-fixture div", "submit", function(){ submit++; return false; });
+ jQuery("#body").delegate("#qunit-fixture div", "click", function(){ div++; });
jQuery("#body").delegate("div#nothiddendiv", "click", function(){ livea++; });
jQuery("#body").delegate("div#nothiddendivchild", "click", function(){ liveb++; });
@@ -2102,13 +2102,13 @@ test(".delegate()/.undelegate()", function() {
jQuery("#body").undelegate("div#nothiddendivchild", "click");
jQuery("#body").undelegate("div#nothiddendiv", "click");
- jQuery("#body").undelegate("div", "click");
- jQuery("#body").undelegate("div", "submit");
+ jQuery("#body").undelegate("#qunit-fixture div", "click");
+ jQuery("#body").undelegate("#qunit-fixture div", "submit");
// Test binding with a different context
var clicked = 0, container = jQuery("#qunit-fixture")[0];
jQuery("#qunit-fixture").delegate("#foo", "click", function(e){ clicked++; });
- jQuery("div").trigger("click");
+ jQuery("#qunit-fixture div").trigger("click");
jQuery("#foo").trigger("click");
jQuery("#qunit-fixture").trigger("click");
jQuery("body").trigger("click");
View
4 test/unit/manipulation.js
@@ -1459,7 +1459,7 @@ test( "clone()", function() {
equal( jQuery(form).clone().children().length, 1, "Make sure we just get the form back." );
body = jQuery("body").clone();
- equal( body.children()[ 0 ].id, "qunit-header", "Make sure cloning body works" );
+ equal( body.children()[ 0 ].id, "qunit", "Make sure cloning body works" );
body.remove();
});
@@ -1612,7 +1612,7 @@ var testHtml = function( valueObj ) {
expected.push("B");
actual.push( childNodeNames( this ) );
});
- equal( expected.length, 6, "Expecting many parents" );
+ equal( expected.length, 7, "Expecting many parents" );
deepEqual( actual, expected, "Correct childNodes after setting HTML" );
actual = []; expected = [];
View
6 test/unit/offset.js
@@ -487,13 +487,13 @@ test("offsetParent", function(){
equal( body.length, 1, "Only one offsetParent found." );
equal( body[0], document.documentElement, "The html element is the offsetParent of the body." );
- var header = jQuery("#qunit-header").offsetParent();
+ var header = jQuery("#qunit").offsetParent();
equal( header.length, 1, "Only one offsetParent found." );
- equal( header[0], document.documentElement, "The html element is the offsetParent of the body." );
+ equal( header[0], document.documentElement, "The html element is the offsetParent of #qunit." );
var div = jQuery("#nothiddendivchild").offsetParent();
equal( div.length, 1, "Only one offsetParent found." );
- equal( div[0], document.documentElement, "The html element is the offsetParent of the body." );
+ equal( div[0], document.getElementById("qunit-fixture"), "The #qunit-fixture is the offsetParent of #nothiddendivchild." );
jQuery("#nothiddendiv").css("position", "relative");
View
12 test/unit/selector.js
@@ -7,10 +7,12 @@ module("selector - jQuery only", { teardown: moduleTeardown });
test("element - jQuery only", function() {
expect( 7 );
- 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." );
+ var fixture = document.getElementById("qunit-fixture");
+
+ deepEqual( jQuery("p", fixture).get(), q("firstp","ap","sndp","en","sap","first"), "Finding elements with a Node context." );
+ deepEqual( jQuery("p", "#qunit-fixture").get(), q("firstp","ap","sndp","en","sap","first"), "Finding elements with a selector context." );
+ deepEqual( jQuery("p", jQuery("#qunit-fixture")).get(), q("firstp","ap","sndp","en","sap","first"), "Finding elements with a jQuery object context." );
+ deepEqual( jQuery("#qunit-fixture").find("p").get(), q("firstp","ap","sndp","en","sap","first"), "Finding elements with a context via .find()." );
ok( jQuery("#length").length, "<input name=\"length\"> cannot be found under IE, see #945" );
ok( jQuery("#lengthtest input").length, "<input name=\"length\"> cannot be found under IE, see #945" );
@@ -44,7 +46,7 @@ if ( jQuery.css ) {
test("pseudo - visibility", function() {
expect( 9 );
- t( "Is Visible", "div:visible:not(#qunit-testrunner-toolbar):lt(2)", ["nothiddendiv", "nothiddendivchild"] );
+ t( "Is Visible", "#qunit-fixture div:visible:lt(2)", ["foo", "nothiddendiv"] );
t( "Is Not Hidden", "#qunit-fixture:hidden", [] );
t( "Is Hidden", "#form input:hidden", ["hidden1","hidden2"] );
View
12 test/unit/traversing.js
@@ -9,7 +9,7 @@ test( "find(String)", function() {
equal( j.find("div").length, 0, "Check node,textnode,comment to find zero divs" );
equal( j.find("div").andSelf().length, 3, "Check node,textnode,comment to find zero divs, but preserves pushStack" );
- deepEqual( jQuery("#qunit-fixture").find("> div").get(), q( "foo", "moretests", "tabindex-tests", "liveHandlerOrder", "siblingTest", "fx-test-group" ), "find child elements" );
+ deepEqual( jQuery("#qunit-fixture").find("> div").get(), q( "foo", "nothiddendiv", "moretests", "tabindex-tests", "liveHandlerOrder", "siblingTest", "fx-test-group" ), "find child elements" );
deepEqual( jQuery("#qunit-fixture").find("> #foo, > #moretests").get(), q( "foo", "moretests" ), "find child elements" );
deepEqual( jQuery("#qunit-fixture").find("> #foo > p").get(), q( "sndp", "en", "sap" ), "find child elements" );
@@ -286,8 +286,8 @@ test("closest()", function() {
deepEqual( jQuery("body").closest("div").get(), [], "closest(div)" );
deepEqual( jQuery("#qunit-fixture").closest("span,#html").get(), q("html"), "closest(span,#html)" );
- deepEqual( jQuery("div:eq(1)").closest("div:first").get(), [], "closest(div:first)" );
- deepEqual( jQuery("div").closest("body:first div:last").get(), q("fx-tests"), "closest(body:first div:last)" );
+ deepEqual( jQuery("#qunit-fixture").closest("div:first").get(), [], "closest(div:first)" );
+ deepEqual( jQuery("#qunit-fixture div").closest("body:first div:last").get(), q("fx-tests"), "closest(body:first div:last)" );
// Test .closest() limited by the context
var jq = jQuery("#nothiddendivchild");
@@ -312,15 +312,15 @@ test("closest(jQuery)", function() {
expect(8);
var $child = jQuery("#nothiddendivchild"),
$parent = jQuery("#nothiddendiv"),
- $main = jQuery("#qunit-fixture"),
+ $sibling = jQuery("#foo"),
$body = jQuery("body");
ok( $child.closest( $parent ).is("#nothiddendiv"), "closest( jQuery('#nothiddendiv') )" );
ok( $child.closest( $parent[0] ).is("#nothiddendiv"), "closest( jQuery('#nothiddendiv') ) :: node" );
ok( $child.closest( $child ).is("#nothiddendivchild"), "child is included" );
ok( $child.closest( $child[0] ).is("#nothiddendivchild"), "child is included :: node" );
equal( $child.closest( document.createElement("div") ).length, 0, "created element is not related" );
- equal( $child.closest( $main ).length, 0, "Main not a parent of child" );
- equal( $child.closest( $main[0] ).length, 0, "Main not a parent of child :: node" );
+ equal( $child.closest( $sibling ).length, 0, "Sibling not a parent of child" );
+ equal( $child.closest( $sibling[0] ).length, 0, "Sibling not a parent of child :: node" );
ok( $child.closest( $body.add($parent) ).is("#nothiddendiv"), "Closest ancestor retrieved." );
});
Something went wrong with that request. Please try again.