tapestry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From andy...@apache.org
Subject svn commit: r596099 - in /tapestry/tapestry4/trunk/tapestry-framework/src: js/tapestry/form.js test/org/apache/tapestry/integration/TestBrowserIssues.java
Date Sun, 18 Nov 2007 17:09:18 GMT
Author: andyhot
Date: Sun Nov 18 09:09:18 2007
New Revision: 596099

URL: http://svn.apache.org/viewvc?rev=596099&view=rev
Log:
TAPESTRY-1775: fixes & tests

Modified:
    tapestry/tapestry4/trunk/tapestry-framework/src/js/tapestry/form.js
    tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/integration/TestBrowserIssues.java

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/js/tapestry/form.js
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/js/tapestry/form.js?rev=596099&r1=596098&r2=596099&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/js/tapestry/form.js (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/js/tapestry/form.js Sun Nov 18 09:09:18
2007
@@ -279,9 +279,9 @@
 			return;
 		}
 		var id=form.getAttribute("id");
-		if (submitName){
-			form.submitname.value=submitName;
-		}
+        if (submitName){
+            form.submitname.value = submitName;
+        }
 
         if (!dj_undef("value", form.submitmode)
                 && (form.submitmode.value == "cancel" || form.submitmode.value ==
"refresh")
@@ -292,8 +292,8 @@
 
         if (!tapestry.form.validation.validateForm(form, this.forms[id])) {
 			return;
-		}
-		
+        }
+
 		if (parms && !dj_undef("async", parms) && parms.async) {
 			tapestry.form.submitAsync(form, null, submitName, parms);
 			return;
@@ -301,9 +301,9 @@
 			tapestry.form.submitAsync(form);
 			return;
 		}
-        
-        form.submit();
-	},
+
+            form.submit();
+    },
 	
 	/**
 	 * Function: cancel
@@ -329,7 +329,8 @@
         var formName=form.getAttribute("id");
         var validateState=tapestry.form.forms[formName].validateForm;
         tapestry.form.setFormValidating(formName, false);
-        
+
+        var previous = form.submitmode.value;
         form.submitmode.value="cancel";
 
         if (parms && !dj_undef("async", parms) && parms.async){
@@ -337,7 +338,8 @@
         } else {
             this.submit(form, submitName, parms);
         }
-        
+
+        form.submitmode.value = previous;
         tapestry.form.setFormValidating(formName, validateState);
 	},
 	
@@ -365,7 +367,8 @@
         var formName=form.getAttribute("id");
         var validateState=tapestry.form.forms[formName].validateForm;
         tapestry.form.setFormValidating(formName, false);
-        
+
+        var previous = form.submitmode.value;
         form.submitmode.value="refresh";
 
         if (parms && !dj_undef("async", parms) && parms.async){
@@ -373,7 +376,8 @@
         } else {
             this.submit(form, submitName, parms);
         }
-        
+
+        form.submitmode.value = previous;
         tapestry.form.setFormValidating(formName, validateState);
     },
 	
@@ -406,9 +410,10 @@
 			dojo.log.debug("Form validation failed for form with id " + formId);
 			return;
 		}
-		
-		if (submitName){
-			form.submitname.value=submitName;
+
+        if (submitName){
+            var previous = form.submitname.value;
+            form.submitname.value=submitName;
 			if(!content){ content={}; }
 			if(form[submitName]){
 				content[submitName]=form[submitName].value;
@@ -419,7 +424,8 @@
 		if (!dj_undef("clickedButton", this.forms[formId])) {
 			if (!content) { content={}; }
 			content[this.forms[formId].clickedButton.getAttribute("name")]=this.forms[formId].clickedButton.getAttribute("value");
-		}
+            delete this.forms[formId].clickedButton;
+        }
 
 		var kwArgs={
 			formNode:form,
@@ -446,7 +452,11 @@
 		}
 		tapestry.requestsInFlight++;
         dojo.io.queueBind(kwArgs);
-	}
+
+        if (submitName){
+            form.submitname.value = previous;
+        }
+    }
 }
 
 tapestry.form.validation={

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/integration/TestBrowserIssues.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/integration/TestBrowserIssues.java?rev=596099&r1=596098&r2=596099&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/integration/TestBrowserIssues.java
(original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/integration/TestBrowserIssues.java
Sun Nov 18 09:09:18 2007
@@ -131,9 +131,9 @@
 
         waitForInnerHTML("msg", "SECOND");
 
-        _selenium.click("first");
+        _selenium.click("nothing");
 
-        waitForInnerHTML("msg", "");        
+        waitForNodeToDisappear("msg");
     }
 
     public void test_issue_1775_b() throws Exception
@@ -175,6 +175,12 @@
     {
         _selenium.waitForCondition("selenium.browserbot.getCurrentWindow().document.getElementById('"
                 + elm + "').innerHTML=='" + content + "'","6000");                
+    }
+
+    private void waitForNodeToDisappear(String elm)
+    {
+        _selenium.waitForCondition("!selenium.browserbot.getCurrentWindow().document.getElementById('"
+                + elm + "')","6000");
     }
     
     private void submitFromTextfield(String field)



Mime
View raw message