You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@struts.apache.org by tm...@apache.org on 2006/05/07 15:51:47 UTC

svn commit: r404761 - in /incubator/webwork2/core/src: main/java/org/apache/struts/action2/components/ test/java/org/apache/struts/action2/views/jsp/ui/ test/resources/org/apache/struts/action2/views/jsp/ui/

Author: tmjee
Date: Sun May  7 06:51:44 2006
New Revision: 404761

URL: http://svn.apache.org/viewcvs?rev=404761&view=rev
Log:
ww-769


Added:
    incubator/webwork2/core/src/test/resources/org/apache/struts/action2/views/jsp/ui/Component-2.txt   (with props)
    incubator/webwork2/core/src/test/resources/org/apache/struts/action2/views/jsp/ui/Component-3.txt   (with props)
Modified:
    incubator/webwork2/core/src/main/java/org/apache/struts/action2/components/Component.java
    incubator/webwork2/core/src/test/java/org/apache/struts/action2/views/jsp/ui/ComponentTest.java

Modified: incubator/webwork2/core/src/main/java/org/apache/struts/action2/components/Component.java
URL: http://svn.apache.org/viewcvs/incubator/webwork2/core/src/main/java/org/apache/struts/action2/components/Component.java?rev=404761&r1=404760&r2=404761&view=diff
==============================================================================
--- incubator/webwork2/core/src/main/java/org/apache/struts/action2/components/Component.java (original)
+++ incubator/webwork2/core/src/main/java/org/apache/struts/action2/components/Component.java Sun May  7 06:51:44 2006
@@ -446,7 +446,9 @@
      * @a2.tagattribute required="false"
      */
     public void setId(String id) {
-        this.id = id;
+    	if (id != null) {
+    		this.id = findString(id);
+    	}
     }
 
     /**

Modified: incubator/webwork2/core/src/test/java/org/apache/struts/action2/views/jsp/ui/ComponentTest.java
URL: http://svn.apache.org/viewcvs/incubator/webwork2/core/src/test/java/org/apache/struts/action2/views/jsp/ui/ComponentTest.java?rev=404761&r1=404760&r2=404761&view=diff
==============================================================================
--- incubator/webwork2/core/src/test/java/org/apache/struts/action2/views/jsp/ui/ComponentTest.java (original)
+++ incubator/webwork2/core/src/test/java/org/apache/struts/action2/views/jsp/ui/ComponentTest.java Sun May  7 06:51:44 2006
@@ -25,6 +25,45 @@
  */
 public class ComponentTest extends AbstractUITagTest {
 
+	/**
+	 * Test that id attribute is evaludated against the Ognl Stack.
+	 * @throws Exception
+	 */
+	public void testIdIsEvaluatedAgainstStack1() throws Exception {
+		TestAction testAction = (TestAction) action;
+		testAction.setFoo("myFooValue");
+		
+		TextFieldTag tag = new TextFieldTag();
+		tag.setPageContext(pageContext);
+        tag.setLabel("mylabel");
+        tag.setName("myname");
+        tag.setValue("foo");
+        tag.setId("%{foo}");
+		
+        tag.doStartTag();
+        tag.doEndTag();
+
+        verify(ComponentTag.class.getResource("Component-2.txt"));
+	}
+	
+	public void testIdIsEvaludatedAgainstStack2() throws Exception {
+		TestAction testAction = (TestAction) action;
+		testAction.setFoo("myFooValue");
+		
+		TextFieldTag tag = new TextFieldTag();
+		tag.setPageContext(pageContext);
+        tag.setLabel("mylabel");
+        tag.setName("myname");
+        tag.setValue("foo");
+        tag.setId("foo");
+		
+        tag.doStartTag();
+        tag.doEndTag();
+
+        verify(ComponentTag.class.getResource("Component-3.txt"));
+	}
+	
+	
     /**
      * Note -- this test uses empty.vm, so it's basically clear
      */

Added: incubator/webwork2/core/src/test/resources/org/apache/struts/action2/views/jsp/ui/Component-2.txt
URL: http://svn.apache.org/viewcvs/incubator/webwork2/core/src/test/resources/org/apache/struts/action2/views/jsp/ui/Component-2.txt?rev=404761&view=auto
==============================================================================
--- incubator/webwork2/core/src/test/resources/org/apache/struts/action2/views/jsp/ui/Component-2.txt (added)
+++ incubator/webwork2/core/src/test/resources/org/apache/struts/action2/views/jsp/ui/Component-2.txt Sun May  7 06:51:44 2006
@@ -0,0 +1,8 @@
+<tr>
+	<td class="tdLabel">
+		<label for="myFooValue" class="label">mylabel:</label>
+	</td>
+	<td>
+		<input type="text" name="myname" value="foo" id="myFooValue"/>
+	</td>
+</tr>

Propchange: incubator/webwork2/core/src/test/resources/org/apache/struts/action2/views/jsp/ui/Component-2.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/webwork2/core/src/test/resources/org/apache/struts/action2/views/jsp/ui/Component-3.txt
URL: http://svn.apache.org/viewcvs/incubator/webwork2/core/src/test/resources/org/apache/struts/action2/views/jsp/ui/Component-3.txt?rev=404761&view=auto
==============================================================================
--- incubator/webwork2/core/src/test/resources/org/apache/struts/action2/views/jsp/ui/Component-3.txt (added)
+++ incubator/webwork2/core/src/test/resources/org/apache/struts/action2/views/jsp/ui/Component-3.txt Sun May  7 06:51:44 2006
@@ -0,0 +1,8 @@
+<tr>
+	<td class="tdLabel">
+		<label for="foo" class="label">mylabel:</label>
+	</td>
+	<td>
+		<input type="text" name="myname" value="foo" id="foo"/>
+	</td>
+</tr>

Propchange: incubator/webwork2/core/src/test/resources/org/apache/struts/action2/views/jsp/ui/Component-3.txt
------------------------------------------------------------------------------
    svn:eol-style = native