tor-browser

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

details-toggle-source.html (2046B)


      1 <!DOCTYPE html>
      2 <link rel=author href="mailto:jarhar@chromium.org">
      3 <link rel=help href="https://github.com/whatwg/html/issues/9111">
      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-vendor.js"></script>
      8 <script src="/resources/testdriver-actions.js"></script>
      9 <script src="../../popovers/resources/toggle-event-source-test.js"></script>
     10 
     11 <details id=details>
     12  <summary>summary</summary>
     13  details
     14 </details>
     15 
     16 <details id=detailsWithoutSummary>
     17  details without summary
     18 </details>
     19 
     20 <script>
     21 const details = document.getElementById('details');
     22 const detailsWithoutSummary = document.getElementById('detailsWithoutSummary');
     23 const summary = details.querySelector('summary');
     24 
     25 async function click(element) {
     26  // Click halfway up the element to click the activatable summary instead of
     27  // the details.
     28  const height = element.getBoundingClientRect().height;
     29  return (new test_driver.Actions()
     30    .pointerMove(0, -height / 2, {origin: element})
     31    .pointerDown()
     32    .pointerUp())
     33    .send();
     34 }
     35 
     36 createToggleEventSourceTest({
     37  description: 'ToggleEvent.source on <details> elements: details.open.',
     38  target: details,
     39  openFunc: async () => details.open = true,
     40  closeFunc: async () => details.open = false,
     41  openSource: null,
     42  closeSource: null,
     43  skipBeforetoggle: true
     44 });
     45 
     46 createToggleEventSourceTest({
     47  description: 'ToggleEvent.source on <details> elements: click summary.',
     48  target: details,
     49  openFunc: async () => summary.click(),
     50  closeFunc: async () => summary.click(),
     51  openSource: null,
     52  closeSource: null,
     53  skipBeforetoggle: true
     54 });
     55 
     56 createToggleEventSourceTest({
     57  description: 'ToggleEvent.source on <details> elements: click details.',
     58  target: detailsWithoutSummary,
     59  openFunc: async () => await click(detailsWithoutSummary),
     60  closeFunc: async () => await click(detailsWithoutSummary),
     61  openSource: null,
     62  closeSource: null,
     63  skipBeforetoggle: true
     64 });
     65 </script>