layout/forms/test/test_bug549170.html

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 <!DOCTYPE HTML>
     2 <html>
     3 <!--
     4 https://bugzilla.mozilla.org/show_bug.cgi?id=549170
     5 -->
     6 <head>
     7   <title>Test for Bug 549170</title>
     8   <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
     9   <script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
    10   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
    11 </head>
    12 <body onload="window.setTimeout(runTests, 0);">
    13 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=549170">Mozilla Bug 549170</a>
    14 <p id="display"></p>
    15 <div id="content" style="display: none">
    16 </div>
    17 <input id='i'
    18   onmouseup="mouseHandler(event);"
    19   onmousedown="mouseHandler(event);">
    20 <textarea id='t'
    21   onmouseup="mouseHandler(event);"
    22   onmousedown="mouseHandler(event);"></textarea><br>
    23 <input id='ip' placeholder='foo'
    24   onmouseup="mouseHandler(event);"
    25   onmousedown="mouseHandler(event);">
    26 <textarea id='tp' placeholder='foo'
    27   onmouseup="mouseHandler(event);"
    28   onmousedown="mouseHandler(event);"></textarea>
    29 <pre id="test">
    31 <script type="application/javascript">
    33 /** Test for Bug 549170 **/
    35 var gNumberOfMouseEventsCatched = 0;
    37 SimpleTest.waitForExplicitFinish();
    39 function mouseHandler(aEvent)
    40 {
    41   gNumberOfMouseEventsCatched++;
    42   is(SpecialPowers.wrap(aEvent).originalTarget.nodeName, "DIV", "An inner div should be the target of the event");
    43   ok(SpecialPowers.wrap(aEvent).originalTarget.classList.contains("anonymous-div"), "the target div should be the editor div");
    44 }
    46 function checkMouseEvents(element)
    47 {
    48   gNumberOfMouseEventsCatched = 0;
    50   synthesizeMouse(element, 5, 5, {type: "mousedown", button: 0});
    51   synthesizeMouse(element, 5, 5, {type: "mouseup",   button: 0});
    52   synthesizeMouse(element, 5, 5, {type: "mousedown", button: 1});
    53   // NOTE: this event is going to copy the buffer on linux, this should not be a problem
    54   synthesizeMouse(element, 5, 5, {type: "mouseup",   button: 1});
    55   synthesizeMouse(element, 5, 5, {type: "mousedown", button: 2});
    56   synthesizeMouse(element, 5, 5, {type: "mouseup",   button: 2});
    58   is(gNumberOfMouseEventsCatched, 6, "Some mouse events have not been catched");
    59 }
    61 function runTests()
    62 {
    63   checkMouseEvents(document.getElementById('i'));
    64   checkMouseEvents(document.getElementById('t'));
    65   checkMouseEvents(document.getElementById('ip'));
    66   checkMouseEvents(document.getElementById('tp'));
    68   SimpleTest.finish();
    69 }
    71 </script>
    72 </pre>
    73 </body>
    74 </html>

mercurial