OLD | NEW |
1 <p>This tests whether right clicking on a paragraph break in editable content se
lects it. The break should be selected on OS X, but not on Windows or Unix. To
run it manually, right click on the paragraph break after the first paragraph b
elow.</p> | 1 <p>This tests whether right clicking on a paragraph break in editable content se
lects it. The break should be selected on OS X, but not on Windows or Unix. To
run it manually, right click on the paragraph break after the first paragraph b
elow.</p> |
2 <div id="div" contenteditable="true"> | 2 <div id="div" contenteditable="true"> |
3 <div><span id="text">The following paragraph break should be selected on OS X.</
span></div> | 3 <div><span id="text">The following paragraph break should be selected on OS X.</
span></div> |
4 <br> | 4 <br> |
5 </div> | 5 </div> |
6 <p>Mac: <span id="resultmac">RUNNING</span></p> | 6 <p>Mac: <span id="resultmac">RUNNING</span></p> |
7 <p>Win: <span id="resultwin">RUNNING</span></p> | 7 <p>Win: <span id="resultwin">RUNNING</span></p> |
8 <p>Unix: <span id="resultunix">RUNNING</span></p> | 8 <p>Unix: <span id="resultunix">RUNNING</span></p> |
9 <p>Android: <span id="resultandroid">RUNNING</span></p> | 9 <p>Android: <span id="resultandroid">RUNNING</span></p> |
10 | 10 |
11 <script> | 11 <script> |
12 function test(platform, result) { | 12 function test(platform, result) { |
13 window.getSelection().removeAllRanges(); | 13 window.getSelection().removeAllRanges(); |
14 internals.settings.setEditingBehavior(platform); | 14 internals.settings.setEditingBehavior(platform); |
15 | 15 |
16 paragraph = document.getElementById("text"); | 16 paragraph = document.getElementById("text"); |
17 x = paragraph.offsetParent.offsetLeft + paragraph.offsetLeft + paragraph.off
setWidth + 10; | 17 x = paragraph.offsetParent.offsetLeft + paragraph.offsetLeft + paragraph.off
setWidth + 10; |
18 y = paragraph.offsetParent.offsetTop + paragraph.offsetTop + paragraph.offse
tHeight / 2; | 18 y = paragraph.offsetParent.offsetTop + paragraph.offsetTop + paragraph.offse
tHeight / 2; |
19 eventSender.mouseMoveTo(x, y); | 19 eventSender.mouseMoveTo(x, y); |
20 // Give the editable region focus. | 20 // Give the editable region focus. |
21 eventSender.mouseDown(); | 21 eventSender.mouseDown(); |
22 eventSender.mouseUp(); | 22 eventSender.mouseUp(); |
23 // Right click on the paragraph break to select it. | 23 // Right click on the paragraph break to select it. |
24 eventSender.contextClick(); | 24 eventSender.contextClick(); |
25 // esc key to kill the context menu. | 25 // esc key to kill the context menu. |
26 eventSender.keyDown(String.fromCharCode(0x001B), null); | 26 eventSender.keyDown("escape", null); |
27 | 27 |
28 document.getElementById(result).innerHTML = window.getSelection().type; | 28 document.getElementById(result).innerHTML = window.getSelection().type; |
29 } | 29 } |
30 | 30 |
31 if (window.eventSender && window.testRunner && window.internals) { | 31 if (window.eventSender && window.testRunner && window.internals) { |
32 testRunner.dumpAsText(); | 32 testRunner.dumpAsText(); |
33 | 33 |
34 test('mac', 'resultmac'); | 34 test('mac', 'resultmac'); |
35 test('win', 'resultwin'); | 35 test('win', 'resultwin'); |
36 test('unix', 'resultunix'); | 36 test('unix', 'resultunix'); |
37 test('android', 'resultandroid'); | 37 test('android', 'resultandroid'); |
38 } | 38 } |
39 </script> | 39 </script> |
40 | 40 |
OLD | NEW |