1<html>
2<head>
3<script>
4function test() {
5 if (window.layoutTestController)
6 layoutTestController.dumpAsText();
7
8 var it = document.getElementById("it");
9 it.focus();
10
11 if (window.eventSender) {
12 eventSender.keyDown("r"); // reset and focus
13 }
14
15 if (it.innerText == "r")
16 document.getElementById("result").innerHTML = "PASS";
17 else
18 document.getElementById("result").innerHTML = "FAIL: editable div content is '" + it.innerText + "' and it should be 'r'";
19}
20
21function resetIt(event) {
22 if (event.keyCode === 82) { //r
23 var it = document.getElementById("it");
24 it.innerText = '';
25 it.focus();
26 }
27}
28
29</script>
30</head>
31<body onload="test()">
32<p>Tests behavior of code that clears the text from an editable div and focuses it on keyDown event with specific keyCode. Key to clear is 'r' for 'reset'</p>
33<p>The test runs only under DumpRenderTree with eventSender; if you test by hand the test result below will say FAIL.</p>
34<div id="it" style="-webkit-user-modify: read-write;-webkit-user-select: text;cursor: text;" onKeyDown="resetIt(event)">text</div>
35<p id="result">TEST NOT RUN YET</p>
36</body>
37</html>