content.txt 1.37 KB
Table cells may contain HTML lists. Consider the following tests:

!|fitlibrary.specify.DoTree|

|check|tree|!-<ul><li>a</li><li>BB</li></ul>-!|

|check|tree|!-Top<ul><li>a</li><li>BB</li></ul>-!|

|show|tree|

|show|tree|<ul><li>A</li><li>B</li></ul>|

For such lists to be handled correctly, the corresponding types (method arguments and return types) have to be subtypes of the special !-FitLibrary-! type ''Tree''. This, in turn is a MetaTypeAdapter.

The methods of ''!-DoTree-!'' are as follows:
----{{{public class DoTree extends fitlibrary.DoFixture {
    public ListTree tree() {
        ListTree tree = new ListTree("");
        tree.addChild(new ListTree("a"));
        tree.addChild(new ListTree("BB"));
	return tree;
    }
    public ListTree tree(String s) {
        return ListTree.parse(s);
    }
...
}}}----
This works because class ''!-ListTree-!'' is a subtype of ''Tree''. The fixture treats the HTML list as a tree structure. Here's ^AnotherTreeExample.

It's easy to define new subtypes of ''Tree''.  How to do this will be documented later.
!2 Planned Changes
 * Allow lists that drop end tags (at the moment, all tags have to be properly formed)
 * Handle spaces, etc better in text when comparing lists
---- * ''Copyright (c) 2004, 2005, 2006 Rick Mugridge, http://www.rimuresearch.com''
 * ''Released under the terms of the GNU General Public License version 2 or later.''