| OLD | NEW |
| 1 module("manipulation", { teardown: moduleTeardown }); | 1 module("manipulation", { teardown: moduleTeardown }); |
| 2 | 2 |
| 3 // Ensure that an extended Array prototype doesn't break jQuery | 3 // Ensure that an extended Array prototype doesn't break jQuery |
| 4 Array.prototype.arrayProtoFn = function(arg) { throw("arrayProtoFn should not be
called"); }; | 4 Array.prototype.arrayProtoFn = function(arg) { throw("arrayProtoFn should not be
called"); }; |
| 5 | 5 |
| 6 var bareObj = function(value) { return value; }; | 6 var bareObj = function(value) { return value; }; |
| 7 var functionReturningObj = function(value) { return (function() { return value;
}); }; | 7 var functionReturningObj = function(value) { return (function() { return value;
}); }; |
| 8 | 8 |
| 9 test("text()", function() { | 9 test("text()", function() { |
| 10 expect(2); | 10 expect(2); |
| 11 var expected = "This link has class=\"blog\": Simon Willison's Weblog"; | 11 var expected = "This link has class=\"blog\": Simon Willison's Weblog"; |
| 12 » equals( jQuery('#sap').text(), expected, 'Check for merged text of more
then one element.' ); | 12 » equals( jQuery('#sap').text(), expected, 'Check for merged text of more
than one element.' ); |
| 13 | 13 |
| 14 // Check serialization of text values | 14 // Check serialization of text values |
| 15 equals( jQuery(document.createTextNode("foo")).text(), "foo", "Text node
was retreived from .text()." ); | 15 equals( jQuery(document.createTextNode("foo")).text(), "foo", "Text node
was retreived from .text()." ); |
| 16 }); | 16 }); |
| 17 | 17 |
| 18 var testText = function(valueObj) { | 18 var testText = function(valueObj) { |
| 19 expect(4); | 19 expect(4); |
| 20 var val = valueObj("<div><b>Hello</b> cruel world!</div>"); | 20 var val = valueObj("<div><b>Hello</b> cruel world!</div>"); |
| 21 equals( jQuery("#foo").text(val)[0].innerHTML.replace(/>/g, ">"), "&l
t;div><b>Hello</b> cruel world!</div>", "Check escaped text
" ); | 21 equals( jQuery("#foo").text(val)[0].innerHTML.replace(/>/g, ">"), "&l
t;div><b>Hello</b> cruel world!</div>", "Check escaped text
" ); |
| 22 | 22 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 41 test("text(Function) with incoming value", function() { | 41 test("text(Function) with incoming value", function() { |
| 42 expect(2); | 42 expect(2); |
| 43 | 43 |
| 44 var old = "This link has class=\"blog\": Simon Willison's Weblog"; | 44 var old = "This link has class=\"blog\": Simon Willison's Weblog"; |
| 45 | 45 |
| 46 jQuery('#sap').text(function(i, val) { | 46 jQuery('#sap').text(function(i, val) { |
| 47 equals( val, old, "Make sure the incoming value is correct." ); | 47 equals( val, old, "Make sure the incoming value is correct." ); |
| 48 return "foobar"; | 48 return "foobar"; |
| 49 }); | 49 }); |
| 50 | 50 |
| 51 » equals( jQuery("#sap").text(), "foobar", 'Check for merged text of more
then one element.' ); | 51 » equals( jQuery("#sap").text(), "foobar", 'Check for merged text of more
than one element.' ); |
| 52 | 52 |
| 53 QUnit.reset(); | 53 QUnit.reset(); |
| 54 }); | 54 }); |
| 55 | 55 |
| 56 var testWrap = function(val) { | 56 var testWrap = function(val) { |
| 57 expect(19); | 57 expect(19); |
| 58 var defaultText = 'Try them out:' | 58 var defaultText = 'Try them out:' |
| 59 var result = jQuery('#first').wrap(val( '<div class="red"><span></span><
/div>' )).text(); | 59 var result = jQuery('#first').wrap(val( '<div class="red"><span></span><
/div>' )).text(); |
| 60 equals( defaultText, result, 'Check for wrapping of on-the-fly html' ); | 60 equals( defaultText, result, 'Check for wrapping of on-the-fly html' ); |
| 61 ok( jQuery('#first').parent().parent().is('.red'), 'Check if wrapper has
class "red"' ); | 61 ok( jQuery('#first').parent().parent().is('.red'), 'Check if wrapper has
class "red"' ); |
| (...skipping 1291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1353 | 1353 |
| 1354 for ( var i=0; i < bad.length; i++ ) { | 1354 for ( var i=0; i < bad.length; i++ ) { |
| 1355 try { | 1355 try { |
| 1356 $f.append( bad[i] ); | 1356 $f.append( bad[i] ); |
| 1357 } | 1357 } |
| 1358 catch(e) {} | 1358 catch(e) {} |
| 1359 } | 1359 } |
| 1360 equals($f.text(), bad.join(''), "Cached strings that match Object properties
"); | 1360 equals($f.text(), bad.join(''), "Cached strings that match Object properties
"); |
| 1361 $f.remove(); | 1361 $f.remove(); |
| 1362 }); | 1362 }); |
| OLD | NEW |