From f9badc3e33045f478e9433916f0f608f85a4036e Mon Sep 17 00:00:00 2001
From: Jez Ng
Date: Tue, 10 Jan 2012 01:22:41 +0800
Subject: Add password boxes to list of input focus-able elements.
Add test for this element and for skipping over hidden elements (commit
e2f3b54).
---
test_harnesses/automated.html | 24 ++++++++++++++++++++++++
vimiumFrontend.js | 2 +-
2 files changed, 25 insertions(+), 1 deletion(-)
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 =
+ "" +
+ "" +
+ "";
+ 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']"];
--
cgit v1.2.3