| <!DOCTYPE html> |
| <html> |
| <head> |
| <script src="../../../resources/accessibility-helper.js"></script> |
| <script src="../../../resources/js-test.js"></script> |
| </head> |
| <body> |
| <input type="text" id="editable"> |
| <script> |
| description("This tests that custom annotations are applied to the accessibility string"); |
| editable.focus(); |
| if (window.textInputController && window.accessibilityController) { |
| var element = accessibilityController.accessibleElementById("editable"); |
| |
| // Test with composition and no attributes |
| textInputController.setMarkedText("test"); |
| var attrString = element.attributedStringForRange(0, 4); |
| shouldBe("attrString.indexOf('AXTextCompletion = 1')", "-1"); |
| |
| // Test with composition and attributes |
| const message = " message"; |
| textInputController.unmarkText(); |
| textInputController.setMarkedText(message, 4, message.length, false, undefined, [ |
| { from: "4", length: message.length, annotation: "NSTextCompletion" } |
| ]); |
| attrString = element.attributedStringForRange(0, 4 + message.length); |
| shouldBeTrue("attrString.indexOf('AXTextCompletion = 1') != -1"); |
| } |
| </script> |
| </body> |
| </html> |