aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorStephen Blott2016-03-17 10:37:11 +0000
committerStephen Blott2016-03-28 05:59:19 +0100
commitd2691a43cc97a89c4d127ef6ef0be4c0417c675d (patch)
treefdb4f678bfb3217691e348bd21161cb5568af752 /tests
parentf49d4b2f5980d48e76fd2e32491c9793f5f6fdf8 (diff)
downloadvimium-d2691a43cc97a89c4d127ef6ef0be4c0417c675d.tar.bz2
Filter out link-hint false positives.
We recognise elements with a class names containing the text "button" as clickable. However, often they're not, they're just wrapping a clickable thing, like a real button. Here, we filter out such false positives. This has two effects: - It eliminates quite a number of real false pasitives in practice. - With fewer hints close together, fewer hint markers are obscured by the hints from (non-clickable) wrappers. This reduces the need for rotating the hint stacking order, e.g #1252.
Diffstat (limited to 'tests')
-rw-r--r--tests/dom_tests/dom_tests.coffee19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/dom_tests/dom_tests.coffee b/tests/dom_tests/dom_tests.coffee
index bc137a56..0dd6e122 100644
--- a/tests/dom_tests/dom_tests.coffee
+++ b/tests/dom_tests/dom_tests.coffee
@@ -109,6 +109,25 @@ createGeneralHintTests = (isFilteredMode) ->
createGeneralHintTests false
createGeneralHintTests true
+context "False positives in link-hint",
+
+ setup ->
+ testContent = '<span class="buttonWrapper">false positive<a>clickable</a></span>' + '<span class="buttonWrapper">clickable</span>'
+ document.getElementById("test-div").innerHTML = testContent
+ stubSettings "filterLinkHints", true
+ stubSettings "linkHintNumbers", "12"
+
+ tearDown ->
+ document.getElementById("test-div").innerHTML = ""
+
+ should "handle false positives", ->
+ linkHints = activateLinkHintsMode()
+ hintMarkers = getHintMarkers()
+ linkHints.deactivateMode()
+ assert.equal 2, hintMarkers.length
+ for hintMarker in hintMarkers
+ assert.equal "clickable", hintMarker.linkText
+
inputs = []
context "Test link hints for focusing input elements correctly",