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.html;
04:
05: import fitnesse.testutil.AbstractRegex;
06:
07: public class HtmlPageTest extends AbstractRegex {
08: private HtmlPage page;
09: private String html;
10:
11: public void setUp() throws Exception {
12: page = new HtmlPage();
13: html = page.html();
14: }
15:
16: public void tearDown() throws Exception {
17: }
18:
19: public void testStandardTags() throws Exception {
20: assertTrue("bad doctype", html.startsWith(HtmlPage.DTD));
21: assertSubString("<html>", html);
22: assertHasRegexp("</html>", html);
23: }
24:
25: public void testHead() throws Exception {
26: assertSubString("<head>", html);
27: assertSubString("</head>", html);
28: assertSubString("<title>FitNesse</title>", html);
29: assertSubString("<link", html);
30: assertSubString("rel=\"stylesheet\"", html);
31: assertSubString("type=\"text/css\"", html);
32: assertSubString("href=\"/files/css/fitnesse.css\"", html);
33: assertSubString("src=\"/files/javascript/fitnesse.js\"", html);
34: }
35:
36: public void testIncludesBody() throws Exception {
37: assertSubString("<body>", html);
38: assertSubString("</body>", html);
39: }
40:
41: public void testIncludesHeading() throws Exception {
42: assertSubString("<div class=\"header\"", html);
43: }
44:
45: public void testMainBar() throws Exception {
46: assertSubString("<div class=\"mainbar\"", html);
47: String mainHtml = page.mainbar.html();
48: assertSubString("<div class=\"header", mainHtml);
49: assertSubString("<div class=\"main\"", mainHtml);
50: }
51:
52: public void testSidebar() throws Exception {
53: assertSubString("<div class=\"mainbar", html);
54: assertSubString("<div class=\"actions", html);
55: assertSubString("<div class=\"actions", html);
56: }
57:
58: public void testMain() throws Exception {
59: assertSubString("<div class=\"main", html);
60: }
61:
62: public void testDivide() throws Exception {
63: page.main.use(HtmlPage.BreakPoint);
64: page.divide();
65: assertNotSubString("</html>", page.preDivision);
66: assertSubString("</html>", page.postDivision);
67: assertNotSubString(HtmlPage.BreakPoint, page.preDivision);
68: assertNotSubString(HtmlPage.BreakPoint, page.postDivision);
69: }
70: }
|