You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tapestry.apache.org by hl...@apache.org on 2008/02/28 23:42:42 UTC

svn commit: r632146 - in /tapestry/tapestry5/trunk/tapestry-core/src: main/java/org/apache/tapestry/corelib/components/FormInjector.java test/java/org/apache/tapestry/integration/IntegrationTests.java

Author: hlship
Date: Thu Feb 28 14:42:41 2008
New Revision: 632146

URL: http://svn.apache.org/viewvc?rev=632146&view=rev
Log:
TAPESTRY-1650: Add support for injecting (via Ajax) new content into an existing client-side form

Modified:
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/components/FormInjector.java
    tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/IntegrationTests.java

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/components/FormInjector.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/components/FormInjector.java?rev=632146&r1=632145&r2=632146&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/components/FormInjector.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/components/FormInjector.java Thu Feb 28 14:42:41 2008
@@ -163,6 +163,7 @@
                 }
 
                 _environment.pop(ValidationTracker.class);
+                
                 FormSupportImpl formSupport = (FormSupportImpl) _environment.pop(FormSupport.class);
 
                 formSupport.executeDeferred();

Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/IntegrationTests.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/IntegrationTests.java?rev=632146&r1=632145&r2=632146&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/IntegrationTests.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/IntegrationTests.java Thu Feb 28 14:42:41 2008
@@ -796,7 +796,7 @@
         // The lack of a leading slash indicates that the path was optimized, see TAPESTRY-1502
 
         assertAttributeSeries("//script[%d]/@src", 1, "assets/scriptaculous/prototype.js",
-                         "assets/scriptaculous/scriptaculous.js");
+                              "assets/scriptaculous/scriptaculous.js");
 
         clickAndWait("link=Clear Data");
 
@@ -1796,5 +1796,35 @@
         start("List Event Context Demo");
 
         assertTextSeries("//ul[@id='eventcontext']/li[%d]", 1, "1", "2", "3");
+    }
+
+    public void form_injector()
+    {
+        start("FormInjector Demo");
+
+        assertText("sum", "0.0");
+
+        click("link=Add a row");
+
+        sleep(500);
+
+        type("//input[@type='text'][1]", "5.1");
+
+        // I wanted to add two rows, but Selenium didn't want to play.
+
+        clickAndWait(SUBMIT);
+
+        assertText("sum", "5.1");
+    }
+
+    private void sleep(long timeout)
+    {
+        try
+        {
+            Thread.sleep(timeout);
+        }
+        catch (InterruptedException ex)
+        {
+        }
     }
 }