| <!doctype html> |
| <script src="../../resources/ahem.js"></script> |
| <script src="../../resources/testharness.js"></script> |
| <script src="../../resources/testharnessreport.js"></script> |
| <div CONTENTEDITABLE id="test" style="direction: rtl; width:200px; font-family: Ahem; font-size:2000%; outline: solid thin"></div> |
| <script> |
| // Click in the div, the caret should be on the right edge of the div. |
| test(() => { |
| const selection = window.getSelection(); |
| const target = document.getElementById('test'); |
| target.focus(); |
| selection.collapse(target, 0); |
| if (!window.internals) |
| throw 'This test requires internals.'; |
| const rect = internals.absoluteCaretBounds(); |
| assert_equals(`(${rect.left},${rect.top})+${rect.width}x${rect.height}`, |
| '(207,8)+1x320'); |
| }, 'This tests that clicking in a contenteditable div will set the caret in the right edge of the div'); |
| </script> |