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

Side by Side Diff: LayoutTests/fast/dom/shadow/focus-navigation-with-istabstop.html

Issue 917613004: Add isTabStop attribute to Element (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: revert status to experimental Created 5 years, 10 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
« no previous file with comments | « no previous file | LayoutTests/fast/dom/shadow/focus-navigation-with-istabstop-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <script src="../../../resources/js-test.js"></script>
5 <script src="resources/shadow-dom.js"></script>
6 </head>
7 <body>
8 <p>This tests TAB focus navigation with isTabStop property on elements</p>
9 <pre id="console"></pre>
10 <script>
11
12 function prepareDOMTree(parent) {
13 parent.appendChild(
14 createDOM('div', {'id': 'testform'},
15 createDOM('input', {'id': 'input-before'}),
16 createDOM('div', {'id': 'host-div'},
17 createShadowRoot(
18 createDOM('input', {'id': 'inner-input'}))),
19 createDOM('input', {'id': 'input-after'})));
20 parent.offsetTop;
21 }
22
23 var host_div;
24
25 function test() {
26 debug("Testing shadow host with possible combinations of tabindex and isTabS top");
27
28 debug("Normal tab order without tabindex");
29
30 host_div = document.getElementById("host-div");
31 shouldBe('host_div.isTabStop', 'false');
32
33 var expectedOrder = [
34 'input-before',
35 'host-div/inner-input',
36 'input-after'
37 ];
38
39 testFocusNavigationFowrad(expectedOrder);
40 expectedOrder.reverse();
41 testFocusNavigationBackward(expectedOrder);
42
43 debug("Normal tab order without tabindex but isTabStop=true");
44 host_div.isTabStop = true;
45
46 expectedOrder = [
47 'input-before',
48 'host-div/inner-input',
49 'input-after'
50 ];
51
52 testFocusNavigationFowrad(expectedOrder);
53 expectedOrder.reverse();
54 testFocusNavigationBackward(expectedOrder);
55
56 debug("Normal tab order with tabindex=0 on host");
57
58 host_div.tabIndex = 0;
59 shouldBeEqualToString('host_div.getAttribute("tabindex")', '0');
60 shouldBe('host_div.isTabStop', 'true');
61
62 expectedOrder = [
63 'input-before',
64 'host-div',
65 'host-div/inner-input',
66 'input-after'
67 ];
68
69 testFocusNavigationFowrad(expectedOrder);
70 expectedOrder.reverse();
71 testFocusNavigationBackward(expectedOrder);
72
73 debug("Normal tab order with tabindex=0 but isTabStop = false on host");
74 host_div.isTabStop = false;
75
76 expectedOrder = [
77 'input-before',
78 // 'host-div', // should skip host when isTabStop = false
79 'host-div/inner-input',
80 'input-after'
81 ];
82
83 testFocusNavigationFowrad(expectedOrder);
84 expectedOrder.reverse();
85 testFocusNavigationBackward(expectedOrder);
86
87 debug("Normal tab order with tabindex=-1 on host");
88
89 host_div.tabIndex = -1;
90 shouldBeEqualToString('host_div.getAttribute("tabindex")', '-1');
91 shouldBe('host_div.isTabStop', 'false');
92
93 expectedOrder = [
94 'input-before',
95 'host-div/inner-input',
96 'input-after'
97 ];
98
99 testFocusNavigationFowrad(expectedOrder);
100 expectedOrder.reverse();
101 testFocusNavigationBackward(expectedOrder);
102
103 debug("Normal tab order with tabindex=-1 but isTabStop=true on host");
104 host_div.isTabStop = true;
105
106 expectedOrder = [
107 'input-before',
108 'host-div/inner-input',
109 'input-after'
110 ];
111
112 testFocusNavigationFowrad(expectedOrder);
113 expectedOrder.reverse();
114 testFocusNavigationBackward(expectedOrder);
115
116 debug("Normal tab order with tabindex=1 on host");
117
118 host_div.tabIndex = 1;
119 shouldBeEqualToString('host_div.getAttribute("tabindex")', '1');
120 shouldBe('host_div.isTabStop', 'true');
121
122 expectedOrder = [
123 'input-before',
124 'input-after',
125 'host-div',
126 'host-div/inner-input'
127 ];
128
129 testFocusNavigationFowrad(expectedOrder);
130 expectedOrder.reverse();
131 testFocusNavigationBackward(expectedOrder);
132
133 debug("Normal tab order with tabindex=1 but isTabStop=false on host");
134 host_div.isTabStop = false;
135
136 expectedOrder = [
137 'input-before',
138 'input-after',
139 // 'host-div', // should skip host when isTabStop = false
140 'host-div/inner-input'
141 ];
142
143 testFocusNavigationFowrad(expectedOrder);
144 expectedOrder.reverse();
145 testFocusNavigationBackward(expectedOrder);
146 }
147
148 function run_tests() {
149 if (window.testRunner)
150 testRunner.dumpAsText();
151
152 if (!window.eventSender) {
153 testFailed('');
154 return;
155 }
156
157 prepareDOMTree(document.body);
158 test();
159
160 debug('Test finished.');
161 }
162
163 run_tests();
164 </script>
165 </body>
166 </html>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/fast/dom/shadow/focus-navigation-with-istabstop-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698