1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/accessible/tests/mochitest/actions/test_tree.xul Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,128 @@ 1.4 +<?xml version="1.0"?> 1.5 +<?xml-stylesheet href="chrome://global/skin" type="text/css"?> 1.6 +<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" 1.7 + type="text/css"?> 1.8 + 1.9 +<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" 1.10 + title="Accessible XUL tree actions tests"> 1.11 + 1.12 + <script type="application/javascript" 1.13 + src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" /> 1.14 + 1.15 + <script type="application/javascript" 1.16 + src="../treeview.js" /> 1.17 + 1.18 + <script type="application/javascript" 1.19 + src="../common.js" /> 1.20 + <script type="application/javascript" 1.21 + src="../role.js" /> 1.22 + <script type="application/javascript" 1.23 + src="../states.js" /> 1.24 + <script type="application/javascript" 1.25 + src="../events.js" /> 1.26 + <script type="application/javascript" 1.27 + src="../actions.js" /> 1.28 + 1.29 + <script type="application/javascript"> 1.30 + <![CDATA[ 1.31 + //////////////////////////////////////////////////////////////////////////// 1.32 + // Accessible tree testers 1.33 + 1.34 + function stateFocusChecker(aAcc, aStates) 1.35 + { 1.36 + this.__proto__ = new focusChecker(aAcc); 1.37 + 1.38 + this.check = function focusChecker_check(aEvent) 1.39 + { 1.40 + var states = aStates ? aStates : 0; 1.41 + testStates(this.target, STATE_FOCUSED | STATE_SELECTED | states); 1.42 + } 1.43 + } 1.44 + 1.45 + //////////////////////////////////////////////////////////////////////////// 1.46 + // Test 1.47 + 1.48 + // gA11yEventDumpID = "debug"; 1.49 + //gA11yEventDumpToConsole = true; // debug 1.50 + 1.51 + function doTest() 1.52 + { 1.53 + var treeNode = getNode("tree"); 1.54 + 1.55 + var treeBodyNode = treeNode.boxObject.treeBody; 1.56 + 1.57 + var tree = getAccessible(treeNode); 1.58 + var expandedTreeItem = tree.getChildAt(2); 1.59 + var collapsedTreeItem = tree.getChildAt(5); 1.60 + 1.61 + var actions = [ 1.62 + { 1.63 + ID: expandedTreeItem, 1.64 + actionName: "activate", 1.65 + actionIndex: 0, 1.66 + events: CLICK_EVENTS, 1.67 + targetID: treeBodyNode, 1.68 + eventSeq: [ 1.69 + new stateFocusChecker(expandedTreeItem, STATE_EXPANDED) 1.70 + ] 1.71 + }, 1.72 + { 1.73 + ID: collapsedTreeItem, 1.74 + actionName: "expand", 1.75 + actionIndex: 1, 1.76 + events: CLICK_EVENTS, 1.77 + targetID: treeBodyNode, 1.78 + checkOnClickEvent: function check(aEvent) 1.79 + { 1.80 + testStates(this.ID, STATE_EXPANDED); 1.81 + } 1.82 + }, 1.83 + { 1.84 + ID: collapsedTreeItem, 1.85 + actionName: "collapse", 1.86 + actionIndex: 1, 1.87 + events: CLICK_EVENTS, 1.88 + targetID: treeBodyNode, 1.89 + checkOnClickEvent: function check(aEvent) 1.90 + { 1.91 + testStates(this.ID, STATE_COLLAPSED); 1.92 + } 1.93 + } 1.94 + ]; 1.95 + 1.96 + testActions(actions); // Will call SimpleTest.finish(); 1.97 + } 1.98 + 1.99 + SimpleTest.waitForExplicitFinish(); 1.100 + addA11yXULTreeLoadEvent(doTest, "tree", new nsTreeTreeView()); 1.101 + ]]> 1.102 + </script> 1.103 + 1.104 + <hbox flex="1" style="overflow: auto;"> 1.105 + <body xmlns="http://www.w3.org/1999/xhtml"> 1.106 + <a target="_blank" 1.107 + href="https://bugzilla.mozilla.org/show_bug.cgi?id=503727" 1.108 + title="Reorganize implementation of XUL tree accessibility"> 1.109 + Mozilla Bug 503727 1.110 + </a><br/> 1.111 + <p id="display"></p> 1.112 + <div id="content" style="display: none"> 1.113 + </div> 1.114 + <pre id="test"> 1.115 + </pre> 1.116 + </body> 1.117 + 1.118 + <vbox flex="1"> 1.119 + <tree id="tree" flex="1" minheight="100px"> 1.120 + <treecols> 1.121 + <treecol id="col" flex="1" primary="true" label="column"/> 1.122 + </treecols> 1.123 + <treechildren/> 1.124 + </tree> 1.125 + 1.126 + <vbox id="debug"/> 1.127 + </vbox> 1.128 + </hbox> 1.129 + 1.130 +</window> 1.131 +