summaryrefslogtreecommitdiff
path: root/dom/html/test/test_bug274626.html
blob: f4f045b2192adfecc43fad85a8c027ce78a1823a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=274626
-->
<head>
  <title>Test for Bug 274626</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=274626">Mozilla Bug 274626</a>
<br>

<input id='textbox_enabled' title='hello' value='hello' />
<input id='textbox_disabled' title='hello' value='hello' disabled/>

<br>
<input id='input_button_enabled' title='hello' value='hello' type='button' />
<input id='input_button_disabled' title='hello' value='hello' type='button' disabled />

<br>
<input id='checkbox_enabled' title='hello' type='checkbox'>hello</input>
<input id='checkbox_disabled' title='hello' type='checkbox' disabled >hello</input>

<br>
<button id='button_enabled' title='hello' value='hello' type='button'>test</button>
<button id='button_disabled' title='hello' value='hello' type='button' disabled>test</button>

<br>
<textarea id='textarea_enabled' title='hello' value='hello' onclick="alert('click event');"> </textarea>
<textarea id='textarea_disabled' title='hello' value='hello' onclick="alert('click event');" disabled></textarea>


<br>
<select id='select_enabled' title='hello' onclick="alert('click event');">
  <option value='item1'>item1</option>
  <option value='item2'>item2</option>
</select>
<select id='select_disabled' title='hello' onclick="alert('click event');" disabled>
  <option value='item1'>item1</option>
  <option value='item2'>item2</option>
</select>

<br>
<form>
  <fieldset id='fieldset_enabled' title='hello' onclick="alert('click event');">
    <legend>Enabled fieldset:</legend>
    Name: <input type='text' size='30' /><br />
    Email: <input type='text' size='30' /><br />
    Date of birth: <input type='text' size='10' />
  </fieldset>
</form>
<form>
  <fieldset id='fieldset_disabled' title='hello' onclick="alert('click event');" disabled>
    <legend>Disabled fieldset:</legend>
    Name: <input type='text' size='30' /><br />
    Email: <input type='text' size='30' /><br />
    Date of birth: <input type='text' size='10' />
  </fieldset>
</form>

<script class="testbody" type="application/javascript">

/** Test for Bug 274626 **/

  function HandlesMouseMove(evt) { 
	evt.target.handlesMouseMove = true;
  }

  var controls=["textbox_enabled","textbox_disabled",
    "input_button_enabled", "input_button_disabled", "checkbox_enabled", 
    "checkbox_disabled", "button_enabled", "button_disabled",
    "textarea_enabled", "textarea_disabled", "select_enabled", 
    "select_disabled", "fieldset_enabled", "fieldset_disabled"];

  for (id of controls) {
    var ctrl = document.getElementById(id);
    ctrl.addEventListener('mousemove', HandlesMouseMove, false);
    ctrl.handlesMouseMove = false;
    var evt = document.createEvent("MouseEvents");
    evt.initMouseEvent("mousemove", true, true, window,
      0, 0, 0, 0, 0, false, false, false, false, 0, null);
    ctrl.dispatchEvent(evt);

    // Mouse move events are what causes tooltips to show up. 
    // Before this fix we would not allow mouse move events to go through
    // which in turn did not allow tooltips to be displayed.
    // This test will ensure that all HTML elements handle mouse move events
    // so that tooltips can be displayed
    ok(ctrl.handlesMouseMove, "Disabled element need mouse move for tooltips");
  }

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