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