tor-browser

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

time-focus-dynamic-value-change.html (1314B)


      1 <!doctype html>
      2 <meta charset=utf-8>
      3 <title>input type=date and input type=datetime handle focus state correctly</title>
      4 <link rel="help" href="https://html.spec.whatwg.org/multipage/input.html#time-state-(type=time)">
      5 <link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1450219">
      6 <link rel="author" title="Emilio Cobos Álvarez" href="mailto:emilio@crisal.io">
      7 <link rel="author" title="Mozilla" href="https://mozilla.org">
      8 <script src="/resources/testharness.js"></script>
      9 <script src="/resources/testharnessreport.js"></script>
     10 <input type="time">
     11 <input type="text">
     12 <script>
     13 let t = async_test("Time input handles focus correctly when value changes");
     14 window.onload = t.step_func_done(function() {
     15  let time = document.querySelector("input[type=time]");
     16  let text = document.querySelector("input[type=text]");
     17  time.focus();
     18  assert_true(time.matches(":focus"));
     19  assert_equals(document.activeElement, time);
     20  time.value = "08:10:10";
     21  assert_true(time.matches(":focus"));
     22  assert_equals(document.activeElement, time);
     23  time.value = "08:10";
     24  assert_true(time.matches(":focus"));
     25  assert_equals(document.activeElement, time);
     26  text.focus();
     27  assert_true(text.matches(":focus"));
     28  assert_false(time.matches(":focus"));
     29  assert_equals(document.activeElement, text);
     30 });
     31 </script>