01: /*
02: * Copyright (c) 2002-2003 by OpenSymphony
03: * All rights reserved.
04: */
05: package com.opensymphony.webwork.views.jsp.ui;
06:
07: import com.opensymphony.webwork.TestAction;
08: import com.opensymphony.webwork.views.jsp.AbstractUITagTest;
09:
10: import java.util.Map;
11:
12: /**
13: * @author Matt Ho <a href="mailto:matt@enginegreen.com"><matt@enginegreen.com></a>
14: * @version $Id: TextareaTest.java 2099 2006-02-03 13:27:22Z rgielen $
15: */
16: public class TextareaTest extends AbstractUITagTest {
17:
18: public void testSimple() throws Exception {
19: TestAction testAction = (TestAction) action;
20: testAction.setFoo("bar");
21:
22: TextareaTag tag = new TextareaTag();
23: tag.setPageContext(pageContext);
24: tag.setLabel("mylabel");
25: tag.setName("myname");
26: tag.setValue("%{foo}");
27: tag.setRows("30");
28: tag.setCols("20");
29: tag.setTitle("mytitle");
30: tag.setDisabled("true");
31: tag.setTabindex("5");
32: tag.setOnchange("alert('goodbye');");
33: tag.setOnclick("alert('onclick');");
34: tag.setId("the_id");
35: tag.setOnkeyup("alert('hello');");
36: tag.setReadonly("true");
37:
38: tag.doStartTag();
39: tag.doEndTag();
40:
41: verify(TextareaTag.class.getResource("Textarea-1.txt"));
42: }
43:
44: /**
45: * Initialize a map of {@link com.opensymphony.webwork.views.jsp.AbstractUITagTest.PropertyHolder} for generic tag
46: * property testing. Will be used when calling {@link #verifyGenericProperties(com.opensymphony.webwork.views.jsp.ui.AbstractUITag,
47: * String, String[])} as properties to verify.<p/> This implementation extends testdata from AbstractUITag.
48: *
49: * @return A Map of PropertyHolders values bound to {@link com.opensymphony.webwork.views.jsp.AbstractUITagTest.PropertyHolder#getName()}
50: * as key.
51: */
52: protected Map initializedGenericTagTestProperties() {
53: Map result = super .initializedGenericTagTestProperties();
54: new PropertyHolder("cols", "10").addToMap(result);
55: new PropertyHolder("rows", "11").addToMap(result);
56: new PropertyHolder("readonly", "true", "readonly=\"readonly\"")
57: .addToMap(result);
58: new PropertyHolder("wrap", "soft").addToMap(result);
59: return result;
60: }
61:
62: public void testGenericSimple() throws Exception {
63: TextareaTag tag = new TextareaTag();
64: verifyGenericProperties(tag, "simple", new String[] { "value" });
65: }
66:
67: public void testGenericXhtml() throws Exception {
68: TextareaTag tag = new TextareaTag();
69: verifyGenericProperties(tag, "xhtml", new String[] { "value" });
70: }
71:
72: public void testGenericAjax() throws Exception {
73: TextareaTag tag = new TextareaTag();
74: verifyGenericProperties(tag, "ajax", new String[] { "value" });
75: }
76:
77: }
|