Auto-expand details elements for element fragments

Since the AutoExpandDetailsElement feature is disabled right now due to
crbug.com/1236774 the test fails, but with the feature enabled, the test
passes.

Bug: 1185950
Change-Id: Ib22dab04ebeff329c76a3ccf220945fd850deaaf
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2858768
Auto-Submit: Joey Arhar <jarhar@chromium.org>
Reviewed-by: Mason Freed <masonf@chromium.org>
Commit-Queue: Joey Arhar <jarhar@chromium.org>
Cr-Commit-Position: refs/heads/master@{#913060}
diff --git a/html/semantics/interactive-elements/the-details-element/auto-expand-details-element-fragment.html b/html/semantics/interactive-elements/the-details-element/auto-expand-details-element-fragment.html
new file mode 100644
index 0000000..d3d04f0
--- /dev/null
+++ b/html/semantics/interactive-elements/the-details-element/auto-expand-details-element-fragment.html
@@ -0,0 +1,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>