dom/events/test/test_bug656379-2.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/events/test/test_bug656379-2.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,83 @@
     1.4 +<!DOCTYPE HTML>
     1.5 +<html>
     1.6 +<!--
     1.7 +https://bugzilla.mozilla.org/show_bug.cgi?id=656379
     1.8 +-->
     1.9 +<head>
    1.10 +  <title>Test for Bug 656379</title>
    1.11 +  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
    1.12 +  <script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
    1.13 +  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
    1.14 +  <style>
    1.15 +    input[type="button"]:hover { color: green; }
    1.16 +  </style>
    1.17 +</head>
    1.18 +<body>
    1.19 +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=656379">Mozilla Bug 656379</a>
    1.20 +<p id="display">
    1.21 +  <label for="button1" id="label1">Label 1</label>
    1.22 +  <input type="button" id="button1" value="Button 1">
    1.23 +  <label>
    1.24 +    <span id="label2">Label 2</span>
    1.25 +    <input type="button" id="button2" value="Button 2">
    1.26 +  </label>
    1.27 +</p>
    1.28 +<div id="content" style="display: none">
    1.29 +  
    1.30 +</div>
    1.31 +<pre id="test">
    1.32 +<script type="application/javascript;version=1.8">
    1.33 +
    1.34 +/** Test for Bug 656379 **/
    1.35 +SimpleTest.waitForExplicitFinish();
    1.36 +function tests() {
    1.37 +  synthesizeMouseAtCenter($("label1"), { type: "mousemove" });
    1.38 +  yield undefined;
    1.39 +  is($("button1").mozMatchesSelector(":hover"), true,
    1.40 +     "Button 1 should be hovered after mousemove over label1");
    1.41 +  is($("label1").mozMatchesSelector(":hover"), true,
    1.42 +     "Label 1 should be hovered after mousemove over label1");
    1.43 +  is($("button2").mozMatchesSelector(":hover"), false,
    1.44 +     "Button 2 should not be hovered after mousemove over label1");
    1.45 +  is($("label2").mozMatchesSelector(":hover"), false,
    1.46 +     "Label 2 should not be hovered after mousemove over label1");
    1.47 +  synthesizeMouseAtCenter($("button2"), { type: "mousemove" });
    1.48 +  yield undefined;
    1.49 +  is($("button1").mozMatchesSelector(":hover"), false,
    1.50 +     "Button 1 should not be hovered after mousemove over button2");
    1.51 +  is($("label1").mozMatchesSelector(":hover"), false,
    1.52 +     "Label 1 should not be hovered after mousemove over button2");
    1.53 +  is($("button2").mozMatchesSelector(":hover"), true,
    1.54 +     "Button 2 should be hovered after mousemove over button2");
    1.55 +  is($("label2").mozMatchesSelector(":hover"), false,
    1.56 +     "Label 2 should not be hovered after mousemove over label2");
    1.57 +  synthesizeMouseAtCenter($("label2"), { type: "mousemove" });
    1.58 +  yield undefined;
    1.59 +  is($("button1").mozMatchesSelector(":hover"), false,
    1.60 +     "Button 1 should not be hovered after mousemove over label2");
    1.61 +  is($("label1").mozMatchesSelector(":hover"), false,
    1.62 +     "Label 1 should not be hovered after mousemove over label2");
    1.63 +  is($("button2").mozMatchesSelector(":hover"), true,
    1.64 +     "Button 2 should be hovered after mousemove over label2");
    1.65 +  is($("label2").mozMatchesSelector(":hover"), true,
    1.66 +     "Label 2 should be hovered after mousemove over label2");
    1.67 +  SimpleTest.finish();
    1.68 +}
    1.69 +
    1.70 +function executeTests() {
    1.71 +  var testYielder = tests();
    1.72 +  function execNext() {
    1.73 +    try {
    1.74 +      testYielder.next();
    1.75 +      SimpleTest.executeSoon(execNext);
    1.76 +    } catch(e) {}
    1.77 +  }
    1.78 +  execNext();
    1.79 +}
    1.80 +
    1.81 +SimpleTest.waitForFocus(executeTests);
    1.82 +
    1.83 +</script>
    1.84 +</pre>
    1.85 +</body>
    1.86 +</html>

mercurial