01: // Copyright (C) 2003,2004,2005 by Object Mentor, Inc. All rights reserved.
02: // Released under the terms of the GNU General Public License version 2 or later.
03: package fitnesse.responders.search;
04:
05: import fitnesse.testutil.AbstractRegex;
06: import fitnesse.http.*;
07: import fitnesse.FitNesseContext;
08:
09: public class SearchFormResponderTest extends AbstractRegex {
10: private SimpleResponse response;
11:
12: private String content;
13:
14: public void setUp() throws Exception {
15: SearchFormResponder responder = new SearchFormResponder();
16: response = (SimpleResponse) responder.makeResponse(
17: new FitNesseContext(), new MockRequest());
18: content = response.getContent();
19: }
20:
21: public void tearDown() throws Exception {
22: }
23:
24: public void testFocusOnSearchBox() throws Exception {
25: assertSubString(
26: "onload=\"document.forms[0].searchString.focus()\"",
27: content);
28: }
29:
30: public void testHtml() throws Exception {
31: assertHasRegexp("form", content);
32: assertHasRegexp("input", content);
33: assertSubString("<input", content);
34: assertSubString("type=\"hidden\"", content);
35: assertSubString("name=\"responder\"", content);
36: assertSubString("value=\"search\"", content);
37: }
38:
39: public void testForTwoSearchTypes() throws Exception {
40: assertSubString("type=\"submit\"", content);
41: assertSubString("value=\"Search Titles!\"", content);
42: assertSubString("value=\"Search Content!\"", content);
43: }
44: }
|