tor-browser

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

select-pseudo-light-dismiss-invalidation.html (1792B)


      1 <!DOCTYPE html>
      2 <link rel=author href="mailto:jarhar@chromium.org">
      3 <link rel=help href="http://crbug.com/1429839">
      4 <script src="/resources/testharness.js"></script>
      5 <script src="/resources/testharnessreport.js"></script>
      6 <script src="/resources/testdriver.js"></script>
      7 <script src="/resources/testdriver-actions.js"></script>
      8 <script src="/resources/testdriver-vendor.js"></script>
      9 
     10 <select id=select>
     11  <option id=optone>one</option>
     12  <option id=opttwo>two</option>
     13 </select>
     14 <style>
     15 select {
     16  background-color: rgb(0, 0, 255);
     17 }
     18 select:not(:open) {
     19  background-color: rgb(0, 255, 0);
     20 }
     21 select:open {
     22  background-color: rgb(255, 0, 0);
     23 }
     24 select, ::picker(select) {
     25  appearance: base-select;
     26 }
     27 </style>
     28 <button id=button>option</button>
     29 
     30 <script>
     31 function click(element) {
     32  return (new test_driver.Actions()
     33    .pointerMove(0, 0, {origin: element})
     34    .pointerDown()
     35    .pointerUp())
     36    .send();
     37 }
     38 
     39 promise_test(async () => {
     40  assert_equals(getComputedStyle(select).backgroundColor, 'rgb(0, 255, 0)',
     41    'The select should match :not(:open) at the start of the test.');
     42 
     43  await click(select);
     44  assert_equals(getComputedStyle(select).backgroundColor, 'rgb(255, 0, 0)',
     45    'The select should match :open when opened.');
     46 
     47  await click(opttwo);
     48  assert_equals(getComputedStyle(select).backgroundColor, 'rgb(0, 255, 0)',
     49    'The select should match :not(:open) after clicking an option.');
     50 
     51  await click(select);
     52  assert_equals(getComputedStyle(select).backgroundColor, 'rgb(255, 0, 0)',
     53    'The select should match :open when reopened.');
     54 
     55  await click(button);
     56  assert_equals(getComputedStyle(select).backgroundColor, 'rgb(0, 255, 0)',
     57    'The select should match :not(:open) after light dismiss.');
     58 }, 'select should not match :open when light dismissed.');
     59 </script>