You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by hl...@apache.org on 2011/06/30 02:38:21 UTC

svn commit: r1141348 - /tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry5/integration/app1/pages/JavaScriptTests.tml

Author: hlship
Date: Thu Jun 30 00:38:21 2011
New Revision: 1141348

URL: http://svn.apache.org/viewvc?rev=1141348&view=rev
Log:
TAP5-999: Add a test to show that removing an element via T5.dom.remove() will remove publishers and listeners for that element

Modified:
    tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry5/integration/app1/pages/JavaScriptTests.tml

Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry5/integration/app1/pages/JavaScriptTests.tml
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry5/integration/app1/pages/JavaScriptTests.tml?rev=1141348&r1=1141347&r2=1141348&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry5/integration/app1/pages/JavaScriptTests.tml (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry5/integration/app1/pages/JavaScriptTests.tml Thu Jun 30 00:38:21 2011
@@ -275,6 +275,38 @@
         </pre>
     </div>
 
+    <div>
+      <p>Removing an element also removes publishers and subscribers for the element.</p>
+      <pre>
+        var pubs = []
+
+        var element = new Element("span").update("Published Message Source")
+
+        document.body.insert({bottom: element})
+
+        sub("bar", null, function() { pubs.push("general") })
+        sub("bar", element, function() { pubs.push("specific") } )
+
+        pub("bar", element, {})
+
+        assertEqual(pubs, ["specific", "general"])
+
+        T5.dom.remove(element)
+
+        pubs = []
+
+        pub("bar", element, {})
+
+        assertEqual(pubs, ["general"])
+
+        pubs = []
+
+        pub("bar", document.body, {})
+
+        assertEqual(pubs, ["general"])
+      </pre>
+    </div>
+
 
   </div>