aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorStephen Blott2015-06-10 16:39:02 +0100
committerStephen Blott2015-06-10 16:52:16 +0100
commit61764d812a37ca2c29b3b7ddde878f25250abf81 (patch)
tree66b50410a1d968618cb63bb8c9c42f80290b9888 /tests
parente516bae3a3374780d2cb1b6c32e5fd1f2c13a408 (diff)
downloadvimium-61764d812a37ca2c29b3b7ddde878f25250abf81.tar.bz2
Fix bug relating to duplicate hint strings.
(Not sure when this crept in.) We need to ensure that we always generate the same hint strings for the same filter state. Here, we do this by always using the same mechanism (@filterLinkHints) to set the hint strings.
Diffstat (limited to 'tests')
-rw-r--r--tests/dom_tests/dom_tests.coffee27
1 files changed, 17 insertions, 10 deletions
diff --git a/tests/dom_tests/dom_tests.coffee b/tests/dom_tests/dom_tests.coffee
index dd2f5a5d..a79735ae 100644
--- a/tests/dom_tests/dom_tests.coffee
+++ b/tests/dom_tests/dom_tests.coffee
@@ -212,11 +212,14 @@ context "Filtered link hints",
@linkHints.deactivateMode()
should "label the images", ->
- hintMarkers = getHintMarkers()
- assert.equal "1: alt text", hintMarkers[0].textContent.toLowerCase()
- assert.equal "2: some title", hintMarkers[1].textContent.toLowerCase()
- assert.equal "3: alt text", hintMarkers[2].textContent.toLowerCase()
- assert.equal "4", hintMarkers[3].textContent.toLowerCase()
+ hintMarkers = getHintMarkers().map (marker) -> marker.textContent.toLowerCase()
+ # We don't know the actual hint numbers which will be assigned, so we replace them with "N".
+ hintMarkers = hintMarkers.map (str) -> str.replace /^[1-4]/, "N"
+ assert.equal 4, hintMarkers.length
+ assert.isTrue "N: alt text" in hintMarkers
+ assert.isTrue "N: some title" in hintMarkers
+ assert.isTrue "N: alt text" in hintMarkers
+ assert.isTrue "N" in hintMarkers
context "Input hints",
@@ -235,11 +238,15 @@ context "Filtered link hints",
should "label the input elements", ->
hintMarkers = getHintMarkers()
- assert.equal "1", hintMarkers[0].textContent.toLowerCase()
- assert.equal "2", hintMarkers[1].textContent.toLowerCase()
- assert.equal "3: a label", hintMarkers[2].textContent.toLowerCase()
- assert.equal "4: a label", hintMarkers[3].textContent.toLowerCase()
- assert.equal "5", hintMarkers[4].textContent.toLowerCase()
+ hintMarkers = getHintMarkers().map (marker) -> marker.textContent.toLowerCase()
+ # We don't know the actual hint numbers which will be assigned, so we replace them with "N".
+ hintMarkers = hintMarkers.map (str) -> str.replace /^[1-5]/, "N"
+ assert.equal 5, hintMarkers.length
+ assert.isTrue "N" in hintMarkers
+ assert.isTrue "N" in hintMarkers
+ assert.isTrue "N: a label" in hintMarkers
+ assert.isTrue "N: a label" in hintMarkers
+ assert.isTrue "N" in hintMarkers
context "Input focus",