obj.append(valueObj( 5 ));
ok( obj.text().match( /5$/ ), "Check for appending a number" + objType );
+ QUnit.reset();
+ expected = "This link has class=\"blog\": Simon Willison's WeblogTry them out:GoogleYahoo";
+ obj = getObj();
+ obj.append( valueObj( [ jQuery("#first"), jQuery("#yahoo, #google") ] ) );
+ equal( obj.text(), expected, "Check for appending of array of jQuery objects" );
+
QUnit.reset();
obj = getObj();
obj.append(valueObj( " text with spaces " ));
}
var testAppend = function(valueObj) {
- expect(56);
+ expect(58);
testAppendForObject(valueObj, false);
testAppendForObject(valueObj, true);
});
var testPrepend = function(val) {
- expect(5);
+ expect(6);
var defaultText = "Try them out:"
var result = jQuery("#first").prepend(val( "<b>buga</b>" ));
equal( result.text(), "buga" + defaultText, "Check if text prepending works" );
expected = "YahooTry them out:This link has class=\"blog\": Simon Willison's Weblog";
jQuery("#sap").prepend(val( jQuery("#yahoo, #first") ));
equal( jQuery("#sap").text(), expected, "Check for prepending of jQuery object" );
+
+ QUnit.reset();
+ expected = "Try them out:GoogleYahooThis link has class=\"blog\": Simon Willison's Weblog";
+ jQuery("#sap").prepend( val( [ jQuery("#first"), jQuery("#yahoo, #google") ] ) );
+ equal( jQuery("#sap").text(), expected, "Check for prepending of array of jQuery objects" );
};
test("prepend(String|Element|Array<Element>|jQuery)", function() {
});
var testBefore = function(val) {
- expect(6);
+ expect(7);
var expected = "This is a normal link: bugaYahoo";
jQuery("#yahoo").before(val( "<b>buga</b>" ));
equal( jQuery("#en").text(), expected, "Insert String before" );
jQuery("#yahoo").before(val( jQuery("#mark, #first") ));
equal( jQuery("#en").text(), expected, "Insert jQuery before" );
+ QUnit.reset();
+ expected = "This is a normal link: Try them out:GooglediveintomarkYahoo";
+ jQuery("#yahoo").before( val( [ jQuery("#first"), jQuery("#mark, #google") ] ) );
+ equal( jQuery("#en").text(), expected, "Insert array of jQuery objects before" );
+
var set = jQuery("<div/>").before("<span>test</span>");
equal( set[0].nodeName.toLowerCase(), "span", "Insert the element before the disconnected node." );
equal( set.length, 2, "Insert the element before the disconnected node." );
});
var testAfter = function(val) {
- expect(6);
+ expect(7);
var expected = "This is a normal link: Yahoobuga";
jQuery("#yahoo").after(val( "<b>buga</b>" ));
equal( jQuery("#en").text(), expected, "Insert String after" );
jQuery("#yahoo").after(val( jQuery("#mark, #first") ));
equal( jQuery("#en").text(), expected, "Insert jQuery after" );
+ QUnit.reset();
+ expected = "This is a normal link: YahooTry them out:Googlediveintomark";
+ jQuery("#yahoo").after( val( [ jQuery("#first"), jQuery("#mark, #google") ] ) );
+ equal( jQuery("#en").text(), expected, "Insert array of jQuery objects after" );
+
var set = jQuery("<div/>").after("<span>test</span>");
equal( set[1].nodeName.toLowerCase(), "span", "Insert the element after the disconnected node." );
equal( set.length, 2, "Insert the element after the disconnected node." );