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 org.apache.struts2.TestAction;
21 import org.apache.struts2.views.jsp.AbstractUITagTest;
22
23 /***
24 * Test Submit component in "ajax" theme.
25 */
26 public class SubmitAjaxTest extends AbstractUITagTest {
27
28 public void testGenericSimple() throws Exception {
29 AbstractRemoteCallUITag tag = new DivTag();
30 verifyGenericProperties(tag, "simple", new String[]{"value","tabindex","disabled"});
31 }
32
33 public void testGenericXhtml() throws Exception {
34 AbstractRemoteCallUITag tag = new DivTag();
35 verifyGenericProperties(tag, "xhtml", new String[]{"value","tabindex","disabled"});
36 }
37
38 public void testGenericAjax() throws Exception {
39 AbstractRemoteCallUITag tag = new DivTag();
40 verifyGenericProperties(tag, "ajax", new String[]{"value","tabindex","disabled"});
41 }
42
43 public void testSubmit() throws Exception {
44 TestAction testAction = (TestAction) action;
45 testAction.setFoo("bar");
46
47 SubmitTag tag = new SubmitTag();
48 tag.setPageContext(pageContext);
49
50 tag.setId("a");
51 tag.setTheme("ajax");
52 tag.setHref("b");
53 tag.setLoadingText("c");
54 tag.setErrorText("d");
55 tag.setListenTopics("e");
56 tag.setPreInvokeJS("f");
57 tag.setOnLoadJS("g");
58 tag.setHandler("h");
59 tag.setType("submit");
60 tag.setLabel("i");
61 tag.setNotifyTopics("k");
62 tag.setIndicator("l");
63 tag.doStartTag();
64 tag.doEndTag();
65
66 verify(DivTest.class.getResource("submit-ajax-1.txt"));
67 }
68
69 public void testButton() throws Exception {
70 TestAction testAction = (TestAction) action;
71 testAction.setFoo("bar");
72
73 SubmitTag tag = new SubmitTag();
74 tag.setPageContext(pageContext);
75
76 tag.setId("a");
77 tag.setTheme("ajax");
78 tag.setHref("b");
79 tag.setLoadingText("c");
80 tag.setErrorText("d");
81 tag.setListenTopics("e");
82 tag.setPreInvokeJS("f");
83 tag.setOnLoadJS("g");
84 tag.setHandler("h");
85 tag.setType("button");
86 tag.setLabel("i");
87 tag.setNotifyTopics("k");
88 tag.setIndicator("l");
89 tag.doStartTag();
90 tag.doEndTag();
91
92 verify(DivTest.class.getResource("submit-ajax-2.txt"));
93 }
94
95 public void testImage() throws Exception {
96 TestAction testAction = (TestAction) action;
97 testAction.setFoo("bar");
98
99 SubmitTag tag = new SubmitTag();
100 tag.setPageContext(pageContext);
101
102 tag.setId("a");
103 tag.setTheme("ajax");
104 tag.setHref("b");
105 tag.setLoadingText("c");
106 tag.setErrorText("d");
107 tag.setListenTopics("e");
108 tag.setPreInvokeJS("f");
109 tag.setOnLoadJS("g");
110 tag.setHandler("h");
111 tag.setType("image");
112 tag.setLabel("i");
113 tag.setSrc("j");
114 tag.setNotifyTopics("k");
115 tag.setIndicator("l");
116 tag.doStartTag();
117 tag.doEndTag();
118
119 verify(DivTest.class.getResource("submit-ajax-3.txt"));
120 }
121 }