Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/shadow-dom/slot-fallback-focus.html |
| diff --git a/third_party/WebKit/LayoutTests/shadow-dom/slot-fallback-focus.html b/third_party/WebKit/LayoutTests/shadow-dom/slot-fallback-focus.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..916756d334778352214c630973e7533dc67d33e3 |
| --- /dev/null |
| +++ b/third_party/WebKit/LayoutTests/shadow-dom/slot-fallback-focus.html |
| @@ -0,0 +1,55 @@ |
| +<!DOCTYPE html> |
| +<script src='../resources/testharness.js'></script> |
| +<script src='../resources/testharnessreport.js'></script> |
| +<script src='../fast/dom/shadow/resources/shadow-dom.js'></script> |
| +<script src='resources/shadow-dom.js'></script> |
| +<div id="log"></div> |
| +<p> |
| + document tree: [i0 -> [x-foo]]<br> |
| + x-foo's shadow tree: [[x-bar]]<br> |
| + x-bar's shadow tree: [j1 -> j2 -> [s1]]<br> |
| + <b>slot #s1: [k1 -> k0 -> [s2]]</b><br> |
| + slot #s2: [i1 -> i2]<br><br> |
| + <b>v1 ideal nav forward: [i0 -> j1 -> j2 -> k1 -> k0 -> i1 -> i2]</b><br> |
| +</p> |
| + |
| +<input id="i0" tabindex=0 value="i0"> |
| +<div id="x-foo"> |
| + <input id="i2" slot="s2" tabindex=2 value="i2"> |
| + <input id="i1" slot="s2" tabindex=1 value="i1"> |
| + <template data-mode="open"> |
| + <div id="x-bar"> |
| + <input id="j1" tabindex=1 value="j1"> |
| + <slot id="s1" name="s1"> <!-- This slot does not have any assigned elements --> |
| + <input id="k0" tabindex=0 value="k0"> |
| + <input id="k1" tabindex=1 value="k1"> |
| + <slot id="s2" name="s2"></slot> |
| + </slot> |
| + <input id="j2" tabindex=2 value="j2"> |
| + </div> |
| + </template> |
| +</div> |
|
kochi
2016/03/30 06:28:33
Can you add more test cases to be more comprehensi
yuzuchan
2016/03/31 07:03:46
Thanks for the feedback! By adding the testcases s
kochi
2016/04/01 06:10:59
Cool!
|
| + |
| +<script> |
| + |
| +test(function() { |
| + var xfoo = document.getElementById('x-foo'); |
| + convertTemplatesToShadowRootsWithin(xfoo); |
| + var elements = [ |
| + 'i0', |
| + 'x-foo/j1', |
| + 'x-foo/j2', |
| + 'x-foo/k1', |
| + 'x-foo/k0', |
| + 'i1', |
| + 'i2' |
| + ]; |
|
kochi
2016/03/30 06:28:34
Could you also check a case with the same tree str
yuzuchan
2016/03/31 07:03:46
Not with the same tree structure, but I added a fo
|
| + |
| + for (var i = 0; i + 1 < elements.length; ++i) |
| + assert_true(shouldNavigateFocus(elements[i], elements[i + 1], 'forward'), elements[i]+" to "+ elements[i+1]); |
|
kochi
2016/03/30 06:28:33
nit: use single quote for string literal and space
yuzuchan
2016/03/31 07:03:46
Done.
|
| + elements.reverse(); |
| + for (var i = 0; i + 1 < elements.length; ++i) |
| + assert_true(shouldNavigateFocus(elements[i], elements[i + 1], 'backward'), elements[i]+" to "+ elements[i+1]); |
|
kochi
2016/03/30 06:28:33
nit: ditto.
yuzuchan
2016/03/31 07:03:46
Done.
|
| +}, 'Focus should jump to fallback elements when a slot does not have any assigned nodes.'); |
| + |
| +</script> |