dom/events/test/test_bug656379-2.html

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 <!DOCTYPE HTML>
     2 <html>
     3 <!--
     4 https://bugzilla.mozilla.org/show_bug.cgi?id=656379
     5 -->
     6 <head>
     7   <title>Test for Bug 656379</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   <style>
    12     input[type="button"]:hover { color: green; }
    13   </style>
    14 </head>
    15 <body>
    16 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=656379">Mozilla Bug 656379</a>
    17 <p id="display">
    18   <label for="button1" id="label1">Label 1</label>
    19   <input type="button" id="button1" value="Button 1">
    20   <label>
    21     <span id="label2">Label 2</span>
    22     <input type="button" id="button2" value="Button 2">
    23   </label>
    24 </p>
    25 <div id="content" style="display: none">
    27 </div>
    28 <pre id="test">
    29 <script type="application/javascript;version=1.8">
    31 /** Test for Bug 656379 **/
    32 SimpleTest.waitForExplicitFinish();
    33 function tests() {
    34   synthesizeMouseAtCenter($("label1"), { type: "mousemove" });
    35   yield undefined;
    36   is($("button1").mozMatchesSelector(":hover"), true,
    37      "Button 1 should be hovered after mousemove over label1");
    38   is($("label1").mozMatchesSelector(":hover"), true,
    39      "Label 1 should be hovered after mousemove over label1");
    40   is($("button2").mozMatchesSelector(":hover"), false,
    41      "Button 2 should not be hovered after mousemove over label1");
    42   is($("label2").mozMatchesSelector(":hover"), false,
    43      "Label 2 should not be hovered after mousemove over label1");
    44   synthesizeMouseAtCenter($("button2"), { type: "mousemove" });
    45   yield undefined;
    46   is($("button1").mozMatchesSelector(":hover"), false,
    47      "Button 1 should not be hovered after mousemove over button2");
    48   is($("label1").mozMatchesSelector(":hover"), false,
    49      "Label 1 should not be hovered after mousemove over button2");
    50   is($("button2").mozMatchesSelector(":hover"), true,
    51      "Button 2 should be hovered after mousemove over button2");
    52   is($("label2").mozMatchesSelector(":hover"), false,
    53      "Label 2 should not be hovered after mousemove over label2");
    54   synthesizeMouseAtCenter($("label2"), { type: "mousemove" });
    55   yield undefined;
    56   is($("button1").mozMatchesSelector(":hover"), false,
    57      "Button 1 should not be hovered after mousemove over label2");
    58   is($("label1").mozMatchesSelector(":hover"), false,
    59      "Label 1 should not be hovered after mousemove over label2");
    60   is($("button2").mozMatchesSelector(":hover"), true,
    61      "Button 2 should be hovered after mousemove over label2");
    62   is($("label2").mozMatchesSelector(":hover"), true,
    63      "Label 2 should be hovered after mousemove over label2");
    64   SimpleTest.finish();
    65 }
    67 function executeTests() {
    68   var testYielder = tests();
    69   function execNext() {
    70     try {
    71       testYielder.next();
    72       SimpleTest.executeSoon(execNext);
    73     } catch(e) {}
    74   }
    75   execNext();
    76 }
    78 SimpleTest.waitForFocus(executeTests);
    80 </script>
    81 </pre>
    82 </body>
    83 </html>

mercurial