
This CL moves third_party/WebKit/LayoutTests to third_party/blink/web_tests. NOTRY=true NOAUTOREVERT=true NOPRESUBMIT=true NOTREECHECKS=true TBR=robertma@chromium.org Bug: 843412 Change-Id: Ibb588b93d1579bcd1cb68df0a50efd8653f8724f Reviewed-on: https://chromium-review.googlesource.com/c/1328627 Reviewed-by: Kent Tamura <tkent@chromium.org> Commit-Queue: Kent Tamura <tkent@chromium.org> Cr-Commit-Position: refs/heads/master@{#610740}
63 lines
2.2 KiB
HTML
63 lines
2.2 KiB
HTML
<!DOCTYPE html>
|
|
<script src='../resources/testharness.js'></script>
|
|
<script src='../resources/testharnessreport.js'></script>
|
|
<script src="resources/shadow-dom.js"></script>
|
|
<div id='wrapper'>
|
|
<div id='node-in-document' tabindex=1></div>
|
|
<div id='shadow-host-1'>
|
|
<template data-mode='open'>
|
|
<div id='shadow-host-2'>
|
|
<template data-mode='open'>
|
|
<div id='child-in-shadow-root-2' tabindex=1></div>
|
|
</template>
|
|
</div>
|
|
<div id='child-in-shadow-root-1' tabindex=1></div>
|
|
<slot></slot>
|
|
</template>
|
|
<div id='slotted-child' tabindex=1></div>
|
|
</div>
|
|
</div>
|
|
<script>
|
|
'use strict';
|
|
convertTemplatesToShadowRootsWithin(wrapper);
|
|
|
|
const nodeInDocument = document.querySelector('#node-in-document');
|
|
const slottedChild = document.querySelector('#slotted-child');
|
|
|
|
const shadowHost1 = document.querySelector('#shadow-host-1');
|
|
const shadowRoot1 = shadowHost1.shadowRoot;
|
|
const childInShadowRoot1 = shadowRoot1.querySelector('#child-in-shadow-root-1');
|
|
|
|
const shadowHost2 = shadowRoot1.querySelector('#shadow-host-2');
|
|
const shadowRoot2 = shadowHost2.shadowRoot;
|
|
const childInShadowRoot2 = shadowRoot2.querySelector('#child-in-shadow-root-2');
|
|
|
|
test(() => {
|
|
nodeInDocument.focus();
|
|
assert_equals(document.activeElement, nodeInDocument);
|
|
assert_equals(shadowRoot1.activeElement, null);
|
|
assert_equals(shadowRoot2.activeElement, null);
|
|
}, "activeElement for a node in a document");
|
|
|
|
test(() => {
|
|
slottedChild.focus();
|
|
assert_equals(document.activeElement, slottedChild);
|
|
assert_equals(shadowRoot1.activeElement, null);
|
|
assert_equals(shadowRoot2.activeElement, null);
|
|
}, "activeElement for a slotted child");
|
|
|
|
test(() => {
|
|
childInShadowRoot1.focus();
|
|
assert_equals(document.activeElement, shadowHost1);
|
|
assert_equals(shadowRoot1.activeElement, childInShadowRoot1);
|
|
assert_equals(shadowRoot2.activeElement, null);
|
|
}, "activeElement for a node in a shadow tree");
|
|
|
|
test(() => {
|
|
childInShadowRoot2.focus();
|
|
assert_equals(document.activeElement, shadowHost1);
|
|
assert_equals(shadowRoot1.activeElement, shadowHost2);
|
|
assert_equals(shadowRoot2.activeElement, childInShadowRoot2);
|
|
}, "activeElement for a node in a nested shadow tree");
|
|
</script>
|