context "DOM content loaded",
# The DOM content has already loaded, this should be called immediately.
should "call callback immediately.", ->
called = false
DomUtils.documentReady -> called = true
assert.isTrue called
# See ./dom_tests.html; the callback there was installed before the document was ready.
should "already have called callback embedded in test page.", ->
assert.isTrue window.documentReadyListenerCalled? and window.documentReadyListenerCalled
context "Check visibility",
should "detect visible elements as visible", ->
document.getElementById("test-div").innerHTML = """
test
"""
assert.isTrue (DomUtils.getVisibleClientRect (document.getElementById 'foo'), true) != null
should "detect display:none links as hidden", ->
document.getElementById("test-div").innerHTML = """
test
"""
assert.equal null, (DomUtils.getVisibleClientRect (document.getElementById 'foo'), true)
should "detect visibility:hidden links as hidden", ->
document.getElementById("test-div").innerHTML = """
test
"""
assert.equal null, (DomUtils.getVisibleClientRect (document.getElementById 'foo'), true)
should "detect elements nested in display:none elements as hidden", ->
document.getElementById("test-div").innerHTML = """
"""
assert.equal null, (DomUtils.getVisibleClientRect (document.getElementById 'foo'), true)
should "detect links nested in visibility:hidden elements as hidden", ->
document.getElementById("test-div").innerHTML = """
"""
assert.equal null, (DomUtils.getVisibleClientRect (document.getElementById 'foo'), true)
should "detect font-size: 0; and display: inline; links when their children are display: inline", ->
# This test represents the minimal test case covering issue #1554.
document.getElementById("test-div").innerHTML = """
"""
assert.isTrue (DomUtils.getVisibleClientRect (document.getElementById 'foo'), true) != null
should "detect links inside opacity:0 elements as visible", ->
# XXX This is an expected failure. See issue #16.
document.getElementById("test-div").innerHTML = """