Test that selection's range is initially null
authorAryeh Gregor <AryehGregor+gitcommit@gmail.com>
Wed, 11 Jan 2012 13:38:32 -0700
changeset 684 4058e0a2965f
parent 683 5157ed0618cc
child 685 9ca0bc5d4285
Test that selection's range is initially null

All browsers pass this one, except Opera because its
document.getSelection() seems to not work properly.
selecttest/getSelection.html
--- a/selecttest/getSelection.html	Wed Jan 11 13:31:34 2012 -0700
+++ b/selecttest/getSelection.html	Wed Jan 11 13:38:32 2012 -0700
@@ -32,6 +32,18 @@
 	assert_equals(window.getSelection(), document.getSelection());
 }, "window.getSelection() === document.getSelection()");
 
+// "Each selection is associated with a single range, which may be null and is
+// initially null."
+//
+// "The rangeCount attribute must return 0 if the context object's range is
+// null, otherwise 1."
+test(function() {
+	assert_equals(window.getSelection().rangeCount, 0,
+		"window.getSelection().rangeCount must initially be 0");
+	assert_equals(document.getSelection().rangeCount, 0,
+		"document.getSelection().rangeCount must initially be 0");
+}, "Selection's range must initially be null");
+
 test(function() {
 	assert_true("Selection" in window, "window must have Selection property");