dom/xbl/test/test_bug378518.xul

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/xbl/test/test_bug378518.xul	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,83 @@
     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 +https://bugzilla.mozilla.org/show_bug.cgi?id=378518
     1.9 +-->
    1.10 +<window title="Mozilla Bug 378518"
    1.11 +  xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
    1.12 +    
    1.13 +  <script type="application/javascript"
    1.14 +    src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
    1.15 +
    1.16 +  <bindings xmlns="http://www.mozilla.org/xbl"
    1.17 +    xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
    1.18 +
    1.19 +      <binding id="mybinding" extends="xul:checkbox">
    1.20 +          <content>
    1.21 +          </content>
    1.22 +      </binding>
    1.23 +
    1.24 +  </bindings>
    1.25 +
    1.26 +  <!-- test results are displayed in the html:body -->
    1.27 +  <body xmlns="http://www.w3.org/1999/xhtml">
    1.28 +      <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=378518"
    1.29 +         target="_blank">Mozilla Bug 378518</a>
    1.30 +  </body>
    1.31 +
    1.32 +   <!-- The elements we're testing with -->
    1.33 +  <command id="myBoxCommand" oncommand="myBoxClicked = true;"/>
    1.34 +  <command id="myCheckBoxCommand" oncommand="myCheckBoxClicked = true;"/>
    1.35 +  <command id="myExtendedBoxCommand" oncommand="myExtendedBoxClicked = true;"/>
    1.36 +
    1.37 +  <box id="myBox" command="myBoxCommand">
    1.38 +    <label>myBox</label>
    1.39 +  </box>
    1.40 +
    1.41 +  <checkbox id="myCheckBox" command="myCheckBoxCommand" label="myCheckBox"/>
    1.42 +
    1.43 +  <box id="myExtendedBox" command="myExtendedBoxCommand"
    1.44 +    style="-moz-binding:url(#mybinding)">
    1.45 +    <label>myExtendedBox</label>
    1.46 +  </box>
    1.47 +
    1.48 +  <!-- test code goes here -->
    1.49 +  <script type="application/javascript"> <![CDATA[
    1.50 +
    1.51 +    SimpleTest.expectAssertions(1);
    1.52 +
    1.53 +    var myBoxClicked = false;
    1.54 +    var myCheckBoxClicked = false;
    1.55 +    var myExtendedBoxClicked = false;
    1.56 +
    1.57 +    function testClick(elemName) {
    1.58 +      var wu  =
    1.59 +        window.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
    1.60 +              .getInterface(Components.interfaces.nsIDOMWindowUtils);
    1.61 +
    1.62 +      var a = document.getElementById(elemName).getBoundingClientRect();
    1.63 +      wu.sendMouseEvent('mousedown',  a.left + 1, a.top + 1, 0, 1, 0);
    1.64 +      wu.sendMouseEvent('mouseup',  a.left + 1, a.top + 1, 0, 1, 0);
    1.65 +    }
    1.66 +
    1.67 +    function doTest() {
    1.68 +      testClick('myBox');
    1.69 +      testClick('myCheckBox');
    1.70 +      testClick('myExtendedBox');
    1.71 +      ok(!myBoxClicked, "Shouldn't fire");
    1.72 +      ok(myCheckBoxClicked, "Should fire");
    1.73 +      ok(!myExtendedBoxClicked, "Shouldn't fire");
    1.74 +      SimpleTest.finish();
    1.75 +    }
    1.76 +
    1.77 +    /** Test for Bug 378518 **/
    1.78 +    SimpleTest.waitForExplicitFinish();
    1.79 +
    1.80 +    addLoadEvent(function() {
    1.81 +      setTimeout(doTest, 0);
    1.82 +    });
    1.83 +
    1.84 +    ]]>
    1.85 +    </script>
    1.86 +</window>

mercurial