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

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

Issue 2237703004: [MD History] Focus the search bar on load. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 4 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_toolbar_test.js
diff --git a/chrome/test/data/webui/md_history/history_toolbar_test.js b/chrome/test/data/webui/md_history/history_toolbar_test.js
index 50ecea196f3d3c62153155e39bdeeb7def48a5d6..50b7265ee7e00dc017ddd536dbe1c42e8d790f4b 100644
--- a/chrome/test/data/webui/md_history/history_toolbar_test.js
+++ b/chrome/test/data/webui/md_history/history_toolbar_test.js
@@ -54,6 +54,7 @@ cr.define('md_history.history_toolbar_test', function() {
test('shortcuts to open search field', function() {
var field = toolbar.$['main-toolbar'].getSearchField();
+ field.blur();
assertFalse(field.showingSearch);
MockInteractions.pressAndReleaseKeyOn(
@@ -100,3 +101,54 @@ cr.define('md_history.history_toolbar_test', function() {
registerTests: registerTests
};
});
+
+
+cr.define('md_history.history_toolbar_focus_test', function() {
+ function registerTests() {
+ suite('history-toolbar', function() {
+ var app;
+ var element;
+ var toolbar;
+ var TEST_HISTORY_RESULTS =
+ [createHistoryEntry('2016-03-15', 'https://google.com')];
+ ;
+
+ setup(function() {
+ app = replaceApp();
+
+ element = app.$['history'].$['infinite-list'];
+ toolbar = app.$['toolbar'];
+ });
+
+ test('search bar is focused on load in wide mode', function() {
+ window.resultsRendered = false;
+ app.hasDrawer_ = false;
+
+ historyResult(createHistoryInfo(), []);
+ return flush().then(() => {
+ // Ensure the search bar is focused on load.
+ assertTrue(
+ app.$.toolbar.$['main-toolbar']
+ .getSearchField()
+ .isSearchFocused());
+ });
+ });
+
+ test('search bar is not focused on load in narrow mode', function() {
+ app.hasDrawer_ = true;
+
+ historyResult(createHistoryInfo(), []);
+ // Ensure the search bar is focused on load.
+ assertFalse(
+ $('history-app')
+ .$.toolbar.$['main-toolbar']
+ .getSearchField()
+ .isSearchFocused());
+ });
+ });
+ };
+
+ return {
+ registerTests: registerTests
+ };
+});
« no previous file with comments | « chrome/browser/resources/md_history/history.js ('k') | chrome/test/data/webui/md_history/md_history_browsertest.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698