aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJez Ng2012-01-10 01:22:41 +0800
committerJez Ng2012-01-12 02:12:24 +0800
commitf9badc3e33045f478e9433916f0f608f85a4036e (patch)
treef84ae6ed04403ec5f1a246bc5b4e99a4af55abb9
parent03728546c28664deaf89b9d2dc8fe5fb630bcd9a (diff)
downloadvimium-f9badc3e33045f478e9433916f0f608f85a4036e.tar.bz2
Add password boxes to list of input focus-able elements.
Add test for this element and for skipping over hidden elements (commit e2f3b54).
-rw-r--r--test_harnesses/automated.html24
-rw-r--r--vimiumFrontend.js2
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']"];