blob: 4dbb8f79e07666342a1ae6a379b27786f455453c (
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
|
<html>
<head>
<script src="../js/resources/js-test-pre.js"></script>
<script>
function test() {
var tf = document.getElementById('tf');
var didFireOnChange = false;
tf.onchange = function() {
didFireOnChange = true;
}
if (window.layoutTestController) {
layoutTestController.dumpAsText();
}
tf.focus();
if (window.layoutTestController) {
layoutTestController.setValueForUser(tf, 'Hello!');
}
// Should not fire the event until focus is lost.
if (didFireOnChange) {
testFailed('onchange fired too early');
return;
}
tf.blur();
if (didFireOnChange) {
testPassed('');
} else {
testFailed('onchange never fired')
}
}
</script>
</head>
<body onload="test()">
This tests that onchange correctly fires after calling setValueForUser(). It can only be run using DumpRenderTree.<br>
<form name="fm">
<input type="text" id="tf" />
</form>
<div id="console"></div>
</body>
</html>
|