001: /*
002: * $Id: SubmitAjaxTest.java 508280 2007-02-16 02:07:56Z musachy $
003: *
004: * Copyright 2006 The Apache Software Foundation.
005: *
006: * Licensed under the Apache License, Version 2.0 (the "License");
007: * you may not use this file except in compliance with the License.
008: * You may obtain a copy of the License at
009: *
010: * http://www.apache.org/licenses/LICENSE-2.0
011: *
012: * Unless required by applicable law or agreed to in writing, software
013: * distributed under the License is distributed on an "AS IS" BASIS,
014: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
015: * See the License for the specific language governing permissions and
016: * limitations under the License.
017: */
018: package org.apache.struts2.views.jsp.ui;
019:
020: import org.apache.struts2.TestAction;
021: import org.apache.struts2.views.jsp.AbstractUITagTest;
022:
023: /**
024: * Test Submit component in "ajax" theme.
025: */
026: public class SubmitAjaxTest extends AbstractUITagTest {
027:
028: public void testGenericSimple() throws Exception {
029: AbstractRemoteCallUITag tag = new DivTag();
030: verifyGenericProperties(tag, "simple", new String[] { "value",
031: "tabindex", "disabled" });
032: }
033:
034: public void testGenericXhtml() throws Exception {
035: AbstractRemoteCallUITag tag = new DivTag();
036: verifyGenericProperties(tag, "xhtml", new String[] { "value",
037: "tabindex", "disabled" });
038: }
039:
040: public void testGenericAjax() throws Exception {
041: AbstractRemoteCallUITag tag = new DivTag();
042: verifyGenericProperties(tag, "ajax", new String[] { "value",
043: "tabindex", "disabled" });
044: }
045:
046: public void testSubmit() throws Exception {
047: TestAction testAction = (TestAction) action;
048: testAction.setFoo("bar");
049:
050: SubmitTag tag = new SubmitTag();
051: tag.setPageContext(pageContext);
052:
053: tag.setId("a");
054: tag.setTheme("ajax");
055: tag.setHref("b");
056: tag.setLoadingText("c");
057: tag.setErrorText("d");
058: tag.setListenTopics("e");
059: tag.setPreInvokeJS("f");
060: tag.setOnLoadJS("g");
061: tag.setHandler("h");
062: tag.setType("submit");
063: tag.setLabel("i");
064: tag.setNotifyTopics("k");
065: tag.setIndicator("l");
066: tag.setShowLoadingText("true");
067: tag.doStartTag();
068: tag.doEndTag();
069:
070: verify(SubmitAjaxTest.class.getResource("submit-ajax-1.txt"));
071: }
072:
073: public void testButton() throws Exception {
074: TestAction testAction = (TestAction) action;
075: testAction.setFoo("bar");
076:
077: SubmitTag tag = new SubmitTag();
078: tag.setPageContext(pageContext);
079:
080: tag.setId("a");
081: tag.setTheme("ajax");
082: tag.setHref("b");
083: tag.setLoadingText("c");
084: tag.setErrorText("d");
085: tag.setListenTopics("e");
086: tag.setPreInvokeJS("f");
087: tag.setOnLoadJS("g");
088: tag.setHandler("h");
089: tag.setType("button");
090: tag.setLabel("i");
091: tag.setNotifyTopics("k");
092: tag.setIndicator("l");
093: tag.doStartTag();
094: tag.doEndTag();
095:
096: verify(SubmitAjaxTest.class.getResource("submit-ajax-2.txt"));
097: }
098:
099: public void testImage() throws Exception {
100: TestAction testAction = (TestAction) action;
101: testAction.setFoo("bar");
102:
103: SubmitTag tag = new SubmitTag();
104: tag.setPageContext(pageContext);
105:
106: tag.setId("a");
107: tag.setTheme("ajax");
108: tag.setHref("b");
109: tag.setLoadingText("c");
110: tag.setErrorText("d");
111: tag.setListenTopics("e");
112: tag.setPreInvokeJS("f");
113: tag.setOnLoadJS("g");
114: tag.setHandler("h");
115: tag.setType("image");
116: tag.setLabel("i");
117: tag.setSrc("j");
118: tag.setNotifyTopics("k");
119: tag.setIndicator("l");
120: tag.doStartTag();
121: tag.doEndTag();
122:
123: verify(SubmitAjaxTest.class.getResource("submit-ajax-3.txt"));
124: }
125: }
|