dom/imptests/editing/selecttest/test_isCollapsed.html

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

     1 <!doctype html>
     2 <title>Selection.isCollapsed tests</title>
     3 <div id=log></div>
     4 <script src=/resources/testharness.js></script>
     5 <script src=/resources/testharnessreport.js></script>
     6 <script src=common.js></script>
     7 <script>
     8 "use strict";
    10 test(function() {
    11 	selection.removeAllRanges();
    12 	assert_true(selection.isCollapsed, "isCollapsed must be true if both anchor and focus are null");
    13 }, "Empty selection");
    15 for (var i = 0; i < testRanges.length; i++) {
    16 	test(function() {
    17 		selection.removeAllRanges();
    18 		var endpoints = eval(testRanges[i]);
    19 		var range = ownerDocument(endpoints[0]).createRange();
    20 		range.setStart(endpoints[0], endpoints[1]);
    21 		range.setEnd(endpoints[2], endpoints[3]);
    22 		selection.addRange(range);
    24 		assert_equals(selection.isCollapsed,
    25 			endpoints[0] === endpoints[2] && endpoints[1] === endpoints[3],
    26 			"Value of isCollapsed");
    27 	}, "Range " + i + " " + testRanges[i]);
    28 }
    30 testDiv.style.display = "none";
    31 </script>

mercurial