WW-3173 adds additional test case to prove usage of inline map

git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1343639 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Lukasz Lenart
2012-05-29 10:02:31 +00:00
parent 351aae79b9
commit 8bd9cc6f48
3 changed files with 15 additions and 8 deletions
@@ -21,12 +21,11 @@
package org.apache.struts2.components;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.opensymphony.xwork2.util.ValueStack;
import org.apache.struts2.views.annotations.StrutsTag;
import com.opensymphony.xwork2.util.ValueStack;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* <!-- START SNIPPET: javadoc -->
@@ -47,6 +46,10 @@ import com.opensymphony.xwork2.util.ValueStack;
* &lt;s:action name="GenderMap" var="genders"/&gt;
* &lt;s:radio label="Gender" name="male" list="#genders.genders"/&gt;
* <!-- END SNIPPET: example -->
*
* <!-- START SNIPPET: example_fmt -->
* &lt;@s.radio name="car" list={"ford": "Ford Motor Co", "toyota": "Toyota"} listKey="key" listValue="value" /&gt;
* <!-- END SNIPPET: example -->
* </pre>
*
*/
@@ -256,9 +256,11 @@ public class FreeMarkerResultTest extends StrutsTestCase {
Dispatcher dispatcher = Dispatcher.getInstance();
ActionMapping mapping = dispatcher.getContainer().getInstance(ActionMapper.class).getMapping(request, dispatcher.getConfigurationManager());
dispatcher.serviceAction(request, response, servletContext, mapping);
String expected =
"<input type=\"radio\" name=\"client\" id=\"client_foo\" value=\"foo\"/><label for=\"client_foo\">foo</label>\n" +
"<input type=\"radio\" name=\"client\" id=\"client_bar\" value=\"bar\"/><label for=\"client_bar\">bar</label>\n";
String expected = "<input type=\"radio\" name=\"client\" id=\"client_foo\" value=\"foo\"/><label for=\"client_foo\">foo</label>\n"
+ "<input type=\"radio\" name=\"client\" id=\"client_bar\" value=\"bar\"/><label for=\"client_bar\">bar</label>\n"
+ "\n"
+ "<input type=\"radio\" name=\"car\" id=\"carford\" value=\"ford\"/><label for=\"carford\">Ford Motor Co</label>\n"
+ "<input type=\"radio\" name=\"car\" id=\"cartoyota\" value=\"toyota\"/><label for=\"cartoyota\">Toyota</label>\n";
assertEquals(expected, stringWriter.toString());
}
@@ -20,4 +20,6 @@
* under the License.
*/
-->
<@s.radio name="client" id="client_" list='{"foo", "bar"}' />
<@s.radio name="client" id="client_" list='{"foo", "bar"}' />
<@s.radio name="car" list={"ford": "Ford Motor Co", "toyota": "Toyota"} listKey="key" listValue="value" />