mirror of
https://github.com/apache/struts.git
synced 2026-08-11 01:27:14 +00:00
WW-4837 Adds a test to test how Strings are treated
This commit is contained in:
@@ -26,6 +26,7 @@ import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import com.sun.xml.internal.bind.v2.util.StackRecorder;
|
||||
import org.apache.struts2.TestAction;
|
||||
import org.apache.struts2.views.jsp.AbstractUITagTest;
|
||||
|
||||
@@ -174,6 +175,46 @@ public class SelectTest extends AbstractUITagTest {
|
||||
verify(SelectTag.class.getResource("Select-14.txt"));
|
||||
}
|
||||
|
||||
public void testNumericString() throws Exception {
|
||||
StringObject hello = new StringObject("hello", "1");
|
||||
StringObject foo = new StringObject("foo", "2");
|
||||
|
||||
TestAction testAction = (TestAction) action;
|
||||
|
||||
Collection collection = new ArrayList(2);
|
||||
// expect strings to be returned, we're still dealing with HTTP here!
|
||||
collection.add("hello");
|
||||
collection.add("foo");
|
||||
testAction.setCollection(collection);
|
||||
|
||||
List list2 = new ArrayList();
|
||||
list2.add(hello);
|
||||
list2.add(foo);
|
||||
list2.add(new StringObject("<cat>", "1.5"));
|
||||
list2.add(new StringObject("<dog>", "2,5"));
|
||||
testAction.setList2(list2);
|
||||
|
||||
SelectTag tag = new SelectTag();
|
||||
tag.setPageContext(pageContext);
|
||||
tag.setLabel("mylabel");
|
||||
tag.setName("collection");
|
||||
tag.setList("list2");
|
||||
tag.setListKey("name");
|
||||
tag.setListValue("number");
|
||||
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-15.txt"));
|
||||
}
|
||||
|
||||
public class BigDecimalObject {
|
||||
private String name;
|
||||
private BigDecimal bigDecimal;
|
||||
@@ -210,6 +251,24 @@ public class SelectTest extends AbstractUITagTest {
|
||||
}
|
||||
}
|
||||
|
||||
public class StringObject {
|
||||
private String name;
|
||||
private String number;
|
||||
|
||||
public StringObject(String name, String number) {
|
||||
this.name = name;
|
||||
this.number = number;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public String getNumber() {
|
||||
return number;
|
||||
}
|
||||
}
|
||||
|
||||
public class ByteObject {
|
||||
private String name;
|
||||
private Byte byteValue;
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
<tr>
|
||||
<td class="tdLabel"><label for="collection" class="label">mylabel:</label></td>
|
||||
<td class="tdInput"><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="hello" selected="selected">1</option>
|
||||
<option value="foo" selected="selected">2</option>
|
||||
<option value="<cat>">1.5</option>
|
||||
<option value="<dog>">2,5</option>
|
||||
</select>
|
||||
<inputtype="hidden" id="__multiselect_collection" name="__multiselect_collection" value=""/>
|
||||
</td>
|
||||
</tr>
|
||||
Reference in New Issue
Block a user