OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <html> |
| 3 <head> |
| 4 <script src="../resources/js-test.js"></script> |
| 5 </head> |
| 6 <body> |
| 7 |
| 8 <input id="password" type="password" value="Secret"> |
| 9 |
| 10 <p id="description"></p> |
| 11 <div id="console"></div> |
| 12 |
| 13 <script> |
| 14 description("This tests that AXValue, caret position and text selection
are reported correctly for password fields."); |
| 15 |
| 16 if (window.accessibilityController) { |
| 17 var password = document.getElementById("password"); |
| 18 var textLength = password.value.length; |
| 19 password.focus(); |
| 20 var axPassword = accessibilityController.accessibleElementById("pass
word"); |
| 21 |
| 22 // Initially the caret should be at the beginning of the field. |
| 23 shouldBeZero("axPassword.selectionStart"); |
| 24 shouldBeZero("axPassword.selectionEnd"); |
| 25 shouldBeZero("axPassword.selectionStartLineNumber"); |
| 26 shouldBeZero("axPassword.selectionEndLineNumber"); |
| 27 |
| 28 // The password field should contain 6 bullets. |
| 29 // (Bullet is the default mask character, not star.) |
| 30 var axValue = "AXValue: " + new Array(textLength + 1).join( |
| 31 String.fromCharCode(8226 /* Bullet symbol. */)); |
| 32 shouldBeEqualToString("axPassword.stringValue", axValue); |
| 33 |
| 34 for (var start = 0; start < textLength; ++start) { |
| 35 for (var end = start; end < textLength; ++end) { |
| 36 password.setSelectionRange(start, end); |
| 37 shouldBeEqualToNumber("axPassword.selectionStart", start); |
| 38 shouldBeEqualToNumber("axPassword.selectionEnd", end); |
| 39 shouldBeZero("axPassword.selectionStartLineNumber"); |
| 40 shouldBeZero("axPassword.selectionEndLineNumber"); |
| 41 } |
| 42 } |
| 43 |
| 44 // Invalid range. |
| 45 password.setSelectionRange(7, 0); |
| 46 shouldBeZero("axPassword.selectionStart"); |
| 47 shouldBeZero("axPassword.selectionEnd"); |
| 48 shouldBeZero("axPassword.selectionStartLineNumber"); |
| 49 shouldBeZero("axPassword.selectionEndLineNumber"); |
| 50 |
| 51 } |
| 52 </script> |
| 53 </body> |
| 54 </html> |
OLD | NEW |