| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <script src="../../resources/testharness.js"></script> | 2 <script src="../../resources/testharness.js"></script> |
| 3 <script src="../../resources/testharnessreport.js"></script> | 3 <script src="../../resources/testharnessreport.js"></script> |
| 4 <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> | 4 <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> |
| 5 <div id="div" contenteditable="true"> | 5 <div id="div" contenteditable="true"> |
| 6 <div><span id="text">The following paragraph break should be selected on OS X.</
span></div> | 6 <div><span id="text">The following paragraph break should be selected on OS X.</
span></div> |
| 7 <br> | 7 <br> |
| 8 </div> | 8 </div> |
| 9 <div id="log"></div> | 9 <div id="log"></div> |
| 10 <script> | 10 <script> |
| 11 function testIt(platform, expectedValue) { | 11 function testIt(platform, expectedValue) { |
| 12 window.getSelection().removeAllRanges(); | 12 window.getSelection().removeAllRanges(); |
| 13 internals.settings.setEditingBehavior(platform); | 13 internals.settings.setEditingBehavior(platform); |
| 14 | 14 |
| 15 paragraph = document.getElementById("text"); | 15 paragraph = document.getElementById("text"); |
| 16 x = paragraph.offsetParent.offsetLeft + paragraph.offsetLeft + paragraph.off
setWidth + 10; | 16 x = paragraph.offsetParent.offsetLeft + paragraph.offsetLeft + paragraph.off
setWidth + 10; |
| 17 y = paragraph.offsetParent.offsetTop + paragraph.offsetTop + paragraph.offse
tHeight / 2; | 17 y = paragraph.offsetParent.offsetTop + paragraph.offsetTop + paragraph.offse
tHeight / 2; |
| 18 eventSender.mouseMoveTo(x, y); | 18 eventSender.mouseMoveTo(x, y); |
| 19 // Give the editable region focus. | 19 // Give the editable region focus. |
| 20 eventSender.mouseDown(); | 20 eventSender.mouseDown(); |
| 21 eventSender.mouseUp(); | 21 eventSender.mouseUp(); |
| 22 // Right click on the paragraph break to select it. | 22 // Right click on the paragraph break to select it. |
| 23 eventSender.contextClick(); | 23 eventSender.contextClick(); |
| 24 // esc key to kill the context menu. | 24 // esc key to kill the context menu. |
| 25 eventSender.keyDown("escape", null); | 25 eventSender.keyDown("Escape", null); |
| 26 assert_equals(window.getSelection().type, expectedValue); | 26 assert_equals(window.getSelection().type, expectedValue); |
| 27 } | 27 } |
| 28 | 28 |
| 29 if (window.eventSender && window.testRunner && window.internals) { | 29 if (window.eventSender && window.testRunner && window.internals) { |
| 30 test(testIt.bind(this, 'mac', 'Range'), 'mac'); | 30 test(testIt.bind(this, 'mac', 'Range'), 'mac'); |
| 31 test(testIt.bind(this, 'win', 'Caret'), 'win'); | 31 test(testIt.bind(this, 'win', 'Caret'), 'win'); |
| 32 test(testIt.bind(this, 'unix', 'Caret'), 'unix'); | 32 test(testIt.bind(this, 'unix', 'Caret'), 'unix'); |
| 33 test(testIt.bind(this, 'android', 'Caret'), 'android'); | 33 test(testIt.bind(this, 'android', 'Caret'), 'android'); |
| 34 } | 34 } |
| 35 </script> | 35 </script> |
| OLD | NEW |