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