3 Distributed under both the W3C Test Suite License [1] and the W3C
4 3-clause BSD License [2]. To contribute to a W3C Test Suite, see the
5 policies and contribution forms [3].
7 [1] http://www.w3.org/Consortium/Legal/2008/04-testsuite-license
8 [2] http://www.w3.org/Consortium/Legal/2008/03-bsd-license
9 [3] http://www.w3.org/2004/10/27-testcases
13 <title>Shadow DOM Test: Confirm activeElement return null</title>
14 <link rel="author" title="Sergey G. Grekhov" href="mailto:sgrekhov@unipro.ru">
15 <link rel="author" title="Masaya Iseki" href="mailto:iseki.m.aa@gmail.com">
16 <link rel="help" href="http://w3c.github.io/webcomponents/spec/shadow/#attributes">
17 <meta name="assert" content="ShadowRoot Object: confirm activeElement return null">
18 <script src="../../../../../../resources/testharness.js"></script>
19 <script src="../../../../../../resources/testharnessreport.js"></script>
20 <script src="../../../testcommon.js"></script>
21 <link rel="stylesheet" href="../../../../../../resources/testharness.css">
26 test(unit(function (ctx) {
28 var d = newRenderedHTMLDocument(ctx);
30 var host = d.createElement('div');
31 d.body.appendChild(host);
32 var s = host.createShadowRoot();
34 assert_equals(s.activeElement, null, 'activeElement attribute of the ShadowRoot must return null if there\'s no focused element');
36 }), 'confirm activeElement return null');
39 test(unit(function (ctx) {
41 var d = newRenderedHTMLDocument(ctx);
43 var host = d.createElement('div');
44 d.body.appendChild(host);
45 var s = host.createShadowRoot();
47 var inp = d.createElement('input');
48 d.body.appendChild(inp);
52 assert_equals(s.activeElement, null, 'activeElement attribute of the ShadowRoot must return null if there\'s no focused element in the shadow tree');
54 }), 'confirm activeElement return null when there is other element in body');
57 test(unit(function (ctx) {
59 var d = newRenderedHTMLDocument(ctx);
61 var host = d.createElement('div');
62 d.body.appendChild(host);
63 var s = host.createShadowRoot();
65 var inp = d.createElement('input');
66 d.body.appendChild(inp);
68 var inp2 = d.createElement('input');
73 assert_equals(s.activeElement, null, 'activeElement attribute of the ShadowRoot must return null if there\'s no focused element in the shadow tree');
75 }), 'confirm activeElement return null when focus on the element in the outer shadow tree');