1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/accessible/tests/mochitest/focus/test_takeFocus.xul Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,106 @@ 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 focus testing"> 1.11 + 1.12 + <script type="application/javascript" 1.13 + src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" /> 1.14 + <script type="application/javascript" 1.15 + src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/> 1.16 + 1.17 + <script type="application/javascript" 1.18 + src="../common.js" /> 1.19 + <script type="application/javascript" 1.20 + src="../role.js" /> 1.21 + <script type="application/javascript" 1.22 + src="../states.js" /> 1.23 + <script type="application/javascript" 1.24 + src="../events.js" /> 1.25 + 1.26 + <script type="application/javascript" 1.27 + src="../treeview.js" /> 1.28 + 1.29 + <script type="application/javascript"> 1.30 + <![CDATA[ 1.31 + //////////////////////////////////////////////////////////////////////////// 1.32 + // Invokers 1.33 + 1.34 + function takeFocusInvoker(aID, aArgConverterFunc) 1.35 + { 1.36 + this.targetFunc = aArgConverterFunc ? aArgConverterFunc : getAccessible; 1.37 + 1.38 + this.eventSeq = [ new focusChecker(this.targetFunc, aID) ]; 1.39 + 1.40 + this.invoke = function takeFocusInvoker_invoke() 1.41 + { 1.42 + this.targetFunc.call(null, aID).takeFocus(); 1.43 + } 1.44 + 1.45 + this.getID = function takeFocusInvoker_getID() 1.46 + { 1.47 + return "takeFocus for " + prettyName(aID); 1.48 + } 1.49 + } 1.50 + 1.51 + function getLastChild(aID) 1.52 + { 1.53 + return getAccessible(aID).lastChild; 1.54 + } 1.55 + 1.56 + //////////////////////////////////////////////////////////////////////////// 1.57 + // Tests 1.58 + 1.59 + //gA11yEventDumpID = "eventdump"; // debug stuff 1.60 + //gA11yEventDumpToConsole = true; // debug stuff 1.61 + 1.62 + var gQueue = null; 1.63 + function doTests() 1.64 + { 1.65 + // Test focus events. 1.66 + gQueue = new eventQueue(); 1.67 + 1.68 + gQueue.push(new takeFocusInvoker("tree", getLastChild)); 1.69 + gQueue.push(new takeFocusInvoker("listitem2")); 1.70 + 1.71 + gQueue.invoke(); // Will call SimpleTest.finish(); 1.72 + } 1.73 + 1.74 + SimpleTest.waitForExplicitFinish(); 1.75 + addA11yXULTreeLoadEvent(doTests, "tree", new nsTableTreeView(5)); 1.76 + ]]> 1.77 + </script> 1.78 + 1.79 + <hbox flex="1" style="overflow: auto;"> 1.80 + <body xmlns="http://www.w3.org/1999/xhtml"> 1.81 + <a target="_blank" 1.82 + href="https://bugzilla.mozilla.org/show_bug.cgi?id=706067" 1.83 + title="Make takeFocus work on widget items"> 1.84 + Mozilla Bug 706067 1.85 + </a> 1.86 + <p id="display"></p> 1.87 + <div id="content" style="display: none"></div> 1.88 + <pre id="test"> 1.89 + </pre> 1.90 + </body> 1.91 + 1.92 + <vbox flex="1"> 1.93 + <tree id="tree" flex="1"> 1.94 + <treecols> 1.95 + <treecol id="col1" flex="1" primary="true" label="column"/> 1.96 + <treecol id="col2" flex="1" label="column 2"/> 1.97 + </treecols> 1.98 + <treechildren id="treechildren"/> 1.99 + </tree> 1.100 + 1.101 + <listbox id="listbox"> 1.102 + <listitem id="listitem1">item1</listitem> 1.103 + <listitem id="listitem2">item2</listitem> 1.104 + </listbox> 1.105 + 1.106 + <vbox id="eventdump"/> 1.107 + </vbox> 1.108 + </hbox> 1.109 +</window>