Skip to content

Commit ad7577a

Browse files
committed
Changed a bunch of the DOM tests to work in Document Order.
1 parent 6bd6a4e commit ad7577a

File tree

1 file changed

+11
-23
lines changed

1 file changed

+11
-23
lines changed

test/unit/core.js

Lines changed: 11 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -840,9 +840,7 @@ test("append(String|Element|Array<Element>|jQuery)", function() {
840840
equals( expected, jQuery('#sap').text(), "Check for appending of array of elements" );
841841

842842
reset();
843-
expected = document.querySelectorAll ?
844-
"This link has class=\"blog\": Simon Willison's WeblogYahooTry them out:" :
845-
"This link has class=\"blog\": Simon Willison's WeblogTry them out:Yahoo";
843+
expected = "This link has class=\"blog\": Simon Willison's WeblogYahooTry them out:";
846844
jQuery('#sap').append(jQuery("#first, #yahoo"));
847845
equals( expected, jQuery('#sap').text(), "Check for appending of jQuery object" );
848846

@@ -929,9 +927,7 @@ test("appendTo(String|Element|Array<Element>|jQuery)", function() {
929927
ok( jQuery(document.createElement("script")).appendTo("body").length, "Make sure a disconnected script can be appended." );
930928

931929
reset();
932-
expected = document.querySelectorAll ?
933-
"This link has class=\"blog\": Simon Willison's WeblogYahooTry them out:" :
934-
"This link has class=\"blog\": Simon Willison's WeblogTry them out:Yahoo";
930+
expected = "This link has class=\"blog\": Simon Willison's WeblogYahooTry them out:";
935931
jQuery("#first, #yahoo").appendTo('#sap');
936932
equals( expected, jQuery('#sap').text(), "Check for appending of jQuery object" );
937933

@@ -958,9 +954,7 @@ test("prepend(String|Element|Array<Element>|jQuery)", function() {
958954
equals( expected, jQuery('#sap').text(), "Check for prepending of array of elements" );
959955

960956
reset();
961-
expected = document.querySelectorAll ?
962-
"YahooTry them out:This link has class=\"blog\": Simon Willison's Weblog" :
963-
"Try them out:YahooThis link has class=\"blog\": Simon Willison's Weblog";
957+
expected = "YahooTry them out:This link has class=\"blog\": Simon Willison's Weblog";
964958
jQuery('#sap').prepend(jQuery("#first, #yahoo"));
965959
equals( expected, jQuery('#sap').text(), "Check for prepending of jQuery object" );
966960
});
@@ -1011,9 +1005,7 @@ test("before(String|Element|Array<Element>|jQuery)", function() {
10111005
equals( expected, jQuery('#en').text(), "Insert array of elements before" );
10121006

10131007
reset();
1014-
expected = document.querySelectorAll ?
1015-
"This is a normal link: diveintomarkTry them out:Yahoo" :
1016-
"This is a normal link: Try them out:diveintomarkYahoo";
1008+
expected = "This is a normal link: diveintomarkTry them out:Yahoo";
10171009
jQuery('#yahoo').before(jQuery("#first, #mark"));
10181010
equals( expected, jQuery('#en').text(), "Insert jQuery before" );
10191011
});
@@ -1035,9 +1027,7 @@ test("insertBefore(String|Element|Array<Element>|jQuery)", function() {
10351027
equals( expected, jQuery('#en').text(), "Insert array of elements before" );
10361028

10371029
reset();
1038-
expected = document.querySelectorAll ?
1039-
"This is a normal link: diveintomarkTry them out:Yahoo" :
1040-
"This is a normal link: Try them out:diveintomarkYahoo";
1030+
expected = "This is a normal link: diveintomarkTry them out:Yahoo";
10411031
jQuery("#first, #mark").insertBefore('#yahoo');
10421032
equals( expected, jQuery('#en').text(), "Insert jQuery before" );
10431033
});
@@ -1059,9 +1049,7 @@ test("after(String|Element|Array<Element>|jQuery)", function() {
10591049
equals( expected, jQuery('#en').text(), "Insert array of elements after" );
10601050

10611051
reset();
1062-
expected = document.querySelectorAll ?
1063-
"This is a normal link: YahoodiveintomarkTry them out:" :
1064-
"This is a normal link: YahooTry them out:diveintomark";
1052+
expected = "This is a normal link: YahoodiveintomarkTry them out:";
10651053
jQuery('#yahoo').after(jQuery("#first, #mark"));
10661054
equals( expected, jQuery('#en').text(), "Insert jQuery after" );
10671055
});
@@ -1453,7 +1441,7 @@ test("closest()", function() {
14531441
isSet( jQuery("#main").closest("span,#html").get(), q("html"), "closest(span,#html)" );
14541442

14551443
isSet( jQuery("div:eq(1)").closest("div:first").get(), [], "closest(div:first)" );
1456-
isSet( jQuery("div").closest("body:first div:last").get(), q("divWithNoTabIndex"), "closest(body:first div:last)" );
1444+
isSet( jQuery("div").closest("body:first div:last").get(), q("liveHandlerOrder"), "closest(body:first div:last)" );
14571445
});
14581446

14591447
test("not()", function() {
@@ -1479,16 +1467,16 @@ test("andSelf()", function() {
14791467
isSet( jQuery("#en").siblings().andSelf().get(), q("sndp", "sap","en"), "Check for siblings and self" );
14801468
isSet( jQuery("#foo").children().andSelf().get(), q("sndp", "en", "sap", "foo"), "Check for children and self" );
14811469
isSet( jQuery("#sndp, #en").parent().andSelf().get(), q("foo","sndp","en"), "Check for parent and self" );
1482-
isSet( jQuery("#groups").parents("p, div").andSelf().get(), q("ap", "main", "groups"), "Check for parents and self" );
1470+
isSet( jQuery("#groups").parents("p, div").andSelf().get(), q("main", "ap", "groups"), "Check for parents and self" );
14831471
});
14841472

14851473
test("siblings([String])", function() {
14861474
expect(5);
14871475
isSet( jQuery("#en").siblings().get(), q("sndp", "sap"), "Check for siblings" );
14881476
isSet( jQuery("#sndp").siblings(":has(code)").get(), q("sap"), "Check for filtered siblings (has code child element)" );
14891477
isSet( jQuery("#sndp").siblings(":has(a)").get(), q("en", "sap"), "Check for filtered siblings (has anchor child element)" );
1490-
isSet( jQuery("#foo").siblings("form, b").get(), q("form", "lengthtest", "name-tests", "testForm", "floatTest"), "Check for multiple filters" );
1491-
var set = document.querySelectorAll ? q("en", "sap", "sndp") : q("sndp", "sap", "en");
1478+
isSet( jQuery("#foo").siblings("form, b").get(), q("form", "floatTest", "lengthtest", "name-tests", "testForm"), "Check for multiple filters" );
1479+
var set = q("en", "sap", "sndp");
14921480
isSet( jQuery("#en, #sndp").siblings().get(), set, "Check for unique results from siblings" );
14931481
});
14941482

@@ -1513,7 +1501,7 @@ test("parents([String])", function() {
15131501
equals( jQuery("#groups").parents()[0].id, "ap", "Simple parents check" );
15141502
equals( jQuery("#groups").parents("p")[0].id, "ap", "Filtered parents check" );
15151503
equals( jQuery("#groups").parents("div")[0].id, "main", "Filtered parents check2" );
1516-
isSet( jQuery("#groups").parents("p, div").get(), q("ap", "main"), "Check for multiple filters" );
1504+
isSet( jQuery("#groups").parents("p, div").get(), q("main", "ap"), "Check for multiple filters" );
15171505
isSet( jQuery("#en, #sndp").parents().get(), q("foo", "main", "dl", "body", "html"), "Check for unique results from parents" );
15181506
});
15191507

0 commit comments

Comments
 (0)