OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <html> |
| 3 <head> |
| 4 <style> |
| 5 .test { |
| 6 font-family: monospace; |
| 7 } |
| 8 .test:first-letter { |
| 9 color: red; |
| 10 } |
| 11 </style> |
| 12 </head> |
| 13 <body> |
| 14 <div id="container"> |
| 15 <p id="description"></p> |
| 16 <ol> |
| 17 <li>Click at "a" to see caret is before "a".</li> |
| 18 <li>Click between "d" and "e" to see caret is between "d" and "e"</li> |
| 19 <li>Hit enter to see next line is "efgh". |
| 20 </ol> |
| 21 <div id="sample" contenteditable="true"> |
| 22 <p class="test"><span id="test">abcdefgh</span></p> |
| 23 </div> |
| 24 </div> |
| 25 <div id="console"></div> |
| 26 <script src="../../fast/js/resources/js-test-pre.js"></script> |
| 27 <script> |
| 28 description('Check click to set caret position with first-letter style. http://c
rbug.com/266334'); |
| 29 function $(id) { return document.getElementById(id); } |
| 30 |
| 31 var selection = window.getSelection(); |
| 32 |
| 33 if (window.eventSender) { |
| 34 var test = $('test'); |
| 35 |
| 36 debug('Click at first letter'); |
| 37 eventSender.mouseMoveTo(test.offsetLeft + 1, test.offsetTop); |
| 38 eventSender.mouseDown(); |
| 39 eventSender.mouseUp(); |
| 40 |
| 41 shouldBeEqualToString('selection.type', 'Caret'); |
| 42 shouldBe('selection.anchorNode', 'test.firstChild'); |
| 43 shouldBe('selection.anchorOffset', '0'); |
| 44 |
| 45 debug('Click at middle'); |
| 46 eventSender.mouseMoveTo(test.offsetLeft + test.offsetWidth / 2, test.offsetT
op); |
| 47 eventSender.mouseDown(); |
| 48 eventSender.mouseUp(); |
| 49 |
| 50 shouldBeEqualToString('selection.type', 'Caret'); |
| 51 shouldBe('selection.anchorNode', 'test.firstChild'); |
| 52 shouldBe('selection.anchorOffset', '4'); |
| 53 } |
| 54 |
| 55 if (window.testRunner) |
| 56 $('container').outerHTML = ''; |
| 57 </script> |
| 58 <script src="../../fast/js/resources/js-test-post.js"></script> |
| 59 </body> |
| 60 </html> |
OLD | NEW |