| <!DOCTYPE html> |
| <script src="../resources/testharness.js"></script> |
| <script src="../resources/testharnessreport.js"></script> |
| |
| <ul id="ul"> |
| <li>Item1</li> |
| <li>Item2</li> |
| </ul> |
| |
| <ul id="ul_editable" contenteditable> |
| <li>Item1</li> |
| <li>Item2</li> |
| </ul> |
| |
| <ol id="ol"> |
| <li>Item1</li> |
| <li>Item2</li> |
| </ol> |
| |
| <ol id="ol_editable" contenteditable> |
| <li>Item1</li> |
| <li>Item2</li> |
| </ol> |
| |
| <script> |
| test(function() { |
| if (!window.accessibilityController) |
| return; |
| |
| let ids = ['ul', 'ul_editable', 'ol', 'ol_editable']; |
| for (let id of ids) { |
| let axList = accessibilityController.accessibleElementById(id); |
| assert_not_equals(axList, undefined, id); |
| |
| // Select both items in the list. |
| axList.setSelectedTextRange(0, 2); |
| // |selectionStart| and |selectionEnd| are character-based. |
| let selectionText = 'Item1\nItem2'; |
| assert_equals(axList.selectionStart, 0, id); |
| assert_equals(axList.selectionEnd, selectionText.length, id); |
| |
| let selection = window.getSelection(); |
| assert_equals(selection.toString(), selectionText, id); |
| |
| if (window.testRunner) |
| document.getElementById(id).style.display = "none";; |
| } |
| }, 'Setting the selection on various lists through the accessibility APIs should work.'); |
| </script> |
| |