tor-browser

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

radio-group-valueMissing.html (1677B)


      1 <!DOCTYPE html>
      2 <meta charset="utf-8" />
      3 <title>
      4  The constraint validation API Test: element.validity.valueMissing for radio
      5  group
      6 </title>
      7 <link rel="author" title="Emmanuel Elom" href="mailto:elomemmanuel007@gmail.com">
      8 <link
      9  rel="help"
     10  href="https://html.spec.whatwg.org/multipage/#dom-validitystate-valuemissing"
     11 />
     12 <link
     13  rel="help"
     14  href="https://html.spec.whatwg.org/multipage/#the-constraint-validation-api"
     15 />
     16 <script src="/resources/testharness.js"></script>
     17 <script src="/resources/testharnessreport.js"></script>
     18 <script src="support/validator.js"></script>
     19 <div id="log"></div>
     20 
     21 <input type="radio" id="first" required name="group" />
     22 <input type="radio" id="second" checked name="group" />
     23 <input type="radio" id="third" required name="group1" />
     24 <input type="radio" id="fourth" name="group1" />
     25 
     26 <script>
     27  const first = document.getElementById("first");
     28  const second = document.getElementById("second");
     29  const third = document.getElementById("third");
     30  const fourth = document.getElementById("fourth");
     31 
     32  test(() => {
     33    assert_equals(first.validity.valueMissing, false);
     34    assert_equals(second.validity.valueMissing, false);
     35    second.remove();
     36    assert_equals(first.validity.valueMissing, true);
     37  }, "valueMissing is true for all group members when checked group member is removed");
     38 
     39  test(() => {
     40    assert_equals(third.validity.valueMissing, true);
     41    assert_equals(fourth.validity.valueMissing, true);
     42    fourth.click();
     43    assert_equals(third.validity.valueMissing, false);
     44    assert_equals(fourth.validity.valueMissing, false);
     45  }, "valueMissing is false for all group members when any group member is checked");
     46 </script>