aboutsummaryrefslogtreecommitdiffstats
path: root/tests/dom_tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests/dom_tests')
-rw-r--r--tests/dom_tests/dom_tests.html2
-rw-r--r--tests/dom_tests/dom_utils_test.coffee12
2 files changed, 14 insertions, 0 deletions
diff --git a/tests/dom_tests/dom_tests.html b/tests/dom_tests/dom_tests.html
index ab48a88a..d2e795d1 100644
--- a/tests/dom_tests/dom_tests.html
+++ b/tests/dom_tests/dom_tests.html
@@ -32,6 +32,8 @@
<script type="text/javascript" src="../../lib/utils.js"></script>
<script type="text/javascript" src="../../lib/keyboard_utils.js"></script>
<script type="text/javascript" src="../../lib/dom_utils.js"></script>
+ <!-- For DomUtils.documentReady() tests; see ./dom_utils_test.coffee. -->
+ <script>DomUtils.documentReady(function() {window.documentReadyListenerCalled = true;})</script>
<script type="text/javascript" src="../../lib/rect.js"></script>
<script type="text/javascript" src="../../lib/handler_stack.js"></script>
<script type="text/javascript" src="../../lib/clipboard.js"></script>
diff --git a/tests/dom_tests/dom_utils_test.coffee b/tests/dom_tests/dom_utils_test.coffee
index ce8fa370..98c7cc8d 100644
--- a/tests/dom_tests/dom_utils_test.coffee
+++ b/tests/dom_tests/dom_utils_test.coffee
@@ -1,3 +1,15 @@
+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", ->