dom/imptests/editing/selecttest/test_isCollapsed.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/imptests/editing/selecttest/test_isCollapsed.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,31 @@
     1.4 +<!doctype html>
     1.5 +<title>Selection.isCollapsed tests</title>
     1.6 +<div id=log></div>
     1.7 +<script src=/resources/testharness.js></script>
     1.8 +<script src=/resources/testharnessreport.js></script>
     1.9 +<script src=common.js></script>
    1.10 +<script>
    1.11 +"use strict";
    1.12 +
    1.13 +test(function() {
    1.14 +	selection.removeAllRanges();
    1.15 +	assert_true(selection.isCollapsed, "isCollapsed must be true if both anchor and focus are null");
    1.16 +}, "Empty selection");
    1.17 +
    1.18 +for (var i = 0; i < testRanges.length; i++) {
    1.19 +	test(function() {
    1.20 +		selection.removeAllRanges();
    1.21 +		var endpoints = eval(testRanges[i]);
    1.22 +		var range = ownerDocument(endpoints[0]).createRange();
    1.23 +		range.setStart(endpoints[0], endpoints[1]);
    1.24 +		range.setEnd(endpoints[2], endpoints[3]);
    1.25 +		selection.addRange(range);
    1.26 +
    1.27 +		assert_equals(selection.isCollapsed,
    1.28 +			endpoints[0] === endpoints[2] && endpoints[1] === endpoints[3],
    1.29 +			"Value of isCollapsed");
    1.30 +	}, "Range " + i + " " + testRanges[i]);
    1.31 +}
    1.32 +
    1.33 +testDiv.style.display = "none";
    1.34 +</script>

mercurial