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