You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@struts.apache.org by mr...@apache.org on 2007/01/08 20:05:41 UTC
svn commit: r494155 - in /struts/struts2/trunk/core/src/test:
java/org/apache/struts2/views/jsp/ui/SelectTest.java
resources/org/apache/struts2/views/jsp/ui/Select-10.txt
Author: mrdon
Date: Mon Jan 8 11:05:40 2007
New Revision: 494155
URL: http://svn.apache.org/viewvc?view=rev&rev=494155
Log:
Added test for byte key in select tag
WW-1601
Added:
struts/struts2/trunk/core/src/test/resources/org/apache/struts2/views/jsp/ui/Select-10.txt
Modified:
struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ui/SelectTest.java
Modified: struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ui/SelectTest.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ui/SelectTest.java?view=diff&rev=494155&r1=494154&r2=494155
==============================================================================
--- struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ui/SelectTest.java (original)
+++ struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ui/SelectTest.java Mon Jan 8 11:05:40 2007
@@ -51,6 +51,48 @@
}
/**
+ * Tests WW-1601: Select tag template does not work properly for Object like Byte.
+ */
+ public void testByte() throws Exception {
+ ByteObject hello = new ByteObject(new Byte((byte)1), "hello");
+ ByteObject foo = new ByteObject(new Byte((byte)2), "foo");
+
+ TestAction testAction = (TestAction) action;
+
+ Collection collection = new ArrayList(2);
+ // expect strings to be returned, we're still dealing with HTTP here!
+ collection.add("1");
+ collection.add("2");
+ testAction.setCollection(collection);
+
+ List list2 = new ArrayList();
+ list2.add(hello);
+ list2.add(foo);
+ testAction.setList2(list2);
+
+ SelectTag tag = new SelectTag();
+ tag.setPageContext(pageContext);
+ tag.setLabel("mylabel");
+ tag.setName("collection");
+ tag.setList("list2");
+ tag.setListKey("byte");
+ tag.setListValue("name");
+ tag.setMultiple("true");
+ tag.setTitle("mytitle");
+ tag.setOnmousedown("alert('onmousedown');");
+ tag.setOnmousemove("alert('onmousemove');");
+ tag.setOnmouseout("alert('onmouseout');");
+ tag.setOnmouseover("alert('onmouseover');");
+ tag.setOnmouseup("alert('onmouseup');");
+
+ tag.doStartTag();
+ tag.doEndTag();
+
+ verify(SelectTag.class.getResource("Select-10.txt"));
+ }
+
+
+ /**
* Tests WW-455: Select tag template does not work properly for Object like BigDecimal.
*/
public void testBigDecimal() throws Exception {
@@ -107,6 +149,24 @@
public BigDecimal getBigDecimal() {
return bigDecimal;
+ }
+ }
+
+ public class ByteObject {
+ private String name;
+ private Byte byteValue;
+
+ public ByteObject(Byte byteValue, String name) {
+ this.name = name;
+ this.byteValue = byteValue;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public Byte getByte() {
+ return byteValue;
}
}
Added: struts/struts2/trunk/core/src/test/resources/org/apache/struts2/views/jsp/ui/Select-10.txt
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/test/resources/org/apache/struts2/views/jsp/ui/Select-10.txt?view=auto&rev=494155
==============================================================================
--- struts/struts2/trunk/core/src/test/resources/org/apache/struts2/views/jsp/ui/Select-10.txt (added)
+++ struts/struts2/trunk/core/src/test/resources/org/apache/struts2/views/jsp/ui/Select-10.txt Mon Jan 8 11:05:40 2007
@@ -0,0 +1,7 @@
+<tr>
+ <td class="tdLabel"><label for="collection" class="label">mylabel:</label></td>
+ <td><select name="collection" id="collection" title="mytitle" multiple="multiple" onmousedown="alert('onmousedown');" onmouseup="alert('onmouseup');" onmouseover="alert('onmouseover');" onmousemove="alert('onmousemove');" onmouseout="alert('onmouseout');">
+ <option value="1" selected="selected">hello</option>
+ <option value="2" selected="selected">foo</option>
+</select></td>
+</tr>