tor-browser

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

FormControlRange-supported-elements.html (1230B)


      1 <!DOCTYPE html>
      2 <script src="/resources/testharness.js"></script>
      3 <script src="/resources/testharnessreport.js"></script>
      4 <body></body>
      5 <script>
      6 test(() => {
      7  [
      8    { html: '<textarea>Hello world</textarea>', name: 'textarea' },
      9    { html: '<input type="text" value="Sample text">', name: 'input[type=text]' },
     10    { html: '<input type="search" value="search query">', name: 'input[type=search]' },
     11    { html: '<input type="password" value="secret123">', name: 'input[type=password]' },
     12    { html: '<input type="url" value="https://example.com">', name: 'input[type=url]' },
     13    { html: '<input type="tel" value="+1-555-123-4567">', name: 'input[type=tel]' }
     14  ].forEach(({ html, name }) => {
     15    test(() => {
     16      document.body.innerHTML = html;
     17      const element = document.body.firstElementChild;
     18      const range = new FormControlRange();
     19      const value = element.value || element.textContent;
     20 
     21      range.setFormControlRange(element, 0, value.length);
     22 
     23      assert_equals(range.startContainer, element);
     24      assert_equals(range.endContainer, element);
     25      assert_equals(range.toString(), value);
     26    }, `FormControlRange should support ${name}.`);
     27  });
     28 }, "FormControlRange supported elements.");
     29 </script>