| <script src="../resources/testharness.js"></script> |
| <script src="../resources/testharnessreport.js"></script> |
| <script src="../resources/run-after-layout-and-paint.js"></script> |
| <ul id="ul_editable" contenteditable> |
| <ol id="ol_editable" contenteditable> |
| test_after_layout_and_paint(function() { |
| if (!window.accessibilityController) |
| let ids = ['ul', 'ul_editable', 'ol', 'ol_editable']; |
| let axList = accessibilityController.accessibleElementById(id); |
| assert_not_equals(axList, undefined, id); |
| // Select both items in the list. |
| axList.setSelectedTextRange(0, 2); |
| let selectionText = 'Item1\nItem2'; |
| assert_equals(axList.selectionAnchorOffset, 0, id); |
| assert_equals(axList.selectionFocusOffset, 5, id); |
| let selection = window.getSelection(); |
| assert_equals(selection.toString(), selectionText, id); |
| document.getElementById(id).style.display = "none";; |
| }, 'Setting the selection on various lists through the accessibility APIs should work.'); |