]> source.dussan.org Git - gwtquery.git/commitdiff
add test for unwrap() method
authorJulien Dramaix <julien.dramaix@gmail.com>
Thu, 31 Mar 2011 21:27:41 +0000 (21:27 +0000)
committerJulien Dramaix <julien.dramaix@gmail.com>
Thu, 31 Mar 2011 21:27:41 +0000 (21:27 +0000)
gwtquery-core/src/test/java/com/google/gwt/query/client/GQueryCoreTest.java

index 0e9db738202bf81e411c19feab2b43875bbb46f2..55c78842d377044b685c4c77a5ebfd6b6bc13dd5 100644 (file)
@@ -1145,5 +1145,24 @@ public class GQueryCoreTest extends GWTTestCase {
     
     
   }
+  
+  public void testUnwrapMethod(){
+    String html = "<div class='parent'><div class='child'>child1</div><span>other child</span></div><div class='parent'><div class='child'>child2</div></div><div class='parent'><div class='child'>child3</div></div>";
+    $(e).html(html);
+    
+    assertEquals(3, $(".parent", e).length());
+    assertEquals(3, $(".child", e).length());
+System.err.println("before" +$(e));
+    
+    $(".child",e).unwrap();
+    System.err.println("after" +$(e));    
+    assertEquals(0, $(".parent",e).length());
+    assertEquals(3, $(".child",e).length());
+    
+    String expectedHtml = "<div class=\"child\">child1</div><span>other child</span><div class=\"child\">child2</div><div class=\"child\">child3</div>";
+    
+    assertEquals(expectedHtml, $(e).html());
+    
+  }
 
 }