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

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: rebase 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
« no previous file with comments | « chrome/browser/resources/md_history/history_list.js ('k') | ui/webui/resources/js/cr/ui/focus_row.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 9ff3f3281f473d6e6b545c8ac503079142b8a3b2..2df6533405169c327f85a3a744d09bed6384e31d 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'),
@@ -503,6 +504,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);
« no previous file with comments | « chrome/browser/resources/md_history/history_list.js ('k') | ui/webui/resources/js/cr/ui/focus_row.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698