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

Unified Diff: third_party/WebKit/LayoutTests/fast/events/sequential-focus-navigation-starting-point.html

Issue 1718153002: Implement 'sequential focus navigation starting point.' (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Actual fix for non-oilpan test failures Created 4 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/fast/events/sequential-focus-navigation-starting-point.html
diff --git a/third_party/WebKit/LayoutTests/fast/events/sequential-focus-navigation-starting-point.html b/third_party/WebKit/LayoutTests/fast/events/sequential-focus-navigation-starting-point.html
new file mode 100644
index 0000000000000000000000000000000000000000..a1dfa660433813e9f3cdcd6ae234499d75bbfaba
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fast/events/sequential-focus-navigation-starting-point.html
@@ -0,0 +1,58 @@
+<!DOCTYPE html>
+<body>
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
+<script src="../forms/resources/common.js"></script>
+<div id="log"></div>
+<div id="container"></div>
+<script>
+if (!window.eventSender)
+ document.body.textContent = 'This test requires window.eventSender.';
+
+test(function() {
+ var container = document.querySelector('#container');
+ container.innerHTML = '<input id=prev><div style="height:200px;"><span>text</span></div><input id=next>';
+ hoverOverElement(container.querySelector('span'));
+ eventSender.mouseDown();
+ eventSender.keyDown('\t');
+ assert_equals(document.activeElement.id, 'next');
+
+ hoverOverElement(container.querySelector('div'));
+ eventSender.mouseDown();
+ eventSender.keyDown('\t', ['shiftKey']);
+ assert_equals(document.activeElement.id, 'prev');
+}, 'Mouse press should update sequential focus navigation starting point.');
+
+test(function() {
+ var container = document.querySelector('#container');
+ container.innerHTML = '<a href="#fragment"></a><input id=prev><a name="fragment"></a><input id=next>';
+ container.querySelector('a').click();
+ eventSender.keyDown('\t');
+ assert_equals(document.activeElement.id, 'next');
+}, 'Fragment navigation should update sequential focus navigation starting point.');
+
+test(function() {
+ var container = document.querySelector('#container');
+ container.innerHTML = '<input id=prev><input id=start><input id=next>';
+ container.querySelector('#start').focus();
+ container.querySelector('#start').blur();
+ eventSender.keyDown('\t');
+ assert_equals(document.activeElement.id, 'next');
+}, 'Focusing an element should update sequential focus navigation starting point.');
+
+test(function() {
+ var container = document.querySelector('#container');
+ container.innerHTML = '<input id=prev><input id=start><input id=next>';
+ container.querySelector('#start').focus();
+ container.querySelector('#start').remove();
+ eventSender.keyDown('\t');
+ assert_equals(document.activeElement.id, 'next');
+
+ container.innerHTML = '<input id=prev><input id=start><input id=next>';
+ container.querySelector('#start').focus();
+ container.querySelector('#start').remove();
+ eventSender.keyDown('\t', ['shiftKey']);
+ assert_equals(document.activeElement.id, 'prev');
+}, 'After removing a focused element from the documen tree, sequential focus navigation should start at a place where the focused element was.');
+</script>
+</body>

Powered by Google App Engine
This is Rietveld 408576698