tor-browser

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

defaultValue-clobbering.html (1578B)


      1 <!DOCTYPE html>
      2 <meta charset="utf-8">
      3 <link rel="author" title="Joey Arhar" href="mailto:jarhar@chromium.org">
      4 <meta name="assert" content="Assigning to defaultValue does not modify text a user has already typed in.">
      5 
      6 <!-- This behavior is not explicitly specified. -->
      7 
      8 <script src="/resources/testharness.js"></script>
      9 <script src="/resources/testharnessreport.js"></script>
     10 <script src="/resources/testdriver.js"></script>
     11 <script src="/resources/testdriver-vendor.js"></script>
     12 
     13 <div>
     14  email with leading whitespace: <input id=emailinput type=email>
     15 </div>
     16 <div>
     17  number with trailing incomplete exponent: <input id=numberinput type=number>
     18 </div>
     19 
     20 <script>
     21 promise_test(async () => {
     22  await test_driver.send_keys(emailinput, '  user');
     23  assert_false(emailinput.validity.valid, '"  user" should not be a valid value for type=email.');
     24 
     25  emailinput.defaultValue = emailinput.value;
     26  assert_false(emailinput.validity.valid, 'Assigning to defaultValue should not affect input.validity.');
     27 }, 'Visible value and validity should not be affected when assigning to the defaultValue property for type=email.');
     28 
     29 promise_test(async () => {
     30  await test_driver.send_keys(numberinput, '123e');
     31  assert_false(numberinput.validity.valid, '"123e" should not be a valid value for type=number.');
     32 
     33  numberinput.defaultValue = numberinput.value;
     34  assert_false(numberinput.validity.valid, 'Assigning to defaultValue should not affect input.validity.');
     35 }, 'Visible value and validity should not be affected when assigning to the defaultValue property for type=number.');
     36 </script>