layout/forms/test/test_bug644542.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/layout/forms/test/test_bug644542.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,62 @@
     1.4 +<!DOCTYPE HTML>
     1.5 +<html>
     1.6 +<!--
     1.7 +https://bugzilla.mozilla.org/show_bug.cgi?id=644542
     1.8 +-->
     1.9 +<head>
    1.10 +  <title>Test for Bug 644542</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 type="text/css">
    1.15 +    select:after {
    1.16 +	    content: ' appended string';
    1.17 +    }
    1.18 +  </style>
    1.19 +</head>
    1.20 +<body>
    1.21 +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=644542">Mozilla Bug 644542</a>
    1.22 +<p id="display">
    1.23 +  <form method="post" action="">
    1.24 +    <select id="select">
    1.25 +      <option value="1">1</option>
    1.26 +      <option value="2">2</option>
    1.27 +    </select>
    1.28 +  </form>
    1.29 +</p>
    1.30 +<div id="content" style="display: none">
    1.31 +  
    1.32 +</div>
    1.33 +<pre id="test">
    1.34 +<script type="application/javascript">
    1.35 +
    1.36 +/** Test for Bug 644542 **/
    1.37 +
    1.38 +var select = document.getElementById("select");
    1.39 +
    1.40 +var clicks = 0;
    1.41 +
    1.42 +function click() {
    1.43 +    synthesizeMouseAtCenter(select, { });
    1.44 +    ++clicks;
    1.45 +
    1.46 +    // At least two clicks were required for bug 644542, sometimes more;
    1.47 +    // delay is long enough that this doesn't look like a double
    1.48 +    // click, and also allows time for popup to show and for painting.
    1.49 +    setTimeout(clicks < 4 ? click : done, 500);
    1.50 +}
    1.51 +
    1.52 +function done() {
    1.53 +    ok(true, "No crash on opening dropdown");
    1.54 +    SimpleTest.finish();
    1.55 +}
    1.56 +
    1.57 +SimpleTest.waitForExplicitFinish();
    1.58 +// waitForFocus is most likely not the right thing to wait for, but
    1.59 +// without this the first click is ineffective (even with a reflow forced
    1.60 +// before synthesizeMouse).
    1.61 +SimpleTest.waitForFocus(click);
    1.62 +</script>
    1.63 +</pre>
    1.64 +</body>
    1.65 +</html>

mercurial