Tweak some more jQuery set results in the manipulation tests. Also fixed the order of the expected test results.
This commit is contained in:
parent
c0fe98f028
commit
c5382ad7c1
1 changed files with 40 additions and 40 deletions
|
@ -212,17 +212,17 @@ var testAppend = function(valueObj) {
|
|||
QUnit.reset();
|
||||
var expected = "This link has class=\"blog\": Simon Willison's WeblogTry them out:";
|
||||
jQuery('#sap').append(valueObj(document.getElementById('first')));
|
||||
equals( expected, jQuery('#sap').text(), "Check for appending of element" );
|
||||
equals( jQuery('#sap').text(), expected, "Check for appending of element" );
|
||||
|
||||
QUnit.reset();
|
||||
expected = "This link has class=\"blog\": Simon Willison's WeblogTry them out:Yahoo";
|
||||
jQuery('#sap').append(valueObj([document.getElementById('first'), document.getElementById('yahoo')]));
|
||||
equals( expected, jQuery('#sap').text(), "Check for appending of array of elements" );
|
||||
equals( jQuery('#sap').text(), expected, "Check for appending of array of elements" );
|
||||
|
||||
QUnit.reset();
|
||||
expected = "This link has class=\"blog\": Simon Willison's WeblogYahooTry them out:";
|
||||
jQuery('#sap').append(valueObj(jQuery("#yahoo, #first")));
|
||||
equals( expected, jQuery('#sap').text(), "Check for appending of jQuery object" );
|
||||
equals( jQuery('#sap').text(), expected, "Check for appending of jQuery object" );
|
||||
|
||||
QUnit.reset();
|
||||
jQuery("#sap").append(valueObj( 5 ));
|
||||
|
@ -343,7 +343,7 @@ test("append(Function) with incoming value", function() {
|
|||
equals( val, old, "Make sure the incoming value is correct." );
|
||||
return document.getElementById('first');
|
||||
});
|
||||
equals( expected, jQuery('#sap').text(), "Check for appending of element" );
|
||||
equals( jQuery('#sap').text(), expected, "Check for appending of element" );
|
||||
|
||||
QUnit.reset();
|
||||
expected = "This link has class=\"blog\": Simon Willison's WeblogTry them out:Yahoo";
|
||||
|
@ -353,7 +353,7 @@ test("append(Function) with incoming value", function() {
|
|||
equals( val, old, "Make sure the incoming value is correct." );
|
||||
return [document.getElementById('first'), document.getElementById('yahoo')];
|
||||
});
|
||||
equals( expected, jQuery('#sap').text(), "Check for appending of array of elements" );
|
||||
equals( jQuery('#sap').text(), expected, "Check for appending of array of elements" );
|
||||
|
||||
QUnit.reset();
|
||||
expected = "This link has class=\"blog\": Simon Willison's WeblogYahooTry them out:";
|
||||
|
@ -363,7 +363,7 @@ test("append(Function) with incoming value", function() {
|
|||
equals( val, old, "Make sure the incoming value is correct." );
|
||||
return jQuery("#yahoo, #first");
|
||||
});
|
||||
equals( expected, jQuery('#sap').text(), "Check for appending of jQuery object" );
|
||||
equals( jQuery('#sap').text(), expected, "Check for appending of jQuery object" );
|
||||
|
||||
QUnit.reset();
|
||||
old = jQuery("#sap").html();
|
||||
|
@ -397,12 +397,12 @@ test("appendTo(String|Element|Array<Element>|jQuery)", function() {
|
|||
QUnit.reset();
|
||||
var expected = "This link has class=\"blog\": Simon Willison's WeblogTry them out:";
|
||||
jQuery(document.getElementById('first')).appendTo('#sap');
|
||||
equals( expected, jQuery('#sap').text(), "Check for appending of element" );
|
||||
equals( jQuery('#sap').text(), expected, "Check for appending of element" );
|
||||
|
||||
QUnit.reset();
|
||||
expected = "This link has class=\"blog\": Simon Willison's WeblogTry them out:Yahoo";
|
||||
jQuery([document.getElementById('first'), document.getElementById('yahoo')]).appendTo('#sap');
|
||||
equals( expected, jQuery('#sap').text(), "Check for appending of array of elements" );
|
||||
equals( jQuery('#sap').text(), expected, "Check for appending of array of elements" );
|
||||
|
||||
QUnit.reset();
|
||||
ok( jQuery(document.createElement("script")).appendTo("body").length, "Make sure a disconnected script can be appended." );
|
||||
|
@ -410,7 +410,7 @@ test("appendTo(String|Element|Array<Element>|jQuery)", function() {
|
|||
QUnit.reset();
|
||||
expected = "This link has class=\"blog\": Simon Willison's WeblogYahooTry them out:";
|
||||
jQuery("#yahoo, #first").appendTo('#sap');
|
||||
equals( expected, jQuery('#sap').text(), "Check for appending of jQuery object" );
|
||||
equals( jQuery('#sap').text(), expected, "Check for appending of jQuery object" );
|
||||
|
||||
QUnit.reset();
|
||||
jQuery('#select1').appendTo('#foo');
|
||||
|
@ -462,17 +462,17 @@ var testPrepend = function(val) {
|
|||
QUnit.reset();
|
||||
var expected = "Try them out:This link has class=\"blog\": Simon Willison's Weblog";
|
||||
jQuery('#sap').prepend(val( document.getElementById('first') ));
|
||||
equals( expected, jQuery('#sap').text(), "Check for prepending of element" );
|
||||
equals( jQuery('#sap').text(), expected, "Check for prepending of element" );
|
||||
|
||||
QUnit.reset();
|
||||
expected = "Try them out:YahooThis link has class=\"blog\": Simon Willison's Weblog";
|
||||
jQuery('#sap').prepend(val( [document.getElementById('first'), document.getElementById('yahoo')] ));
|
||||
equals( expected, jQuery('#sap').text(), "Check for prepending of array of elements" );
|
||||
equals( jQuery('#sap').text(), expected, "Check for prepending of array of elements" );
|
||||
|
||||
QUnit.reset();
|
||||
expected = "YahooTry them out:This link has class=\"blog\": Simon Willison's Weblog";
|
||||
jQuery('#sap').prepend(val( jQuery("#yahoo, #first") ));
|
||||
equals( expected, jQuery('#sap').text(), "Check for prepending of jQuery object" );
|
||||
equals( jQuery('#sap').text(), expected, "Check for prepending of jQuery object" );
|
||||
};
|
||||
|
||||
test("prepend(String|Element|Array<Element>|jQuery)", function() {
|
||||
|
@ -509,7 +509,7 @@ test("prepend(Function) with incoming value", function() {
|
|||
return document.getElementById('first');
|
||||
});
|
||||
|
||||
equals( expected, jQuery('#sap').text(), "Check for prepending of element" );
|
||||
equals( jQuery('#sap').text(), expected, "Check for prepending of element" );
|
||||
|
||||
QUnit.reset();
|
||||
expected = "Try them out:YahooThis link has class=\"blog\": Simon Willison's Weblog";
|
||||
|
@ -520,7 +520,7 @@ test("prepend(Function) with incoming value", function() {
|
|||
return [document.getElementById('first'), document.getElementById('yahoo')];
|
||||
});
|
||||
|
||||
equals( expected, jQuery('#sap').text(), "Check for prepending of array of elements" );
|
||||
equals( jQuery('#sap').text(), expected, "Check for prepending of array of elements" );
|
||||
|
||||
QUnit.reset();
|
||||
expected = "YahooTry them out:This link has class=\"blog\": Simon Willison's Weblog";
|
||||
|
@ -531,7 +531,7 @@ test("prepend(Function) with incoming value", function() {
|
|||
return jQuery("#yahoo, #first");
|
||||
});
|
||||
|
||||
equals( expected, jQuery('#sap').text(), "Check for prepending of jQuery object" );
|
||||
equals( jQuery('#sap').text(), expected, "Check for prepending of jQuery object" );
|
||||
});
|
||||
|
||||
test("prependTo(String|Element|Array<Element>|jQuery)", function() {
|
||||
|
@ -544,17 +544,17 @@ test("prependTo(String|Element|Array<Element>|jQuery)", function() {
|
|||
QUnit.reset();
|
||||
var expected = "Try them out:This link has class=\"blog\": Simon Willison's Weblog";
|
||||
jQuery(document.getElementById('first')).prependTo('#sap');
|
||||
equals( expected, jQuery('#sap').text(), "Check for prepending of element" );
|
||||
equals( jQuery('#sap').text(), expected, "Check for prepending of element" );
|
||||
|
||||
QUnit.reset();
|
||||
expected = "Try them out:YahooThis link has class=\"blog\": Simon Willison's Weblog";
|
||||
jQuery([document.getElementById('first'), document.getElementById('yahoo')]).prependTo('#sap');
|
||||
equals( expected, jQuery('#sap').text(), "Check for prepending of array of elements" );
|
||||
equals( jQuery('#sap').text(), expected, "Check for prepending of array of elements" );
|
||||
|
||||
QUnit.reset();
|
||||
expected = "YahooTry them out:This link has class=\"blog\": Simon Willison's Weblog";
|
||||
jQuery("#yahoo, #first").prependTo('#sap');
|
||||
equals( expected, jQuery('#sap').text(), "Check for prepending of jQuery object" );
|
||||
equals( jQuery('#sap').text(), expected, "Check for prepending of jQuery object" );
|
||||
|
||||
QUnit.reset();
|
||||
jQuery('<select id="prependSelect1"></select>').prependTo('form:last');
|
||||
|
@ -567,22 +567,22 @@ var testBefore = function(val) {
|
|||
expect(6);
|
||||
var expected = 'This is a normal link: bugaYahoo';
|
||||
jQuery('#yahoo').before(val( '<b>buga</b>' ));
|
||||
equals( expected, jQuery('#en').text(), 'Insert String before' );
|
||||
equals( jQuery('#en').text(), expected, 'Insert String before' );
|
||||
|
||||
QUnit.reset();
|
||||
expected = "This is a normal link: Try them out:Yahoo";
|
||||
jQuery('#yahoo').before(val( document.getElementById('first') ));
|
||||
equals( expected, jQuery('#en').text(), "Insert element before" );
|
||||
equals( jQuery('#en').text(), expected, "Insert element before" );
|
||||
|
||||
QUnit.reset();
|
||||
expected = "This is a normal link: Try them out:diveintomarkYahoo";
|
||||
jQuery('#yahoo').before(val( [document.getElementById('first'), document.getElementById('mark')] ));
|
||||
equals( expected, jQuery('#en').text(), "Insert array of elements before" );
|
||||
equals( jQuery('#en').text(), expected, "Insert array of elements before" );
|
||||
|
||||
QUnit.reset();
|
||||
expected = "This is a normal link: diveintomarkTry them out:Yahoo";
|
||||
jQuery('#yahoo').before(val( jQuery("#first, #mark") ));
|
||||
equals( expected, jQuery('#en').text(), "Insert jQuery before" );
|
||||
jQuery('#yahoo').before(val( jQuery("#mark, #first") ));
|
||||
equals( jQuery('#en').text(), expected, "Insert jQuery before" );
|
||||
|
||||
var set = jQuery("<div/>").before("<span>test</span>");
|
||||
equals( set[0].nodeName.toLowerCase(), "span", "Insert the element before the disconnected node." );
|
||||
|
@ -601,44 +601,44 @@ test("insertBefore(String|Element|Array<Element>|jQuery)", function() {
|
|||
expect(4);
|
||||
var expected = 'This is a normal link: bugaYahoo';
|
||||
jQuery('<b>buga</b>').insertBefore('#yahoo');
|
||||
equals( expected, jQuery('#en').text(), 'Insert String before' );
|
||||
equals( jQuery('#en').text(), expected, 'Insert String before' );
|
||||
|
||||
QUnit.reset();
|
||||
expected = "This is a normal link: Try them out:Yahoo";
|
||||
jQuery(document.getElementById('first')).insertBefore('#yahoo');
|
||||
equals( expected, jQuery('#en').text(), "Insert element before" );
|
||||
equals( jQuery('#en').text(), expected, "Insert element before" );
|
||||
|
||||
QUnit.reset();
|
||||
expected = "This is a normal link: Try them out:diveintomarkYahoo";
|
||||
jQuery([document.getElementById('first'), document.getElementById('mark')]).insertBefore('#yahoo');
|
||||
equals( expected, jQuery('#en').text(), "Insert array of elements before" );
|
||||
equals( jQuery('#en').text(), expected, "Insert array of elements before" );
|
||||
|
||||
QUnit.reset();
|
||||
expected = "This is a normal link: diveintomarkTry them out:Yahoo";
|
||||
jQuery("#first, #mark").insertBefore('#yahoo');
|
||||
equals( expected, jQuery('#en').text(), "Insert jQuery before" );
|
||||
jQuery("#mark, #first").insertBefore('#yahoo');
|
||||
equals( jQuery('#en').text(), expected, "Insert jQuery before" );
|
||||
});
|
||||
|
||||
var testAfter = function(val) {
|
||||
expect(6);
|
||||
var expected = 'This is a normal link: Yahoobuga';
|
||||
jQuery('#yahoo').after(val( '<b>buga</b>' ));
|
||||
equals( expected, jQuery('#en').text(), 'Insert String after' );
|
||||
equals( jQuery('#en').text(), expected, 'Insert String after' );
|
||||
|
||||
QUnit.reset();
|
||||
expected = "This is a normal link: YahooTry them out:";
|
||||
jQuery('#yahoo').after(val( document.getElementById('first') ));
|
||||
equals( expected, jQuery('#en').text(), "Insert element after" );
|
||||
equals( jQuery('#en').text(), expected, "Insert element after" );
|
||||
|
||||
QUnit.reset();
|
||||
expected = "This is a normal link: YahooTry them out:diveintomark";
|
||||
jQuery('#yahoo').after(val( [document.getElementById('first'), document.getElementById('mark')] ));
|
||||
equals( expected, jQuery('#en').text(), "Insert array of elements after" );
|
||||
equals( jQuery('#en').text(), expected, "Insert array of elements after" );
|
||||
|
||||
QUnit.reset();
|
||||
expected = "This is a normal link: YahoodiveintomarkTry them out:";
|
||||
jQuery('#yahoo').after(val( jQuery("#first, #mark") ));
|
||||
equals( expected, jQuery('#en').text(), "Insert jQuery after" );
|
||||
jQuery('#yahoo').after(val( jQuery("#mark, #first") ));
|
||||
equals( jQuery('#en').text(), expected, "Insert jQuery after" );
|
||||
|
||||
var set = jQuery("<div/>").after("<span>test</span>");
|
||||
equals( set[1].nodeName.toLowerCase(), "span", "Insert the element after the disconnected node." );
|
||||
|
@ -657,22 +657,22 @@ test("insertAfter(String|Element|Array<Element>|jQuery)", function() {
|
|||
expect(4);
|
||||
var expected = 'This is a normal link: Yahoobuga';
|
||||
jQuery('<b>buga</b>').insertAfter('#yahoo');
|
||||
equals( expected, jQuery('#en').text(), 'Insert String after' );
|
||||
equals( jQuery('#en').text(), expected, 'Insert String after' );
|
||||
|
||||
QUnit.reset();
|
||||
expected = "This is a normal link: YahooTry them out:";
|
||||
jQuery(document.getElementById('first')).insertAfter('#yahoo');
|
||||
equals( expected, jQuery('#en').text(), "Insert element after" );
|
||||
equals( jQuery('#en').text(), expected, "Insert element after" );
|
||||
|
||||
QUnit.reset();
|
||||
expected = "This is a normal link: YahooTry them out:diveintomark";
|
||||
jQuery([document.getElementById('first'), document.getElementById('mark')]).insertAfter('#yahoo');
|
||||
equals( expected, jQuery('#en').text(), "Insert array of elements after" );
|
||||
equals( jQuery('#en').text(), expected, "Insert array of elements after" );
|
||||
|
||||
QUnit.reset();
|
||||
expected = "This is a normal link: YahoodiveintomarkTry them out:";
|
||||
jQuery("#first, #mark").insertAfter('#yahoo');
|
||||
equals( expected, jQuery('#en').text(), "Insert jQuery after" );
|
||||
jQuery("#mark, #first").insertAfter('#yahoo');
|
||||
equals( jQuery('#en').text(), expected, "Insert jQuery after" );
|
||||
});
|
||||
|
||||
var testReplaceWith = function(val) {
|
||||
|
@ -699,7 +699,7 @@ var testReplaceWith = function(val) {
|
|||
ok( !jQuery("#yahoo")[0], 'Verify that original element is gone, after array of elements' );
|
||||
|
||||
QUnit.reset();
|
||||
jQuery('#yahoo').replaceWith(val( jQuery("#first, #mark") ));
|
||||
jQuery('#yahoo').replaceWith(val( jQuery("#mark, #first") ));
|
||||
ok( jQuery("#first")[0], 'Replace element with set of elements' );
|
||||
ok( jQuery("#mark")[0], 'Replace element with set of elements' );
|
||||
ok( !jQuery("#yahoo")[0], 'Verify that original element is gone, after set of elements' );
|
||||
|
@ -792,7 +792,7 @@ test("replaceAll(String|Element|Array<Element>|jQuery)", function() {
|
|||
ok( !jQuery("#yahoo")[0], 'Verify that original element is gone, after array of elements' );
|
||||
|
||||
QUnit.reset();
|
||||
jQuery("#first, #mark").replaceAll("#yahoo");
|
||||
jQuery("#mark, #first").replaceAll("#yahoo");
|
||||
ok( jQuery("#first")[0], 'Replace element with set of elements' );
|
||||
ok( jQuery("#mark")[0], 'Replace element with set of elements' );
|
||||
ok( !jQuery("#yahoo")[0], 'Verify that original element is gone, after set of elements' );
|
||||
|
|
Loading…
Reference in a new issue