|
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 https://bugzilla.mozilla.org/show_bug.cgi?id=378518 |
|
6 --> |
|
7 <window title="Mozilla Bug 378518" |
|
8 xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> |
|
9 |
|
10 <script type="application/javascript" |
|
11 src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/> |
|
12 |
|
13 <bindings xmlns="http://www.mozilla.org/xbl" |
|
14 xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> |
|
15 |
|
16 <binding id="mybinding" extends="xul:checkbox"> |
|
17 <content> |
|
18 </content> |
|
19 </binding> |
|
20 |
|
21 </bindings> |
|
22 |
|
23 <!-- test results are displayed in the html:body --> |
|
24 <body xmlns="http://www.w3.org/1999/xhtml"> |
|
25 <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=378518" |
|
26 target="_blank">Mozilla Bug 378518</a> |
|
27 </body> |
|
28 |
|
29 <!-- The elements we're testing with --> |
|
30 <command id="myBoxCommand" oncommand="myBoxClicked = true;"/> |
|
31 <command id="myCheckBoxCommand" oncommand="myCheckBoxClicked = true;"/> |
|
32 <command id="myExtendedBoxCommand" oncommand="myExtendedBoxClicked = true;"/> |
|
33 |
|
34 <box id="myBox" command="myBoxCommand"> |
|
35 <label>myBox</label> |
|
36 </box> |
|
37 |
|
38 <checkbox id="myCheckBox" command="myCheckBoxCommand" label="myCheckBox"/> |
|
39 |
|
40 <box id="myExtendedBox" command="myExtendedBoxCommand" |
|
41 style="-moz-binding:url(#mybinding)"> |
|
42 <label>myExtendedBox</label> |
|
43 </box> |
|
44 |
|
45 <!-- test code goes here --> |
|
46 <script type="application/javascript"> <![CDATA[ |
|
47 |
|
48 SimpleTest.expectAssertions(1); |
|
49 |
|
50 var myBoxClicked = false; |
|
51 var myCheckBoxClicked = false; |
|
52 var myExtendedBoxClicked = false; |
|
53 |
|
54 function testClick(elemName) { |
|
55 var wu = |
|
56 window.QueryInterface(Components.interfaces.nsIInterfaceRequestor) |
|
57 .getInterface(Components.interfaces.nsIDOMWindowUtils); |
|
58 |
|
59 var a = document.getElementById(elemName).getBoundingClientRect(); |
|
60 wu.sendMouseEvent('mousedown', a.left + 1, a.top + 1, 0, 1, 0); |
|
61 wu.sendMouseEvent('mouseup', a.left + 1, a.top + 1, 0, 1, 0); |
|
62 } |
|
63 |
|
64 function doTest() { |
|
65 testClick('myBox'); |
|
66 testClick('myCheckBox'); |
|
67 testClick('myExtendedBox'); |
|
68 ok(!myBoxClicked, "Shouldn't fire"); |
|
69 ok(myCheckBoxClicked, "Should fire"); |
|
70 ok(!myExtendedBoxClicked, "Shouldn't fire"); |
|
71 SimpleTest.finish(); |
|
72 } |
|
73 |
|
74 /** Test for Bug 378518 **/ |
|
75 SimpleTest.waitForExplicitFinish(); |
|
76 |
|
77 addLoadEvent(function() { |
|
78 setTimeout(doTest, 0); |
|
79 }); |
|
80 |
|
81 ]]> |
|
82 </script> |
|
83 </window> |