gecko/dom/html/test/test_bug274626.html

98 lines
3.5 KiB
HTML
Raw Normal View History

<!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>