tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

defaultSelection.html (965B)


      1 <!doctype html>
      2 <meta charset="utf-8">
      3 <title></title>
      4 <script src="/resources/testharness.js"></script>
      5 <script src="/resources/testharnessreport.js"></script>
      6 <textarea>foo</textarea>
      7 <input type="text" value="foo"></input>
      8 <script>
      9 
     10 for (let el of [document.querySelector("textarea"), document.querySelector("input")]) {
     11    test(function() {
     12        assert_equals(el.selectionStart, 0);
     13        assert_equals(el.selectionEnd, 0);
     14    }, `Default selectionStart and selectionEnd for ${el}`);
     15 
     16    test(function() {
     17        el.value="foo";
     18        assert_equals(el.selectionStart, 0);
     19        assert_equals(el.selectionEnd, 0);
     20    }, `selectionStart and selectionEnd do not change when same value set again for ${el}`);
     21 
     22    test(function() {
     23        el.value="Foo";
     24        assert_equals(el.selectionStart, 3);
     25        assert_equals(el.selectionEnd, 3);
     26    }, `selectionStart and selectionEnd change when value changed to upper case for ${el}`);
     27  }
     28 </script>