2013-08-14 10:34:03 +04:00
|
|
|
<!DOCTYPE HTML>
|
|
|
|
<html>
|
|
|
|
<!--
|
|
|
|
https://bugzilla.mozilla.org/show_bug.cgi?id=903715
|
|
|
|
-->
|
|
|
|
<head>
|
|
|
|
<meta charset="utf-8">
|
|
|
|
<title>Test for Bug 903715</title>
|
2019-04-16 06:50:44 +03:00
|
|
|
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
|
|
|
<script src="/tests/SimpleTest/EventUtils.js"></script>
|
2013-08-14 10:34:03 +04:00
|
|
|
<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=903715">Mozilla Bug 903715</a>
|
|
|
|
<p id="display"></p>
|
|
|
|
<div id="content">
|
|
|
|
<form id="form" action="/">
|
|
|
|
<select id="select" name="select">
|
|
|
|
<option>1</option>
|
|
|
|
<option>2</option>
|
|
|
|
<option>3</option>
|
|
|
|
<option>4</option>
|
|
|
|
<option>5</option>
|
|
|
|
<option>6</option>
|
|
|
|
<option>7</option>
|
|
|
|
<option>8</option>
|
|
|
|
<option>9</option>
|
|
|
|
</select>
|
|
|
|
<input id="input-text" name="text" value="some text">
|
|
|
|
<input id="input-submit" type="submit">
|
|
|
|
</form>
|
|
|
|
</div>
|
|
|
|
<pre id="test">
|
|
|
|
</pre>
|
|
|
|
<script type="application/javascript">
|
|
|
|
SimpleTest.waitForExplicitFinish();
|
2014-12-11 21:34:40 +03:00
|
|
|
SimpleTest.requestFlakyTimeout("untriaged");
|
2013-08-14 10:34:03 +04:00
|
|
|
SimpleTest.waitForFocus(runTests, window);
|
|
|
|
|
|
|
|
function runTests()
|
|
|
|
{
|
|
|
|
var form = document.getElementById("form");
|
|
|
|
form.addEventListener("keypress", function (aEvent) {
|
|
|
|
ok(false, "keypress event shouldn't be fired when the preceding keydown event caused closing the dropdown of the select element");
|
|
|
|
}, true);
|
|
|
|
form.addEventListener("submit", function (aEvent) {
|
|
|
|
ok(false, "submit shouldn't be performed by the Enter key press on the select element");
|
|
|
|
aEvent.preventDefault();
|
|
|
|
}, true);
|
|
|
|
var select = document.getElementById("select");
|
|
|
|
select.addEventListener("change", function (aEvent) {
|
|
|
|
var input = document.getElementById("input-text");
|
|
|
|
input.focus();
|
|
|
|
input.select();
|
2017-01-17 13:50:25 +03:00
|
|
|
});
|
2013-08-14 10:34:03 +04:00
|
|
|
|
|
|
|
select.focus();
|
|
|
|
|
|
|
|
select.addEventListener("popupshowing", function (aEvent) {
|
|
|
|
setTimeout(function () {
|
2018-02-14 22:15:39 +03:00
|
|
|
synthesizeKey("KEY_ArrowDown");
|
2013-08-14 10:34:03 +04:00
|
|
|
select.addEventListener("popuphiding", function (aEvent) {
|
|
|
|
setTimeout(function () {
|
|
|
|
// Enter key should cause closing the dropdown of the select element
|
|
|
|
// and keypress event shouldn't be fired on the input element because
|
|
|
|
// which shouldn't cause sumbmitting the form contents.
|
|
|
|
ok(true, "Test passes if there is no error");
|
|
|
|
SimpleTest.finish();
|
|
|
|
}, 100);
|
2017-01-17 13:50:25 +03:00
|
|
|
});
|
2013-08-14 10:34:03 +04:00
|
|
|
// Close dropdown.
|
2018-02-14 22:15:39 +03:00
|
|
|
synthesizeKey("KEY_Enter");
|
2013-08-14 10:34:03 +04:00
|
|
|
}, 100);
|
2017-01-17 13:50:25 +03:00
|
|
|
});
|
2013-08-14 10:34:03 +04:00
|
|
|
|
|
|
|
// Open dropdown.
|
2018-02-14 22:15:39 +03:00
|
|
|
synthesizeKey("KEY_ArrowDown", { altKey: true });
|
2013-08-14 10:34:03 +04:00
|
|
|
}
|
|
|
|
</script>
|
|
|
|
</body>
|
|
|
|
</html>
|