test_bug274626.html 3.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. <!DOCTYPE HTML>
  2. <html>
  3. <!--
  4. https://bugzilla.mozilla.org/show_bug.cgi?id=274626
  5. -->
  6. <head>
  7. <title>Test for Bug 274626</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. </head>
  12. <body>
  13. <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=274626">Mozilla Bug 274626</a>
  14. <br>
  15. <input id='textbox_enabled' title='hello' value='hello' />
  16. <input id='textbox_disabled' title='hello' value='hello' disabled/>
  17. <br>
  18. <input id='input_button_enabled' title='hello' value='hello' type='button' />
  19. <input id='input_button_disabled' title='hello' value='hello' type='button' disabled />
  20. <br>
  21. <input id='checkbox_enabled' title='hello' type='checkbox'>hello</input>
  22. <input id='checkbox_disabled' title='hello' type='checkbox' disabled >hello</input>
  23. <br>
  24. <button id='button_enabled' title='hello' value='hello' type='button'>test</button>
  25. <button id='button_disabled' title='hello' value='hello' type='button' disabled>test</button>
  26. <br>
  27. <textarea id='textarea_enabled' title='hello' value='hello' onclick="alert('click event');"> </textarea>
  28. <textarea id='textarea_disabled' title='hello' value='hello' onclick="alert('click event');" disabled></textarea>
  29. <br>
  30. <select id='select_enabled' title='hello' onclick="alert('click event');">
  31. <option value='item1'>item1</option>
  32. <option value='item2'>item2</option>
  33. </select>
  34. <select id='select_disabled' title='hello' onclick="alert('click event');" disabled>
  35. <option value='item1'>item1</option>
  36. <option value='item2'>item2</option>
  37. </select>
  38. <br>
  39. <form>
  40. <fieldset id='fieldset_enabled' title='hello' onclick="alert('click event');">
  41. <legend>Enabled fieldset:</legend>
  42. Name: <input type='text' size='30' /><br />
  43. Email: <input type='text' size='30' /><br />
  44. Date of birth: <input type='text' size='10' />
  45. </fieldset>
  46. </form>
  47. <form>
  48. <fieldset id='fieldset_disabled' title='hello' onclick="alert('click event');" disabled>
  49. <legend>Disabled fieldset:</legend>
  50. Name: <input type='text' size='30' /><br />
  51. Email: <input type='text' size='30' /><br />
  52. Date of birth: <input type='text' size='10' />
  53. </fieldset>
  54. </form>
  55. <script class="testbody" type="application/javascript">
  56. /** Test for Bug 274626 **/
  57. function HandlesMouseMove(evt) {
  58. evt.target.handlesMouseMove = true;
  59. }
  60. var controls=["textbox_enabled","textbox_disabled",
  61. "input_button_enabled", "input_button_disabled", "checkbox_enabled",
  62. "checkbox_disabled", "button_enabled", "button_disabled",
  63. "textarea_enabled", "textarea_disabled", "select_enabled",
  64. "select_disabled", "fieldset_enabled", "fieldset_disabled"];
  65. for (id of controls) {
  66. var ctrl = document.getElementById(id);
  67. ctrl.addEventListener('mousemove', HandlesMouseMove, false);
  68. ctrl.handlesMouseMove = false;
  69. var evt = document.createEvent("MouseEvents");
  70. evt.initMouseEvent("mousemove", true, true, window,
  71. 0, 0, 0, 0, 0, false, false, false, false, 0, null);
  72. ctrl.dispatchEvent(evt);
  73. // Mouse move events are what causes tooltips to show up.
  74. // Before this fix we would not allow mouse move events to go through
  75. // which in turn did not allow tooltips to be displayed.
  76. // This test will ensure that all HTML elements handle mouse move events
  77. // so that tooltips can be displayed
  78. ok(ctrl.handlesMouseMove, "Disabled element need mouse move for tooltips");
  79. }
  80. </script>
  81. </body>
  82. </html>