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.ArrayList;
11: import java.util.Collection;
12:
13: /**
14: * DOCUMENT ME!
15: *
16: * @author $author$
17: * @version $Revision: 2093 $
18: */
19: public class ComboBoxTest extends AbstractUITagTest {
20:
21: public void testGenericSimple() throws Exception {
22: ComboBoxTag tag = new ComboBoxTag();
23: prepareTagGeneric(tag);
24: verifyGenericProperties(tag, "simple", null);
25: }
26:
27: public void testGenericXhtml() throws Exception {
28: ComboBoxTag tag = new ComboBoxTag();
29: prepareTagGeneric(tag);
30: verifyGenericProperties(tag, "xhtml", null);
31: }
32:
33: public void testGenericAjax() throws Exception {
34: ComboBoxTag tag = new ComboBoxTag();
35: prepareTagGeneric(tag);
36: verifyGenericProperties(tag, "ajax", null);
37: }
38:
39: private void prepareTagGeneric(ComboBoxTag tag) {
40: TestAction testAction = (TestAction) action;
41: ArrayList collection = new ArrayList();
42: collection.add("foo");
43: collection.add("bar");
44: collection.add("baz");
45:
46: testAction.setCollection(collection);
47:
48: tag.setList("collection");
49: }
50:
51: public void testSimple() throws Exception {
52: TestAction testAction = (TestAction) action;
53: testAction.setFoo("hello");
54:
55: ArrayList collection = new ArrayList();
56: collection.add("foo");
57: collection.add("bar");
58: collection.add("baz");
59: testAction.setCollection(collection);
60:
61: ComboBoxTag tag = new ComboBoxTag();
62: tag.setPageContext(pageContext);
63: tag.setLabel("mylabel");
64: tag.setName("foo");
65: tag.setList("collection");
66:
67: tag.doStartTag();
68: tag.doEndTag();
69:
70: verify(ComboBoxTag.class.getResource("ComboBox-1.txt"));
71: }
72: }
|