|
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" type="text/css"?> |
|
4 |
|
5 <window title="Tree in Popup Test" |
|
6 onload="setTimeout(runTests, 0);" |
|
7 xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> |
|
8 |
|
9 <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> |
|
10 <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script> |
|
11 |
|
12 <panel id="panel" onpopupshown="treeClick()" onpopuphidden="SimpleTest.finish()"> |
|
13 <tree id="tree" width="350" rows="5"> |
|
14 <treecols> |
|
15 <treecol id="name" label="Name" flex="1"/> |
|
16 <treecol id="address" label="Street" flex="1"/> |
|
17 </treecols> |
|
18 <treechildren id="treechildren"> |
|
19 <treeitem> |
|
20 <treerow> |
|
21 <treecell label="Justin Thyme"/> |
|
22 <treecell label="800 Bay Street"/> |
|
23 </treerow> |
|
24 </treeitem> |
|
25 <treeitem> |
|
26 <treerow> |
|
27 <treecell label="Mary Goround"/> |
|
28 <treecell label="47 University Avenue"/> |
|
29 </treerow> |
|
30 </treeitem> |
|
31 </treechildren> |
|
32 </tree> |
|
33 </panel> |
|
34 |
|
35 <script class="testbody" type="application/javascript"> |
|
36 <![CDATA[ |
|
37 |
|
38 SimpleTest.waitForExplicitFinish(); |
|
39 |
|
40 function runTests() |
|
41 { |
|
42 $("panel").openPopup(null, "overlap", 2, 2); |
|
43 } |
|
44 |
|
45 function treeClick() |
|
46 { |
|
47 var tree = $("tree"); |
|
48 is(tree.currentIndex, -1, "selectedIndex before click"); |
|
49 synthesizeMouseExpectEvent($("treechildren"), 2, 2, { }, $("treechildren"), "click", ""); |
|
50 is(tree.currentIndex, 0, "selectedIndex after click"); |
|
51 |
|
52 var x = { }, y = { }, width = { }, height = { }; |
|
53 tree.treeBoxObject.getCoordsForCellItem(1, tree.columns.address, "", x, y, width, height); |
|
54 synthesizeMouseExpectEvent($("treechildren"), x.value, y.value + 2, |
|
55 { }, $("treechildren"), "click", ""); |
|
56 is(tree.currentIndex, 1, "selectedIndex after second click " + x.value + "," + y.value); |
|
57 |
|
58 $("panel").hidePopup(); |
|
59 } |
|
60 |
|
61 ]]> |
|
62 </script> |
|
63 |
|
64 <body xmlns="http://www.w3.org/1999/xhtml"> |
|
65 <p id="display"> |
|
66 </p> |
|
67 <div id="content" style="display: none"> |
|
68 </div> |
|
69 <pre id="test"> |
|
70 </pre> |
|
71 </body> |
|
72 |
|
73 </window> |