Index: third_party/WebKit/LayoutTests/imported/web-platform-tests/shadow-dom/untriaged/user-interaction/focus-navigation/test-001.html |
diff --git a/third_party/WebKit/LayoutTests/imported/web-platform-tests/shadow-dom/untriaged/user-interaction/focus-navigation/test-001.html b/third_party/WebKit/LayoutTests/imported/web-platform-tests/shadow-dom/untriaged/user-interaction/focus-navigation/test-001.html |
index 2724fd595e13b81a8cec7bd15758f0d31305e9c8..0f7198a1b291f0c836e177e2bd2ac55d38a46e14 100644 |
--- a/third_party/WebKit/LayoutTests/imported/web-platform-tests/shadow-dom/untriaged/user-interaction/focus-navigation/test-001.html |
+++ b/third_party/WebKit/LayoutTests/imported/web-platform-tests/shadow-dom/untriaged/user-interaction/focus-navigation/test-001.html |
@@ -16,7 +16,8 @@ policies and contribution forms [3]. |
<meta name="assert" content="User Interaction: The navigation order within a shadow tree must be computed as a list of focusable elements in tree order as-rendered"> |
<script src="../../../../../../resources/testharness.js"></script> |
<script src="../../../../../../resources/testharnessreport.js"></script> |
-<script src="../../testcommon.js"></script> |
+<script src="../../../../html/resources/common.js"></script> |
+<script src="../../../resources/shadow-dom-utils.js"></script> |
</head> |
<body> |
<div id="log"></div> |
@@ -25,60 +26,60 @@ var A_07_02_01_T01 = async_test('A_07_02_01_T01'); |
A_07_02_01_T01.step(unit(function (ctx) { |
- var counter = 0; |
+ var counter = 0; |
- var d = newRenderedHTMLDocument(ctx); |
+ var d = newRenderedHTMLDocument(ctx); |
- var chb1 = d.createElement('input'); |
- chb1.setAttribute('type', 'checkbox'); |
- chb1.setAttribute('id', 'chb1'); |
- chb1.addEventListener('focus', A_07_02_01_T01.step_func(function(event) { |
- assert_equals(counter++, 0, 'Point 1: wrong focus navigation order'); |
- }), false); |
- d.body.appendChild(chb1); |
+ var chb1 = d.createElement('input'); |
+ chb1.setAttribute('type', 'checkbox'); |
+ chb1.setAttribute('id', 'chb1'); |
+ chb1.addEventListener('focus', A_07_02_01_T01.step_func(function(event) { |
+ assert_equals(counter++, 0, 'Point 1: wrong focus navigation order'); |
+ }), false); |
+ d.body.appendChild(chb1); |
- var host = d.createElement('div'); |
- d.body.appendChild(host); |
- var s = host.createShadowRoot(); |
+ var host = d.createElement('div'); |
+ d.body.appendChild(host); |
+ var s = host.attachShadow({mode: 'open'}); |
- var inp1 = d.createElement('input'); |
- inp1.setAttribute('type', 'text'); |
- inp1.setAttribute('id', 'shInp1'); |
- inp1.setAttribute('value', 'Input 1'); |
- inp1.addEventListener('focus', A_07_02_01_T01.step_func(function(event) { |
- assert_equals(counter++, 1, 'Point 2: wrong focus navigation order'); |
- }), false); |
- s.appendChild(inp1); |
+ var inp1 = d.createElement('input'); |
+ inp1.setAttribute('type', 'text'); |
+ inp1.setAttribute('id', 'shInp1'); |
+ inp1.setAttribute('value', 'Input 1'); |
+ inp1.addEventListener('focus', A_07_02_01_T01.step_func(function(event) { |
+ assert_equals(counter++, 1, 'Point 2: wrong focus navigation order'); |
+ }), false); |
+ s.appendChild(inp1); |
- var inp2 = d.createElement('input'); |
- inp2.setAttribute('type', 'text'); |
- inp2.setAttribute('id', 'shInp2'); |
- inp2.setAttribute('value', 'Input 2'); |
- inp2.addEventListener('focus', A_07_02_01_T01.step_func(function(event) { |
- assert_equals(counter++, 2, 'Point 3: wrong focus navigation order'); |
- }), false); |
- s.appendChild(inp2); |
+ var inp2 = d.createElement('input'); |
+ inp2.setAttribute('type', 'text'); |
+ inp2.setAttribute('id', 'shInp2'); |
+ inp2.setAttribute('value', 'Input 2'); |
+ inp2.addEventListener('focus', A_07_02_01_T01.step_func(function(event) { |
+ assert_equals(counter++, 2, 'Point 3: wrong focus navigation order'); |
+ }), false); |
+ s.appendChild(inp2); |
- var chb2 = d.createElement('input'); |
- chb2.setAttribute('type', 'checkbox'); |
- chb2.setAttribute('id', 'chb2'); |
- chb2.addEventListener('focus', A_07_02_01_T01.step_func(function(event) { |
- assert_equals(counter++, 3, 'Point 4: wrong focus navigation order'); |
- }), false); |
- d.body.appendChild(chb2); |
+ var chb2 = d.createElement('input'); |
+ chb2.setAttribute('type', 'checkbox'); |
+ chb2.setAttribute('id', 'chb2'); |
+ chb2.addEventListener('focus', A_07_02_01_T01.step_func(function(event) { |
+ assert_equals(counter++, 3, 'Point 4: wrong focus navigation order'); |
+ }), false); |
+ d.body.appendChild(chb2); |
- chb1.focus(); |
+ chb1.focus(); |
- //simulate TAB clicks |
- fireKeyboardEvent(d, chb1, 'U+0009'); |
+ //simulate TAB clicks |
+ fireKeyboardEvent(d, chb1, 'U+0009'); |
- fireKeyboardEvent(d, inp1, 'U+0009'); |
+ fireKeyboardEvent(d, inp1, 'U+0009'); |
- fireKeyboardEvent(d, inp2, 'U+0009'); |
+ fireKeyboardEvent(d, inp2, 'U+0009'); |
- fireKeyboardEvent(d, chb2, 'U+0009'); |
+ fireKeyboardEvent(d, chb2, 'U+0009'); |
- A_07_02_01_T01.done(); |
+ A_07_02_01_T01.done(); |
})); |
</script> |
</body> |