1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/toolkit/content/tests/chrome/test_popup_tree.xul Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,73 @@ 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" type="text/css"?> 1.7 + 1.8 +<window title="Tree in Popup Test" 1.9 + onload="setTimeout(runTests, 0);" 1.10 + xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> 1.11 + 1.12 + <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> 1.13 + <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script> 1.14 + 1.15 +<panel id="panel" onpopupshown="treeClick()" onpopuphidden="SimpleTest.finish()"> 1.16 + <tree id="tree" width="350" rows="5"> 1.17 + <treecols> 1.18 + <treecol id="name" label="Name" flex="1"/> 1.19 + <treecol id="address" label="Street" flex="1"/> 1.20 + </treecols> 1.21 + <treechildren id="treechildren"> 1.22 + <treeitem> 1.23 + <treerow> 1.24 + <treecell label="Justin Thyme"/> 1.25 + <treecell label="800 Bay Street"/> 1.26 + </treerow> 1.27 + </treeitem> 1.28 + <treeitem> 1.29 + <treerow> 1.30 + <treecell label="Mary Goround"/> 1.31 + <treecell label="47 University Avenue"/> 1.32 + </treerow> 1.33 + </treeitem> 1.34 + </treechildren> 1.35 + </tree> 1.36 +</panel> 1.37 + 1.38 +<script class="testbody" type="application/javascript"> 1.39 +<![CDATA[ 1.40 + 1.41 +SimpleTest.waitForExplicitFinish(); 1.42 + 1.43 +function runTests() 1.44 +{ 1.45 + $("panel").openPopup(null, "overlap", 2, 2); 1.46 +} 1.47 + 1.48 +function treeClick() 1.49 +{ 1.50 + var tree = $("tree"); 1.51 + is(tree.currentIndex, -1, "selectedIndex before click"); 1.52 + synthesizeMouseExpectEvent($("treechildren"), 2, 2, { }, $("treechildren"), "click", ""); 1.53 + is(tree.currentIndex, 0, "selectedIndex after click"); 1.54 + 1.55 + var x = { }, y = { }, width = { }, height = { }; 1.56 + tree.treeBoxObject.getCoordsForCellItem(1, tree.columns.address, "", x, y, width, height); 1.57 + synthesizeMouseExpectEvent($("treechildren"), x.value, y.value + 2, 1.58 + { }, $("treechildren"), "click", ""); 1.59 + is(tree.currentIndex, 1, "selectedIndex after second click " + x.value + "," + y.value); 1.60 + 1.61 + $("panel").hidePopup(); 1.62 +} 1.63 + 1.64 +]]> 1.65 +</script> 1.66 + 1.67 +<body xmlns="http://www.w3.org/1999/xhtml"> 1.68 +<p id="display"> 1.69 +</p> 1.70 +<div id="content" style="display: none"> 1.71 +</div> 1.72 +<pre id="test"> 1.73 +</pre> 1.74 +</body> 1.75 + 1.76 +</window>