layout/mathml/tests/test_bug706406.html
author moz-wptsync-bot <wptsync@mozilla.com>
Wed, 20 Feb 2019 11:15:05 +0000
changeset 522542 db896ec3c023252eb95bac8b48cb422098224195
parent 82709 a8192280c3b3330b0890b172feb05cdfd5d99970
child 528457 c9c0c6f2eed54a187e124942e53c3660b4cf17d8
permissions -rw-r--r--
Bug 1529092 [wpt PR 15464] - Update wpt metadata, a=testonly wpt-pr: 15464 wpt-type: metadata

<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=706406
-->
<head>
  <title>Test for Bug 706406</title>
  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
  <script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=706406">Mozilla Bug 706406</a>
<p id="display"></p>
<math xmlns="http://www.w3.org/1998/Math/MathML">
  <maction actiontype="toggle" id="maction">
    <mn>1</mn>
    <mn>2</mn>
  </maction>
</math>
<pre id="test">
<script type="application/javascript">

/** Test for Bug 706406 **/

function doTest()
{
  function doStopPropagation(aEvent) {
    aEvent.stopPropagation();
  }

  var maction = document.getElementById("maction");

  synthesizeMouseAtCenter(maction, {});

  is(maction.getAttribute("selection"), "2",
     "maction's selection attribute isn't 2 by first click");

  synthesizeMouseAtCenter(maction, {});

  is(maction.getAttribute("selection"), "1",
     "maction's selection attribute isn't 1 by second click");

  window.addEventListener("mousedown", doStopPropagation, true);
  window.addEventListener("mouseup", doStopPropagation, true);
  window.addEventListener("click", doStopPropagation, true);

  synthesizeMouseAtCenter(maction, {});

  is(maction.getAttribute("selection"), "2",
     "maction's selection attribute isn't 2 by first click called stopPropagation()");

  synthesizeMouseAtCenter(maction, {});

  is(maction.getAttribute("selection"), "1",
     "maction's selection attribute isn't 1 by second click called stopPropagation()");

  window.removeEventListener("mousedown", doStopPropagation, true);
  window.removeEventListener("mouseup", doStopPropagation, true);
  window.removeEventListener("click", doStopPropagation, true);

  SimpleTest.finish();
}

SimpleTest.waitForExplicitFinish();
SimpleTest.waitForFocus(doTest);

</script>
</pre>
</body>
</html>