0
@@ -12,6 +12,42 @@ test("text()", function() {
0
equals( jQuery(document.createTextNode("foo")).text(), "foo", "Text node was retreived from .text()." );
0
+var testText = function(valueObj) {
0
+ var val = valueObj("<div><b>Hello</b> cruel world!</div>");
0
+ equals( jQuery("#foo").text(val)[0].innerHTML.replace(/>/g, ">"), "<div><b>Hello</b> cruel world!</div>", "Check escaped text" );
0
+ // using contents will get comments regular, text, and comment nodes
0
+ var j = jQuery("#nonnodes").contents();
0
+ j.text(valueObj("hi!"));
0
+ equals( jQuery(j[0]).text(), "hi!", "Check node,textnode,comment with text()" );
0
+ equals( j[1].nodeValue, " there ", "Check node,textnode,comment with text()" );
0
+ equals( j[2].nodeType, 8, "Check node,textnode,comment with text()" );
0
+test("text(String)", function() {
0
+test("text(Function)", function() {
0
+ testText(functionReturningObj);
0
+test("text(Function) with incoming value", function() {
0
+ var old = "This link has class=\"blog\": Simon Willison's Weblog";
0
+ jQuery('#sap').text(function(i, val) {
0
+ equals( val, old, "Make sure the incoming value is correct." );
0
+ equals( jQuery("#sap").text(), "foobar", 'Check for merged text of more then one element.' );
0
var testWrap = function(val) {
0
var defaultText = 'Try them out:'
0
@@ -133,7 +169,7 @@ test("wrapInner(String|Element)", function() {
0
// testWrapInner(functionReturningObj)
0
-
var testUnwrap = function() {
0
+
test("unwrap()", function() {
0
jQuery("body").append(' <div id="unwrap" style="display: none;"> <div id="unwrap1"> <span class="unwrap">a</span> <span class="unwrap">b</span> </div> <div id="unwrap2"> <span class="unwrap">c</span> <span class="unwrap">d</span> </div> <div id="unwrap3"> <b><span class="unwrap unwrap3">e</span></b> <b><span class="unwrap unwrap3">f</span></b> </div> </div>');
0
@@ -158,10 +194,6 @@ var testUnwrap = function() {
0
same( jQuery('body > span.unwrap').get(), abcdef, 'body contains 6 .unwrap child spans' );
0
jQuery('body > span.unwrap').remove();
0
-test("unwrap()", function() {
0
var testAppend = function(valueObj) {
0
@@ -682,27 +714,6 @@ test("html(Function)", function() {
0
testHtml(functionReturningObj);
0
-var testText = function(valueObj) {
0
- var val = valueObj("<div><b>Hello</b> cruel world!</div>");
0
- equals( jQuery("#foo").text(val)[0].innerHTML.replace(/>/g, ">"), "<div><b>Hello</b> cruel world!</div>", "Check escaped text" );
0
- // using contents will get comments regular, text, and comment nodes
0
- var j = jQuery("#nonnodes").contents();
0
- j.text(valueObj("hi!"));
0
- equals( jQuery(j[0]).text(), "hi!", "Check node,textnode,comment with text()" );
0
- equals( j[1].nodeValue, " there ", "Check node,textnode,comment with text()" );
0
- equals( j[2].nodeType, 8, "Check node,textnode,comment with text()" );
0
-test("text(String)", function() {
0
-test("text(Function)", function() {
0
- testText(functionReturningObj);
0
var testRemove = function(method) {