dom/xbl/test/test_bug378518.xul

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     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">
    10   <script type="application/javascript"
    11     src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
    13   <bindings xmlns="http://www.mozilla.org/xbl"
    14     xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
    16       <binding id="mybinding" extends="xul:checkbox">
    17           <content>
    18           </content>
    19       </binding>
    21   </bindings>
    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>
    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;"/>
    34   <box id="myBox" command="myBoxCommand">
    35     <label>myBox</label>
    36   </box>
    38   <checkbox id="myCheckBox" command="myCheckBoxCommand" label="myCheckBox"/>
    40   <box id="myExtendedBox" command="myExtendedBoxCommand"
    41     style="-moz-binding:url(#mybinding)">
    42     <label>myExtendedBox</label>
    43   </box>
    45   <!-- test code goes here -->
    46   <script type="application/javascript"> <![CDATA[
    48     SimpleTest.expectAssertions(1);
    50     var myBoxClicked = false;
    51     var myCheckBoxClicked = false;
    52     var myExtendedBoxClicked = false;
    54     function testClick(elemName) {
    55       var wu  =
    56         window.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
    57               .getInterface(Components.interfaces.nsIDOMWindowUtils);
    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     }
    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     }
    74     /** Test for Bug 378518 **/
    75     SimpleTest.waitForExplicitFinish();
    77     addLoadEvent(function() {
    78       setTimeout(doTest, 0);
    79     });
    81     ]]>
    82     </script>
    83 </window>

mercurial