FitNesse. SuiteAcceptanceTests. SuiteWidgetTests.
TestContentsWithRecursion
 Set Up: .FitNesse.SuiteAcceptanceTests.SetUp

!contents with Recursive option


You can add the -R option to the !contents widget to get a recursive, hierarchical view of all the descendents of the current page.

* NOTE: 3/10/2005 - the -R option is checked in to CVS, but has not been released yet

First create the parent page.
Action Fixture.
start Page Builder
enter line I'm the parent
enter line !contents -R
enter page ParentPage

Next create a child
Action Fixture.
start Page Builder
enter line I came first!
enter page ParentPage.FirstChild

Next create a sibling
Action Fixture.
start Page Builder
enter line I'm younger, but wiser
enter page ParentPage.SecondChild

Next create a grandchild
Action Fixture.
start Page Builder
enter line You're too young to be grandparents
enter page ParentPage.FirstChild.GrandChild

Then request the parent page.
Response Requester.
uri valid? contents?
ParentPage true  

...and examine the requested page to be sure that the descendent pages are included
Response Examiner.
type pattern matches?
contents <a href="ParentPage.FirstChild">FirstChild</a> true
contents <a href="ParentPage.FirstChild.GrandChild">GrandChild</a> true
contents <a href="ParentPage.SecondChild">SecondChild</a> true

Also note that the html assigns css classes named toc1, toc2, etc depending on how far down you go. This allows you to define different characteristics for each level in the hierarchy by editing /files/css/fitnesse.css.
Response Examiner.
type pattern matches?
contents <div class="toc1"> true
contents <div class="toc2"> true



.FrontPage .RecentChanges .FitNesse.SuiteAcceptanceTests