michael@0: /** michael@0: * This script is used for testing XUL templates. Call test_template within michael@0: * a load event handler. michael@0: * michael@0: * A test should have a root node with the datasources attribute with the michael@0: * id 'root', and a few global variables defined in the test's XUL file: michael@0: * michael@0: * testid: the testid, used when outputting test results michael@0: * expectedOutput: e4x data containing the expected output. It can optionally michael@0: * be enclosed in an element as most tests generate michael@0: * more than one node of output. michael@0: * isTreeBuilder: true for dont-build-content trees, false otherwise michael@0: * queryType: 'rdf', 'xml', etc. michael@0: * needsOpen: true for menu tests where the root menu must be opened before michael@0: * comparing results michael@0: * notWorkingYet: true if this test isn't working yet, outputs todo results michael@0: * notWorkingYetDynamic: true if the dynamic changes portion of the test michael@0: * isn't working yet, outputs todo results michael@0: * changes: an array of functions to perform in sequence to test dynamic changes michael@0: * to the datasource. michael@0: * michael@0: * If the element has an unordered attribute set to true, the michael@0: * children within it must all appear to match, but may appear in any order. michael@0: * If the unordered attribute is not set, the children must appear in the same michael@0: * order. michael@0: * michael@0: * If the 'changes' array is used, it should be an array of functions. Each michael@0: * function will be called in order and a comparison of the output will be michael@0: * performed. This allows changes to be made to the datasource to ensure that michael@0: * the generated template output has been updated. Within the expected output michael@0: * XML, the step attribute may be set to a number on an element to indicate michael@0: * that an element only applies before or after a particular change. If step michael@0: * is set to a positive number, that element will only exist after that step in michael@0: * the list of changes made. If step is set to a negative number, that element michael@0: * will only exist until that step. Steps are numbered starting at 1. For michael@0: * example: michael@0: *