Index: LayoutTests/accessibility/input-type-password-value-and-selection.html |
diff --git a/LayoutTests/accessibility/input-type-password-value-and-selection.html b/LayoutTests/accessibility/input-type-password-value-and-selection.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..85f4f27fc2b1364c5f82fd6457efabed91083ea9 |
--- /dev/null |
+++ b/LayoutTests/accessibility/input-type-password-value-and-selection.html |
@@ -0,0 +1,54 @@ |
+<!DOCTYPE html> |
+<html> |
+ <head> |
+ <script src="../resources/js-test.js"></script> |
+ </head> |
+ <body> |
+ |
+ <input id="password" type="password" value="Secret"> |
+ |
+ <p id="description"></p> |
+ <div id="console"></div> |
+ |
+ <script> |
+ description("This tests that AXValue, caret position and text selection are reported correctly for password fields."); |
+ |
+ if (window.accessibilityController) { |
+ var password = document.getElementById("password"); |
+ var textLength = password.value.length; |
+ password.focus(); |
+ var axPassword = accessibilityController.accessibleElementById("password"); |
+ |
+ // Initially the caret should be at the beginning of the field. |
+ shouldBeZero("axPassword.selectionStart"); |
+ shouldBeZero("axPassword.selectionEnd"); |
+ shouldBeZero("axPassword.selectionStartLineNumber"); |
+ shouldBeZero("axPassword.selectionEndLineNumber"); |
+ |
+ // The password field should contain 6 bullets. |
+ // (Bullet is the default mask character, not star.) |
+ var axValue = "AXValue: " + new Array(textLength + 1).join( |
+ String.fromCharCode(8226 /* Bullet symbol. */)); |
+ shouldBeEqualToString("axPassword.stringValue", axValue); |
+ |
+ for (var start = 0; start < textLength; ++start) { |
+ for (var end = start; end < textLength; ++end) { |
+ password.setSelectionRange(start, end); |
+ shouldBeEqualToNumber("axPassword.selectionStart", start); |
+ shouldBeEqualToNumber("axPassword.selectionEnd", end); |
+ shouldBeZero("axPassword.selectionStartLineNumber"); |
+ shouldBeZero("axPassword.selectionEndLineNumber"); |
+ } |
+ } |
+ |
+ // Invalid range. |
+ password.setSelectionRange(7, 0); |
+ shouldBeZero("axPassword.selectionStart"); |
+ shouldBeZero("axPassword.selectionEnd"); |
+ shouldBeZero("axPassword.selectionStartLineNumber"); |
+ shouldBeZero("axPassword.selectionEndLineNumber"); |
+ |
+ } |
+ </script> |
+ </body> |
+</html> |