aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorPhil Crosby2014-04-18 23:00:28 -0700
committerPhil Crosby2014-04-18 23:00:28 -0700
commit5ebc1aa78ba595e3753e00c3d912d9e45e310e7f (patch)
tree745db32693b9a2a8122c727be385b0d44e04c676 /tests
parent366c0a56a4eed38fa8425fd227cd389181fbed92 (diff)
parent004f9a119d15d1b7e96ba50c1fec2c56b052a5b8 (diff)
downloadvimium-5ebc1aa78ba595e3753e00c3d912d9e45e310e7f.tar.bz2
Merge pull request #945 from shyiko/master
Fixed detection of links which are only partially inside the viewport
Diffstat (limited to 'tests')
-rw-r--r--tests/dom_tests/dom_utils_test.coffee8
-rw-r--r--tests/unit_tests/utils_test.coffee2
2 files changed, 10 insertions, 0 deletions
diff --git a/tests/dom_tests/dom_utils_test.coffee b/tests/dom_tests/dom_utils_test.coffee
index d0f881ba..130a3014 100644
--- a/tests/dom_tests/dom_utils_test.coffee
+++ b/tests/dom_tests/dom_utils_test.coffee
@@ -42,6 +42,14 @@ context "Check visibility",
assert.equal null, DomUtils.getVisibleClientRect document.getElementById 'foo'
assert.equal null, DomUtils.getVisibleClientRect document.getElementById 'bar'
+ should "detect links only partially outside viewport as visible", ->
+ document.getElementById("test-div").innerHTML = """
+ <a id='foo' style='position:absolute;top:-10px'>test</a>
+ <a id='bar' style='position:absolute;left:-10px'>test</a>
+ """
+ assert.isTrue (DomUtils.getVisibleClientRect document.getElementById 'foo') != null
+ assert.isTrue (DomUtils.getVisibleClientRect document.getElementById 'bar') != null
+
should "detect opacity:0 links as hidden", ->
document.getElementById("test-div").innerHTML = """
<a id='foo' style='opacity:0'>test</a>
diff --git a/tests/unit_tests/utils_test.coffee b/tests/unit_tests/utils_test.coffee
index e1aa32c7..91a06135 100644
--- a/tests/unit_tests/utils_test.coffee
+++ b/tests/unit_tests/utils_test.coffee
@@ -1,5 +1,7 @@
require "./test_helper.js"
extend(global, require "../../lib/utils.js")
+Utils.getCurrentVersion = -> '1.43'
+global.localStorage = {}
extend(global, require "../../background_scripts/settings.js")
context "isUrl",