| OLD | NEW |
| 1 <head> | 1 <head> |
| 2 <script src="../../resources/ahem.js"></script> | 2 <script src="../../resources/ahem.js"></script> |
| 3 <style type="text/css"> | 3 <style type="text/css"> |
| 4 .ahem { font: 20px Ahem; } | 4 .ahem { font: 20px Ahem; } |
| 5 </style> | 5 </style> |
| 6 <script> | 6 <script> |
| 7 if (window.testRunner) | 7 if (window.testRunner) |
| 8 testRunner.dumpAsText(); | 8 testRunner.dumpAsText(); |
| 9 | 9 |
| 10 function runTest() { | 10 function runTest() { |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 } | 38 } |
| 39 | 39 |
| 40 function runCursorMoveTest(testName, frame, selectionSource) | 40 function runCursorMoveTest(testName, frame, selectionSource) |
| 41 { | 41 { |
| 42 var onMacPlatform = navigator.userAgent.search(/\bMac OS X\b/) != -1; | 42 var onMacPlatform = navigator.userAgent.search(/\bMac OS X\b/) != -1; |
| 43 var modifiers = onMacPlatform ? ["altKey"] : []; | 43 var modifiers = onMacPlatform ? ["altKey"] : []; |
| 44 | 44 |
| 45 if (!window.eventSender) | 45 if (!window.eventSender) |
| 46 return; | 46 return; |
| 47 | 47 |
| 48 eventSender.keyDown("pageDown", modifiers); | 48 eventSender.keyDown("PageDown", modifiers); |
| 49 var line = selectionSource.getSelection().baseNode.nodeValue; | 49 var line = selectionSource.getSelection().baseNode.nodeValue; |
| 50 if (line != "line 3") | 50 if (line != "line 3") |
| 51 throw "cursor should be at line 3, not " + line; | 51 throw "cursor should be at line 3, not " + line; |
| 52 | 52 |
| 53 eventSender.keyDown("pageDown", modifiers); | 53 eventSender.keyDown("PageDown", modifiers); |
| 54 var line = selectionSource.getSelection().baseNode.nodeValue; | 54 var line = selectionSource.getSelection().baseNode.nodeValue; |
| 55 if (line != "line 6") | 55 if (line != "line 6") |
| 56 throw "cursor should be at line 6, not " + line; | 56 throw "cursor should be at line 6, not " + line; |
| 57 | 57 |
| 58 eventSender.keyDown("pageUp", modifiers); | 58 eventSender.keyDown("PageUp", modifiers); |
| 59 var line = selectionSource.getSelection().baseNode.nodeValue; | 59 var line = selectionSource.getSelection().baseNode.nodeValue; |
| 60 if (line != "line 3") | 60 if (line != "line 3") |
| 61 throw "cursor should be at line 3, not " + line; | 61 throw "cursor should be at line 3, not " + line; |
| 62 | 62 |
| 63 // Test that on Mac pageDown/pageUp does not move the cursor at all. | 63 // Test that on Mac PageDown/PageUp does not move the cursor at all. |
| 64 if (onMacPlatform) { | 64 if (onMacPlatform) { |
| 65 eventSender.keyDown("pageDown", []); | 65 eventSender.keyDown("PageDown", []); |
| 66 var line = selectionSource.getSelection().baseNode.nodeValue; | 66 var line = selectionSource.getSelection().baseNode.nodeValue; |
| 67 if (line != "line 3") { | 67 if (line != "line 3") { |
| 68 document.getElementById("results").innerText = "cursor should be at li
ne 3, not " + line; | 68 document.getElementById("results").innerText = "cursor should be at li
ne 3, not " + line; |
| 69 throw "cursor should be at line 3, not " + line; | 69 throw "cursor should be at line 3, not " + line; |
| 70 } | 70 } |
| 71 | 71 |
| 72 eventSender.keyDown("pageUp", []); | 72 eventSender.keyDown("PageUp", []); |
| 73 var line = selectionSource.getSelection().baseNode.nodeValue; | 73 var line = selectionSource.getSelection().baseNode.nodeValue; |
| 74 if (line != "line 3") { | 74 if (line != "line 3") { |
| 75 document.getElementById("results").innerText = "cursor should be at li
ne 3, not " + line; | 75 document.getElementById("results").innerText = "cursor should be at li
ne 3, not " + line; |
| 76 throw "cursor should be at line 3, not " + line; | 76 throw "cursor should be at line 3, not " + line; |
| 77 } | 77 } |
| 78 } | 78 } |
| 79 | 79 |
| 80 document.getElementById("results").innerHTML += testName + " PASS<br/>"; | 80 document.getElementById("results").innerHTML += testName + " PASS<br/>"; |
| 81 } | 81 } |
| 82 </script> | 82 </script> |
| 83 </head> | 83 </head> |
| 84 <body onload="runTest()"> | 84 <body onload="runTest()"> |
| 85 <div>Page up/down (option+page up/down on Mac) should move the move cursor and s
croll the content | 85 <div>Page up/down (option+page up/down on Mac) should move the move cursor and s
croll the content |
| 86 in contenteditable elements. This sample covers cursor position move test of a)
iframe element containing | 86 in contenteditable elements. This sample covers cursor position move test of a)
iframe element containing |
| 87 contenteditable body, and b) content editable div element.</div> | 87 contenteditable body, and b) content editable div element.</div> |
| 88 <iframe src="../resources/contenteditable-iframe-fixed-size-src.html"></iframe> | 88 <iframe src="../resources/contenteditable-iframe-fixed-size-src.html"></iframe> |
| 89 <div id="editable" contenteditable="true" class="ahem" style="height:150px; over
flow:auto;"></div> | 89 <div id="editable" contenteditable="true" class="ahem" style="height:150px; over
flow:auto;"></div> |
| 90 <div id="results"></div> | 90 <div id="results"></div> |
| 91 </body> | 91 </body> |
| OLD | NEW |