test_tree.xhtml (3359B)
1 <?xml version="1.0"?> 2 <?xml-stylesheet href="chrome://global/skin" type="text/css"?> 3 <?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" 4 type="text/css"?> 5 6 <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" 7 title="Accessible XUL tree relations tests"> 8 9 <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" /> 10 11 <script type="application/javascript" 12 src="../treeview.js" /> 13 14 <script type="application/javascript" 15 src="../common.js" /> 16 <script type="application/javascript" 17 src="../events.js" /> 18 <script type="application/javascript" 19 src="../relations.js" /> 20 21 <script type="application/javascript"> 22 <![CDATA[ 23 //////////////////////////////////////////////////////////////////////////// 24 // Test 25 26 function doTest() 27 { 28 var treeNode = getNode("tree"); 29 30 var tree = getAccessible(treeNode); 31 var treeitem1 = tree.firstChild.nextSibling; 32 testRelation(treeitem1, RELATION_NODE_CHILD_OF, [tree]); 33 34 var treeitem2 = treeitem1.nextSibling; 35 testRelation(treeitem2, RELATION_NODE_CHILD_OF, [tree]); 36 37 var treeitem3 = treeitem2.nextSibling; 38 testRelation(treeitem3, RELATION_NODE_CHILD_OF, [treeitem2]); 39 40 var treeitem4 = treeitem3.nextSibling; 41 testRelation(treeitem4, RELATION_NODE_CHILD_OF, [treeitem2]); 42 43 var treeitem5 = treeitem4.nextSibling; 44 testRelation(treeitem5, RELATION_NODE_CHILD_OF, [tree]); 45 46 var treeitem6 = treeitem5.nextSibling; 47 testRelation(treeitem6, RELATION_NODE_CHILD_OF, [tree]); 48 49 testRelation(tree, RELATION_NODE_PARENT_OF, 50 [treeitem1, treeitem2, treeitem5, treeitem6]); 51 testRelation(treeitem2, RELATION_NODE_PARENT_OF, 52 [treeitem3, treeitem4]); 53 54 // treeitems and treecells shouldn't pick up relations from tree 55 testRelation(treeitem1, RELATION_LABELLED_BY, null); 56 testRelation(treeitem1.firstChild, RELATION_LABELLED_BY, null); 57 58 SimpleTest.finish(); 59 } 60 61 SimpleTest.waitForExplicitFinish(); 62 addA11yXULTreeLoadEvent(doTest, "tree", new nsTreeTreeView()); 63 ]]> 64 </script> 65 66 <hbox flex="1" style="overflow: auto;"> 67 <body xmlns="http://www.w3.org/1999/xhtml"> 68 <a target="_blank" 69 href="https://bugzilla.mozilla.org/show_bug.cgi?id=503727" 70 title="Reorganize implementation of XUL tree accessibility"> 71 Bug 503727 72 </a> 73 <a target="_blank" 74 href="https://bugzilla.mozilla.org/show_bug.cgi?id=527461" 75 title="Implement RELATION_NODE_PARENT_OF"> 76 Bug 527461 77 </a> 78 <a target="_blank" 79 href="https://bugzilla.mozilla.org/show_bug.cgi?id=691248" 80 title="XUL tree items shouldn't pick up relations from XUL tree"> 81 Bug 691248 82 </a> 83 <p id="display"></p> 84 <div id="content" style="display: none"> 85 </div> 86 <pre id="test"> 87 </pre> 88 </body> 89 90 <vbox flex="1"> 91 <label control="tree" value="It's a tree"/> 92 <tree id="tree" flex="1"> 93 <treecols> 94 <treecol id="col" flex="1" primary="true" label="column"/> 95 <treecol id="col2" flex="1" label="column2"/> 96 </treecols> 97 <treechildren/> 98 </tree> 99 100 <vbox id="debug"/> 101 </vbox> 102 </hbox> 103 104 </window>