Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(63)

Side by Side Diff: LayoutTests/fast/dom/shadow/focus-shadowhost-display-none.html

Issue 1144953007: Remove tabStop feature (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebase Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <script src="../../../resources/js-test.js"></script>
3 <style>
4 div#host:focus { display: none; }
5 </style>
6 <div id="host"></div>
7 <script>
8 description('Check if shadow host with display:none CSS rule for :focus works. crbug.com/482830');
9
10 var root = host.createShadowRoot();
11 var input = document.createElement('input');
12 root.appendChild(input);
13
14 host.tabIndex = 0;
15 host.tabStop = true;
16
17 function testFocusShadowHost() {
18 debug('when shadow host itself is focused, it should match display:none, los e focus then becomes display:block again.');
19 return new Promise(
20 function(resolve) {
21 host.focus();
22 shouldBeEqualToString('window.getComputedStyle(host).display', 'none ');
23 shouldBe('document.activeElement', 'host');
24 shouldBeNull('root.activeElement');
25
26 function onBlur() {
27 shouldBeEqualToString('window.getComputedStyle(host).display', ' block');
28 shouldBe('document.activeElement', 'document.body');
29 shouldBeNull('root.activeElement');
30 host.removeEventListener('blur', onBlur);
31 resolve();
32 }
33 host.addEventListener('blur', onBlur);
34 });
35 }
36
37 function testFocusInsideShadowRoot() {
38 debug('when shadow host with tabStop=false has focused element inside the sh adow, it should also match display:none, then lose focus and become display:bloc k again.');
39 return new Promise(
40 function(resolve) {
41 host.tabStop = false;
42 input.focus();
43 shouldBeEqualToString('window.getComputedStyle(host).display', 'none ');
44 shouldBe('document.activeElement', 'host');
45 shouldBe('root.activeElement', 'input');
46
47 function onBlur() {
48 shouldBeEqualToString('window.getComputedStyle(host).display', ' block');
49 shouldBe('document.activeElement', 'document.body');
50 shouldBeNull('root.activeElement');
51 input.removeEventListener('blur', onBlur);
52 resolve();
53 }
54 input.addEventListener('blur', onBlur);
55 });
56 }
57
58 if (window.testRunner) {
59 testFocusShadowHost().then(testFocusInsideShadowRoot).then(function(){ testR unner.notifyDone(); });
60 testRunner.waitUntilDone();
61 }
62 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698