module("manipulation"); var bareObj = function(value) { return value; }; var functionReturningObj = function(value) { return (function() { return value; }); }; test("text()", function() { expect(2); var expected = "This link has class=\"blog\": Simon Willison's Weblog"; equals( jQuery('#sap').text(), expected, 'Check for merged text of more then one element.' ); // Check serialization of text values equals( jQuery(document.createTextNode("foo")).text(), "foo", "Text node was retreived from .text()." ); }); var testWrap = function(val) { expect(18); var defaultText = 'Try them out:' var result = jQuery('#first').wrap(val( '
' )).text(); equals( defaultText, result, 'Check for wrapping of on-the-fly html' ); ok( jQuery('#first').parent().parent().is('.red'), 'Check if wrapper has class "red"' ); reset(); var defaultText = 'Try them out:' var result = jQuery('#first').wrap(val( document.getElementById('empty') )).parent(); ok( result.is('ol'), 'Check for element wrapping' ); equals( result.text(), defaultText, 'Check for element wrapping' ); reset(); jQuery('#check1').click(function() { var checkbox = this; ok( checkbox.checked, "Checkbox's state is erased after wrap() action, see #769" ); jQuery(checkbox).wrap(val( '' )); ok( checkbox.checked, "Checkbox's state is erased after wrap() action, see #769" ); }).click(); // using contents will get comments regular, text, and comment nodes var j = jQuery("#nonnodes").contents(); j.wrap(val( "" )); equals( jQuery("#nonnodes > i").length, 3, "Check node,textnode,comment wraps ok" ); equals( jQuery("#nonnodes > i").text(), j.text(), "Check node,textnode,comment wraps doesn't hurt text" ); // Try wrapping a disconnected node j = jQuery("