summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/semantics/interactive-elements/the-details-element/auto-expand-details-element-fragment.html
blob: d3d04f07a182f5689ce62f31b7864ff0d8d7112d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<!DOCTYPE html>
<link rel="author" title="Joey Arhar" href="mailto:jarhar@chromium.org">
<link rel="help" href="https://github.com/whatwg/html/pull/6466">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>

<div style="height:2000px">spacer</div>

<details id=details>
  <div id=target>target</div>
</details>

<script>
async_test(t => {
  assert_false(details.hasAttribute('open'),
    `The <details> should be closed at the start of the test.`);
  assert_equals(window.pageYOffset, 0,
    `The page should be scrolled to the top at the start of the test.`);

  window.location.hash = '#target';

  requestAnimationFrame(t.step_func_done(() => {
    assert_true(details.hasAttribute('open'),
      `<details> should be opened by navigating to an element inside it.`);
    assert_not_equals(window.pageYOffset, 0,
      `The page should be scrolled down to the <details> element.`);
  }));
});
</script>