View Javadoc

1   /*
2    * $Id: SubmitAjaxTest.java 651946 2008-04-27 13:41:38Z apetrelli $
3    *
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   *
12   *  http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing,
15   * software distributed under the License is distributed on an
16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17   * KIND, either express or implied.  See the License for the
18   * specific language governing permissions and limitations
19   * under the License.
20   */
21  
22  package org.apache.struts2.dojo.views.jsp.ui;
23  
24  import org.apache.struts2.dojo.TestAction;
25  
26  /***
27   * Test Submit component in "ajax" theme.
28   */
29  public class SubmitAjaxTest extends AbstractUITagTest {
30      public void testSubmit() throws Exception {
31          TestAction testAction = (TestAction) action;
32          testAction.setFoo("bar");
33  
34          SubmitTag tag = new SubmitTag();
35          tag.setPageContext(pageContext);
36  
37          tag.setId("a");
38          tag.setHref("b");
39          tag.setLoadingText("c");
40          tag.setErrorText("d");
41          tag.setListenTopics("e");
42          tag.setBeforeNotifyTopics("f");
43          tag.setAfterNotifyTopics("g");
44          tag.setHandler("h");
45          tag.setType("submit");
46          tag.setLabel("i");
47          tag.setNotifyTopics("k");
48          tag.setIndicator("l");
49          tag.setShowLoadingText("true");
50          tag.setErrorNotifyTopics("m");
51          tag.setHighlightColor("n");
52          tag.setHighlightDuration("o");
53          tag.setValidate("true");
54          tag.setAjaxAfterValidation("true");
55          tag.setSeparateScripts("true");
56          tag.setTabindex("1");
57          tag.setTransport("p");
58          tag.setParseContent("false");
59          tag.doStartTag();
60          tag.doEndTag();
61  
62          verify(SubmitAjaxTest.class.getResource("submit-ajax-1.txt"));
63      }
64  
65      public void testButton() throws Exception {
66          TestAction testAction = (TestAction) action;
67          testAction.setFoo("bar");
68  
69          SubmitTag tag = new SubmitTag();
70          tag.setPageContext(pageContext);
71  
72          tag.setId("a");
73          tag.setTheme("ajax");
74          tag.setHref("b");
75          tag.setLoadingText("c");
76          tag.setErrorText("d");
77          tag.setListenTopics("e");
78          tag.setBeforeNotifyTopics("f");
79          tag.setAfterNotifyTopics("g");
80          tag.setHandler("h");
81          tag.setType("button");
82          tag.setLabel("i");
83          tag.setNotifyTopics("k");
84          tag.setIndicator("l");
85          tag.setErrorNotifyTopics("m");
86          tag.setValidate("true");
87          tag.setSeparateScripts("true");
88          tag.setTabindex("1");
89          tag.doStartTag();
90          tag.doEndTag();
91  
92          verify(SubmitAjaxTest.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.setBeforeNotifyTopics("f");
109         tag.setAfterNotifyTopics("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.setErrorNotifyTopics("m");
117         tag.setValidate("true");
118         tag.setSeparateScripts("true");
119         tag.doStartTag();
120         tag.doEndTag();
121 
122         verify(SubmitAjaxTest.class.getResource("submit-ajax-3.txt"));
123     }
124 }