public void testUparrowOnPageThatDoesNotExist() throws Exception { WikiPage page = crawler.addPage(root, PathParser.parse("FrontPage")); AliasLinkWidget w = new AliasLinkWidget(new WidgetRoot(page), "[[tag][^TestPage]]"); assertEquals( "tag<a title=\"create page\" href=\"FrontPage.TestPage?edit&nonExistent=true\">[?]</a>", w.render()); }
public void testQuestionMarkDoesNotAppear() throws Exception { WikiPage page = crawler.addPage(root, PathParser.parse("FrontPage")); AliasLinkWidget w = new AliasLinkWidget( new WidgetRoot(page), "[[here][http://www.objectmentor.com/FitNesse/fitnesse.zip]]"); assertDoesntHaveRegexp("[?]", w.render()); }
public void testHtmlAtTopLevelPageWithAnchor() throws Exception { crawler.addPage(root, PathParser.parse("TestPage")); ParentWidget wroot = new WidgetRoot(new PagePointer(root, PathParser.parse("TestPage"))); AliasLinkWidget w = new AliasLinkWidget(wroot, "[[tag][TestPage#anchor]]"); String html = w.render(); assertEquals("<a href=\"TestPage#anchor\">tag</a>", html); }
public void testUparrowOnPageThatDoesExist() throws Exception { WikiPage page = crawler.addPage(root, PathParser.parse("TestPage")); crawler.addPage(page, PathParser.parse("SubPage")); ParentWidget wroot = new WidgetRoot(page); AliasLinkWidget w = new AliasLinkWidget(wroot, "[[tag][^SubPage]]"); String html = w.render(); assertEquals("<a href=\"TestPage.SubPage\">tag</a>", html); }
public void testUsageOnRootPageDoesntCrash() throws Exception { AliasLinkWidget w = new AliasLinkWidget(new WidgetRoot(root), "[[here][PageOne]]"); try { w.render(); } catch (Exception e) { fail("should not throw Exception: " + e); } }
public void testHtmlForPageThatDoesNotExist() throws Exception { crawler.addPage(root, PathParser.parse("FrontPage")); ParentWidget parentWidget = new WidgetRoot(new PagePointer(root, PathParser.parse("FrontPage"))); AliasLinkWidget w = new AliasLinkWidget(parentWidget, "[[tag][TestPage]]"); assertEquals( "tag<a title=\"create page\" href=\"TestPage?edit&nonExistent=true\">[?]</a>", w.render()); }
public void testLinkToNonExistentWikiPageOnVirtualPage() throws Exception { // When a virtual page contains a link to a non-existent page, the ? should // issue an edit request to the remote machine ProxyPage virtualPage = new ProxyPage("VirtualPage", root, "host", 9999, PathParser.parse("RealPage.VirtualPage")); AliasLinkWidget widget = new AliasLinkWidget(new WidgetRoot(virtualPage), "[[link][NonExistentPage]]"); assertEquals( "link<a title=\"create page\" href=\"http://host:9999/RealPage.NonExistentPage?edit&nonExistent=true\" target=\"NonExistentPage\">[?]</a>", widget.render()); }
public void testHtmlOnSubPage() throws Exception { crawler.addPage(root, PathParser.parse("ParenT"), "Content"); WikiPage parent = root.getChildPage("ParenT"); crawler.addPage(parent, PathParser.parse("ChilD"), "ChilD"); crawler.addPage(parent, PathParser.parse("ChildTwo"), "ChildTwo"); WikiPage child = parent.getChildPage("ChilD"); ParentWidget parentWidget = new WidgetRoot(new PagePointer(root, PathParser.parse("ParenT.ChilD"))); AliasLinkWidget w = new AliasLinkWidget(parentWidget, "[[tag][ChildTwo]]"); assertEquals("<a href=\"ParenT.ChildTwo\">tag</a>", w.render()); AliasLinkWidget w2 = new AliasLinkWidget(new WidgetRoot(child), "[[tag][.ParenT]]"); assertEquals("<a href=\"ParenT\">tag</a>", w2.render()); }
public void testAsWikiText() throws Exception { String ALIAS_LINK = "[[this][that]]"; AliasLinkWidget w = new AliasLinkWidget(new WidgetRoot(root), ALIAS_LINK); assertEquals(ALIAS_LINK, w.asWikiText()); }
public void testStandardLinkWithAnchor() throws Exception { AliasLinkWidget w = new AliasLinkWidget(new WidgetRoot(root), "[[x][http://a.com#zap]]"); assertEquals("<a href=\"http://a.com#zap\">x</a>", w.render()); }
public void testVariableIsRenderedInAliasTag() throws Exception { ParentWidget wroot = new WidgetRoot(root); wroot.addVariable("X", "Y"); AliasLinkWidget w = new AliasLinkWidget(wroot, "[[${X}][x]]"); assertEquals("<a href=\"x\">Y</a>", w.render()); }