X-Git-Url: http://git.asbjorn.it/?a=blobdiff_plain;f=test%2Funit%2Fmanipulation.js;h=6de3e14eb2db2ef407f33450985b63d5c27b5ceb;hb=4e9fed3b16ed9612ed373d14a89294e98054f4dd;hp=75a1baa1f326e33961ad4e157aef9b7fda62a617;hpb=628e1564c48f2b4d18ed5af89ebed88b09d972d4;p=jquery.git
diff --git a/test/unit/manipulation.js b/test/unit/manipulation.js
index 75a1baa..6de3e14 100644
--- a/test/unit/manipulation.js
+++ b/test/unit/manipulation.js
@@ -13,7 +13,7 @@ test("text()", function() {
});
var testWrap = function(val) {
- expect(15);
+ 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' );
@@ -54,6 +54,20 @@ var testWrap = function(val) {
equals( j[0].parentNode.parentNode.childNodes.length, 1, "There should only be one element wrapping." );
equals( j.length, 1, "There should only be one element (no cloning)." );
equals( j[0].parentNode.nodeName.toUpperCase(), "P", "The span should be in the paragraph." );
+
+ // Wrap an element with a jQuery set
+ j = jQuery("").wrap(jQuery(""));
+ equals( j[0].parentNode.nodeName.toLowerCase(), "div", "Wrapping works." );
+
+ // Wrap an element with a jQuery set and event
+ result = jQuery("").click(function(){
+ ok(true, "Event triggered.");
+ });
+
+ j = jQuery("").wrap(result);
+ equals( j[0].parentNode.nodeName.toLowerCase(), "div", "Wrapping works." );
+
+ j.parent().trigger("click");
}
test("wrap(String|Element)", function() {
@@ -535,7 +549,7 @@ test("replaceAll(String|Element|Array<Element>|jQuery)", function() {
});
test("clone()", function() {
- expect(28);
+ expect(30);
equals( 'This is a normal link: Yahoo', jQuery('#en').text(), 'Assert text for #en' );
var clone = jQuery('#yahoo').clone();
equals( 'Try them out:Yahoo', jQuery('#first').append(clone).text(), 'Check for clone' );
@@ -580,6 +594,11 @@ test("clone()", function() {
div = div.clone(true);
equals( div.length, 1, "One element cloned" );
equals( div[0].nodeName.toUpperCase(), "DIV", "DIV element cloned" );
+
+ div = jQuery("").data({ a: true, b: true });
+ div = div.clone(true);
+ equals( div.data("a"), true, "Data cloned." );
+ equals( div.data("b"), true, "Data cloned." );
});
if (!isLocal) {
@@ -659,7 +678,7 @@ test("val(Function)", function() {
})
var testHtml = function(valueObj) {
- expect(20);
+ expect(22);
jQuery.scriptorder = 0;
@@ -693,6 +712,10 @@ var testHtml = function(valueObj) {
equals( $div2.html("x" + insert).html(), "x" + insert, "Verify escaped insertion." );
equals( $div2.html(" " + insert).html(), " " + insert, "Verify escaped insertion." );
+ var map = jQuery("").html(valueObj(""));
+
+ equals( map[0].childNodes.length, 1, "The area was inserted." );
+ equals( map[0].firstChild.nodeName.toLowerCase(), "area", "The area was inserted." );
reset();