| Index: LayoutTests/fast/dom/shadow/focus-navigation-with-istabstop.html
|
| diff --git a/LayoutTests/fast/dom/shadow/focus-navigation-with-istabstop.html b/LayoutTests/fast/dom/shadow/focus-navigation-with-istabstop.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..1efe6dd531bd17bf5dc24f4a838bc8cbaccb8bd4
|
| --- /dev/null
|
| +++ b/LayoutTests/fast/dom/shadow/focus-navigation-with-istabstop.html
|
| @@ -0,0 +1,164 @@
|
| +<!DOCTYPE html>
|
| +<html>
|
| +<head>
|
| +<script src="../../../resources/js-test.js"></script>
|
| +<script src="resources/shadow-dom.js"></script>
|
| +</head>
|
| +<body>
|
| +<p>This tests TAB focus navigation with isTabStop property on elements</p>
|
| +<pre id="console"></pre>
|
| +<script>
|
| +
|
| +function prepareDOMTree(parent) {
|
| + parent.appendChild(
|
| + createDOM('div', {'id': 'testform'},
|
| + createDOM('input', {'id': 'input-before'}),
|
| + createDOM('div', {'id': 'host'},
|
| + createShadowRoot(
|
| + createDOM('input', {'id': 'inner-input'}))),
|
| + createDOM('input', {'id': 'input-after'})));
|
| + parent.offsetTop;
|
| +}
|
| +
|
| +function test() {
|
| + debug("Testing shadow host with possible combinations of tabindex and isTabStop");
|
| +
|
| + var host = document.getElementById('host');
|
| +
|
| + debug("Normal tab order without tabindex");
|
| + shouldBe('host.isTabStop', 'false');
|
| +
|
| + var expected_nav = [
|
| + 'input-before',
|
| + 'host/inner-input',
|
| + 'input-after'
|
| + ];
|
| +
|
| + testFocusNavigationFowrad(expected_nav);
|
| + expected_nav.reverse();
|
| + testFocusNavigationBackward(expected_nav);
|
| +
|
| + debug("Normal tab order without tabindex but isTabStop=true");
|
| + host.isTabStop = true;
|
| +
|
| + var expected_nav = [
|
| + 'input-before',
|
| + 'host/inner-input',
|
| + 'input-after'
|
| + ];
|
| +
|
| + testFocusNavigationFowrad(expected_nav);
|
| + expected_nav.reverse();
|
| + testFocusNavigationBackward(expected_nav);
|
| +
|
| + debug("Normal tab order with tabindex=0 on host");
|
| +
|
| + host.tabIndex = 0;
|
| + shouldBeEqualToString('host.getAttribute("tabindex")', '0');
|
| + shouldBe('host.isTabStop', 'true');
|
| +
|
| + expected_nav = [
|
| + 'input-before',
|
| + 'host',
|
| + 'host/inner-input',
|
| + 'input-after'
|
| + ];
|
| +
|
| + testFocusNavigationFowrad(expected_nav);
|
| + expected_nav.reverse();
|
| + testFocusNavigationBackward(expected_nav);
|
| +
|
| + debug("Normal tab order with tabindex=0 but isTabStop = false on host");
|
| + host.isTabStop = false;
|
| +
|
| + expected_nav = [
|
| + 'input-before',
|
| + // 'host', // should skip host when isTabStop = false
|
| + 'host/inner-input',
|
| + 'input-after'
|
| + ];
|
| +
|
| + testFocusNavigationFowrad(expected_nav);
|
| + expected_nav.reverse();
|
| + testFocusNavigationBackward(expected_nav);
|
| +
|
| + debug("Normal tab order with tabindex=-1 on host");
|
| +
|
| + host.tabIndex = -1;
|
| + shouldBeEqualToString('host.getAttribute("tabindex")', '-1');
|
| + shouldBe('host.isTabStop', 'false');
|
| +
|
| + expected_nav = [
|
| + 'input-before',
|
| + 'host/inner-input',
|
| + 'input-after'
|
| + ];
|
| +
|
| + testFocusNavigationFowrad(expected_nav);
|
| + expected_nav.reverse();
|
| + testFocusNavigationBackward(expected_nav);
|
| +
|
| + debug("Normal tab order with tabindex=-1 but isTabStop=true on host");
|
| + host.isTabStop = true;
|
| +
|
| + expected_nav = [
|
| + 'input-before',
|
| + 'host/inner-input',
|
| + 'input-after'
|
| + ];
|
| +
|
| + testFocusNavigationFowrad(expected_nav);
|
| + expected_nav.reverse();
|
| + testFocusNavigationBackward(expected_nav);
|
| +
|
| + debug("Normal tab order with tabindex=1 on host");
|
| +
|
| + host.tabIndex = 1;
|
| + shouldBeEqualToString('host.getAttribute("tabindex")', '1');
|
| + shouldBe('host.isTabStop', 'true');
|
| +
|
| + expected_nav = [
|
| + 'input-before',
|
| + 'input-after',
|
| + 'host',
|
| + 'host/inner-input'
|
| + ];
|
| +
|
| + testFocusNavigationFowrad(expected_nav);
|
| + expected_nav.reverse();
|
| + testFocusNavigationBackward(expected_nav);
|
| +
|
| + debug("Normal tab order with tabindex=1 but isTabStop=false on host");
|
| + host.isTabStop = false;
|
| +
|
| + expected_nav = [
|
| + 'input-before',
|
| + 'input-after',
|
| + // 'host', // should skip host when isTabStop = false
|
| + 'host/inner-input'
|
| + ];
|
| +
|
| + testFocusNavigationFowrad(expected_nav);
|
| + expected_nav.reverse();
|
| + testFocusNavigationBackward(expected_nav);
|
| +}
|
| +
|
| +function run_tests() {
|
| + if (window.testRunner)
|
| + testRunner.dumpAsText();
|
| +
|
| + if (!window.eventSender) {
|
| + testFailed('');
|
| + return;
|
| + }
|
| +
|
| + prepareDOMTree(document.body);
|
| + test();
|
| +
|
| + debug('Test finished.');
|
| +}
|
| +
|
| +run_tests();
|
| +</script>
|
| +</body>
|
| +</html>
|
|
|