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

Unified Diff: chrome/test/data/webui/md_history/history_list_test.js

Issue 2334553002: [MD History] Add keyboard navigation to the main history list. (Closed)
Patch Set: address comments Created 4 years, 3 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: chrome/test/data/webui/md_history/history_list_test.js
diff --git a/chrome/test/data/webui/md_history/history_list_test.js b/chrome/test/data/webui/md_history/history_list_test.js
index af62f29e12db3f5f95a5cb2afdc4d5b8f6764c96..e670d7b096e0c45f390a700f7d024a99008031da 100644
--- a/chrome/test/data/webui/md_history/history_list_test.js
+++ b/chrome/test/data/webui/md_history/history_list_test.js
@@ -22,6 +22,7 @@ cr.define('md_history.history_list_test', function() {
createHistoryEntry('2016-03-14 9:00', 'https://www.google.com'),
createHistoryEntry('2016-03-13', 'https://en.wikipedia.org')
];
+ TEST_HISTORY_RESULTS[2].starred = true;
ADDITIONAL_RESULTS = [
createHistoryEntry('2016-03-13 10:00', 'https://en.wikipedia.org'),
@@ -510,6 +511,52 @@ cr.define('md_history.history_list_test', function() {
});
});
+ test('focus and keyboard nav', function() {
+ app.historyResult(createHistoryInfo(), TEST_HISTORY_RESULTS);
+ return flush().then(function() {
+ var items = polymerSelectAll(element, 'history-item');
+
+ var focused = items[2].$.checkbox;
+ focused.focus();
+
+ MockInteractions.pressAndReleaseKeyOn(focused, 39, [], 'ArrowRight');
+ focused = items[2].$.title;
+ assertEquals(focused, element.lastFocused_);
+ assertTrue(items[2].row_.isActive());
+ assertFalse(items[3].row_.isActive());
+
+ MockInteractions.pressAndReleaseKeyOn(focused, 40, [], 'ArrowDown');
+ focused = items[3].$.title;
+ assertEquals(focused, element.lastFocused_);
+ assertFalse(items[2].row_.isActive());
+ assertTrue(items[3].row_.isActive());
+
+ MockInteractions.pressAndReleaseKeyOn(focused, 39, [], 'ArrowRight');
+ focused = items[3].$['menu-button'];
+ assertEquals(focused, element.lastFocused_);
+ assertFalse(items[2].row_.isActive());
+ assertTrue(items[3].row_.isActive());
+
+ MockInteractions.pressAndReleaseKeyOn(focused, 38, [], 'ArrowUp');
+ focused = items[2].$['menu-button'];
+ assertEquals(focused, element.lastFocused_);
+ assertTrue(items[2].row_.isActive());
+ assertFalse(items[3].row_.isActive());
+
+ MockInteractions.pressAndReleaseKeyOn(focused, 37, [], 'ArrowLeft');
+ focused = items[2].$$('#bookmark-star');
+ assertEquals(focused, element.lastFocused_);
+ assertTrue(items[2].row_.isActive());
+ assertFalse(items[3].row_.isActive());
+
+ MockInteractions.pressAndReleaseKeyOn(focused, 40, [], 'ArrowDown');
+ focused = items[3].$.title;
+ assertEquals(focused, element.lastFocused_);
+ assertFalse(items[2].row_.isActive());
+ assertTrue(items[3].row_.isActive());
+ });
+ });
+
teardown(function() {
element.historyData_ = [];
registerMessageCallback('removeVisits', this, undefined);

Powered by Google App Engine
This is Rietveld 408576698