1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package org.apache.struts2.views.jsp.ui;
19
20 import java.util.HashMap;
21 import java.util.Map;
22
23 import org.apache.struts2.TestAction;
24 import org.apache.struts2.views.jsp.AbstractUITagTest;
25
26
27 /***
28 */
29 public class HiddenTest extends AbstractUITagTest {
30
31 public void testSimple() throws Exception {
32 TestAction testAction = (TestAction) action;
33 testAction.setFoo("bar");
34
35 HiddenTag tag = new HiddenTag();
36 tag.setPageContext(pageContext);
37 tag.setLabel("mylabel");
38 tag.setName("myname");
39 tag.setValue("%{foo}");
40
41 tag.doStartTag();
42 tag.doEndTag();
43
44 verify(TextFieldTag.class.getResource("Hidden-1.txt"));
45 }
46
47 /***
48 * Initialize a map of {@link org.apache.struts2.views.jsp.AbstractUITagTest.PropertyHolder} for generic tag
49 * property testing. Will be used when calling {@link #verifyGenericProperties(org.apache.struts2.views.jsp.ui.AbstractUITag,
50 * String, String[])} as properties to verify.<p/> This implementation extends testdata from AbstractUITag.
51 *
52 * @return A Map of PropertyHolders values bound to {@link org.apache.struts2.views.jsp.AbstractUITagTest.PropertyHolder#getName()}
53 * as key.
54 */
55 protected Map initializedGenericTagTestProperties() {
56 Map result = new HashMap();
57 new PropertyHolder("name", "someName").addToMap(result);
58 new PropertyHolder("value", "someValue").addToMap(result);
59 new PropertyHolder("cssClass", "cssClass1", "class=\"cssClass1\"").addToMap(result);
60 new PropertyHolder("cssStyle", "cssStyle1", "style=\"cssStyle1\"").addToMap(result);
61 new PropertyHolder("id", "someId").addToMap(result);
62 return result;
63 }
64
65 public void testGenericSimple() throws Exception {
66 HiddenTag tag = new HiddenTag();
67 verifyGenericProperties(tag, "simple", null);
68 }
69
70 public void testGenericXhtml() throws Exception {
71 HiddenTag tag = new HiddenTag();
72 verifyGenericProperties(tag, "xhtml", null);
73 }
74
75 public void testGenericAjax() throws Exception {
76 HiddenTag tag = new HiddenTag();
77 verifyGenericProperties(tag, "ajax", null);
78 }
79
80 }