diff options
| -rw-r--r-- | test_harnesses/automated.html | 24 | ||||
| -rw-r--r-- | vimiumFrontend.js | 2 |
2 files changed, 25 insertions, 1 deletions
diff --git a/test_harnesses/automated.html b/test_harnesses/automated.html index e7d84413..5e3ae93c 100644 --- a/test_harnesses/automated.html +++ b/test_harnesses/automated.html @@ -224,6 +224,30 @@ }) ) + + ); + + context("Input focus", + + setup(function() { + var testContent = + "<input type='text' id='first'/>" + + "<input style='display:none;' id='second'/>" + + "<input type='password' id='third' value='some value'/>"; + document.getElementById("test-div").innerHTML = testContent; + }), + + tearDown(function() { + document.getElementById("test-div").innerHTML = ""; + }), + + should("focus the right element", function() { + focusInput(1); + assert.equal('first', document.activeElement.id); + focusInput(100); + assert.equal('third', document.activeElement.id); + }) + ); Tests.outputMethod = function(output) { diff --git a/vimiumFrontend.js b/vimiumFrontend.js index 8fa72509..594438e9 100644 --- a/vimiumFrontend.js +++ b/vimiumFrontend.js @@ -29,7 +29,7 @@ var linkHintCss; // The corresponding XPath for such elements. var textInputXPath = (function() { - var textInputTypes = ["text", "search", "email", "url", "number"]; + var textInputTypes = ["text", "search", "email", "url", "number", "password"]; var inputElements = ["input[" + textInputTypes.map(function (type) { return '@type="' + type + '"'; }).join(" or ") + "or not(@type)]", "textarea", "*[@contenteditable='' or translate(@contenteditable, 'TRUE', 'true')='true']"]; |
