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