author Julian Descottes <>
Tue, 23 Oct 2018 07:13:35 +0000
changeset 490876 dfaaf3978e3c7f1c98fd20270a0e50e4a6ddd733
parent 379138 a072d7934ff7c6fd2ad974d7abc0b08d11041aca
permissions -rw-r--r--
Bug 1499096 - Use ok() with 2 arguments instead of 3 when possible;r=Standard8 Depends on D8740. This changeset replaces calls to ok with 3 arguments to calls with 2 arguments in situations where the switch does not have a significant impact on the assert. Differential Revision:

  <meta charset="utf-8">
  <title>Test for Bug 635465</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"/>
  <style type="text/css">
      #item {
        position: relative;
      .s-menu-section-submenu {
        position: absolute;
        display: none;
      .open .s-menu-section-submenu {
        display: block;
<a target="_blank" href="">Mozilla Bug 635465</a>
<div id="display">
  <div class="item" id="item"
       onmouseover="showSubmenu(event)" onmouseout="hideSubmenu(event)">
    <a href="#" id="firsthover">Hover me</a>
    <div class="s-menu-section-submenu" id="menu">
      <a href="#" id="secondhover">Now hover me</a>
<div id="content" style="display: none">

<pre id="test">
<script type="application/javascript">

/** Test for Bug 635465 **/
function showSubmenu(event) {
  var item = document.getElementById('item');

  var width = item.offsetWidth;   // IT WORKS IF YOU REMOVE THIS LINE


function hideSubmenu(event) {


function executeTests() {
  // First flush out layout of firsthover
  ok($("firsthover").getBoundingClientRect().height > 0,
     "Should have a nonzero height before hover");

  // Now trigger a mouseover on firsthover
  synthesizeMouseAtCenter($("firsthover"), { type: "mousemove" });

  ok($("secondhover").getBoundingClientRect().height > 0,
     "Should have a nonzero height for submenu after hover");

  // Now determine where secondhover is hanging out
  var rect = $("secondhover").getBoundingClientRect();
  synthesizeMouseAtCenter($("secondhover"), { type: "mousemove" });

  // And another mouseover one pixel to the right of where the center used to be
  synthesizeMouseAtPoint(rect.left + rect.width/2 + 1,
                + rect.height/2,
                         { type: "mousemove" });

  ok($("secondhover").getBoundingClientRect().height > 0,
     "Should have a nonzero height for submenu after second hover");

  // And check computed display of the menu
  is(getComputedStyle($("menu"), "").display, "block", "Should have block display");