struts-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lukaszlen...@apache.org
Subject [12/12] git commit: Extends test to use the new attribute
Date Fri, 27 Jun 2014 11:06:57 GMT
Extends test to use the new attribute


Project: http://git-wip-us.apache.org/repos/asf/struts/repo
Commit: http://git-wip-us.apache.org/repos/asf/struts/commit/d67fce1f
Tree: http://git-wip-us.apache.org/repos/asf/struts/tree/d67fce1f
Diff: http://git-wip-us.apache.org/repos/asf/struts/diff/d67fce1f

Branch: refs/heads/feature/WW-4295-localization
Commit: d67fce1f2577229139938d4588bb970c3f869078
Parents: ed8a0b8
Author: Lukasz Lenart <lukaszlenart@apache.org>
Authored: Fri Jun 27 12:56:01 2014 +0200
Committer: Lukasz Lenart <lukaszlenart@apache.org>
Committed: Fri Jun 27 12:56:01 2014 +0200

----------------------------------------------------------------------
 .../struts2/views/jsp/ui/OptGroupTest.java      | 41 ++++++++++++++++++++
 .../apache/struts2/views/jsp/ui/OptGroup-6.txt  | 40 +++++++++++++++++++
 2 files changed, 81 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/struts/blob/d67fce1f/core/src/test/java/org/apache/struts2/views/jsp/ui/OptGroupTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/struts2/views/jsp/ui/OptGroupTest.java b/core/src/test/java/org/apache/struts2/views/jsp/ui/OptGroupTest.java
index c11f511..038cb6a 100644
--- a/core/src/test/java/org/apache/struts2/views/jsp/ui/OptGroupTest.java
+++ b/core/src/test/java/org/apache/struts2/views/jsp/ui/OptGroupTest.java
@@ -23,6 +23,7 @@ package org.apache.struts2.views.jsp.ui;
 
 import java.util.LinkedHashMap;
 
+import com.opensymphony.xwork2.Action;
 import org.apache.struts2.TestAction;
 import org.apache.struts2.views.jsp.AbstractUITagTest;
 
@@ -190,4 +191,44 @@ public class OptGroupTest extends AbstractUITagTest {
         //System.out.println(writer.toString());
         verify(SelectTag.class.getResource("OptGroup-5.txt"));
     }
+
+    public void testOptGroupWithValueKey() throws Exception {
+        SelectTag selectTag = new SelectTag();
+        selectTag.setName("mySelection");
+        selectTag.setLabel("My Selection");
+        selectTag.setList("%{#{'ONE':'one','TWO':'two','THREE':'three'}}");
+        selectTag.setListValueKey("valueKey");
+
+        stack.push(new Action() {
+            public String execute() throws Exception {
+                return SUCCESS;
+            }
+
+            public String getValueKey() { return "MyValue"; }
+        });
+
+        OptGroupTag optGroupTag1 = new OptGroupTag();
+        optGroupTag1.setLabel("My Label 1");
+        optGroupTag1.setList("%{#{'AAA':'aaa','BBB':'bbb','CCC':'ccc'}}");
+
+        OptGroupTag optGroupTag2 = new OptGroupTag();
+        optGroupTag2.setLabel("My Label 2");
+        optGroupTag2.setList("%{#{'DDD':'ddd','EEE':'eee','FFF':'fff'}}");
+
+        selectTag.setPageContext(pageContext);
+        selectTag.doStartTag();
+        optGroupTag1.setPageContext(pageContext);
+        optGroupTag1.doStartTag();
+        optGroupTag1.doEndTag();
+        optGroupTag2.setPageContext(pageContext);
+        optGroupTag2.doStartTag();
+        optGroupTag2.doEndTag();
+        selectTag.doEndTag();
+
+
+        //System.out.println(writer.toString());
+        verify(SelectTag.class.getResource("OptGroup-6.txt"));
+    }
+
+
 }

http://git-wip-us.apache.org/repos/asf/struts/blob/d67fce1f/core/src/test/resources/org/apache/struts2/views/jsp/ui/OptGroup-6.txt
----------------------------------------------------------------------
diff --git a/core/src/test/resources/org/apache/struts2/views/jsp/ui/OptGroup-6.txt b/core/src/test/resources/org/apache/struts2/views/jsp/ui/OptGroup-6.txt
new file mode 100644
index 0000000..401ef44
--- /dev/null
+++ b/core/src/test/resources/org/apache/struts2/views/jsp/ui/OptGroup-6.txt
@@ -0,0 +1,40 @@
+<tr>
+    <td class="tdLabel"><label for="mySelection" class="label">My Selection:</label></td>
+    <td>
+<select name="mySelection" id="mySelection">
+    <option value="ONE">MyValue</option>
+    <option value="TWO">MyValue</option>
+    <option value="THREE">MyValue</option>
+
+<optgroup 
+	label="My Label 1"
+>
+
+	<option value="AAA"
+	>aaa
+	</option>
+	<option value="BBB"
+	>bbb
+	</option>
+	<option value="CCC"
+	>ccc
+	</option>
+</optgroup>
+<optgroup 
+	label="My Label 2"
+>
+
+	<option value="DDD"
+	>ddd
+	</option>
+	<option value="EEE"
+	>eee
+	</option>
+	<option value="FFF"
+	>fff
+	</option>
+</optgroup>
+
+</select>
+</td>
+</tr>
\ No newline at end of file


Mime
View raw message