Files
tubestation/toolkit/content/tests/mochitest/test_bug1407085.html
Masayuki Nakano efaea0aaa7 Bug 1438157 - part 2: Remove unnecessary second argument of EventUtils.synthesizeKey() r=smaug
Note that this patch also replaces legacy VK_* with KEY_*, and replaces
synthesizeKey() for inputting some characters with sendString() because
it's better and clearer what it does and it sets shiftKey state properly.

MozReview-Commit-ID: De4enbjux3T
2018-02-15 04:15:39 +09:00

39 lines
1009 B
HTML

<!DOCTYPE HTML>
<html>
<head>
<title>Test for Bug 1407085</title>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<p id="display"></p>
<div id="content">
<input id="input" value="original value">
</div>
<pre id="test">
<script class="testbody" type="text/javascript">
SimpleTest.waitForExplicitFinish();
SimpleTest.waitForFocus(runTests);
function runTests() {
let input = document.getElementById("input");
input.focus();
input.addEventListener("keydown", () => {
input.value = "new value";
}, { once: true });
synthesizeKey("KEY_Escape");
is(input.value, "new value",
"New <input> value changed by an Escape key event listener shouldn't be " +
"overwritten by original value even if Escape key is pressed");
SimpleTest.finish();
}
</script>
</pre>
</body>
</html>