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

Side by Side Diff: chrome/test/data/webui/md_history/history_toolbar_test.js

Issue 2118383003: MD History: add shortcuts for search (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: test change Created 4 years, 5 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 unified diff | Download patch
« no previous file with comments | « chrome/test/data/webui/md_history/history_overflow_menu_test.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 cr.define('md_history.history_toolbar_test', function() { 5 cr.define('md_history.history_toolbar_test', function() {
6 function registerTests() { 6 function registerTests() {
7 suite('history-toolbar', function() { 7 suite('history-toolbar', function() {
8 var app; 8 var app;
9 var element; 9 var element;
10 var toolbar; 10 var toolbar;
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 test('search term gathered correctly from toolbar', function(done) { 45 test('search term gathered correctly from toolbar', function(done) {
46 app.queryState_.queryingDisabled = false; 46 app.queryState_.queryingDisabled = false;
47 registerMessageCallback('queryHistory', this, function (info) { 47 registerMessageCallback('queryHistory', this, function (info) {
48 assertEquals(info[0], 'Test'); 48 assertEquals(info[0], 'Test');
49 done(); 49 done();
50 }); 50 });
51 51
52 toolbar.$$('cr-toolbar').fire('search-changed', 'Test'); 52 toolbar.$$('cr-toolbar').fire('search-changed', 'Test');
53 }); 53 });
54 54
55 test('shortcuts to open search field', function() {
56 var field = toolbar.$['main-toolbar'].getSearchField();
57 assertFalse(field.showingSearch);
58
59 MockInteractions.pressAndReleaseKeyOn(
60 document.body, 191, '', '/');
61 assertTrue(field.showingSearch);
62 assertEquals(field.$.searchInput, field.root.activeElement);
63
64 MockInteractions.pressAndReleaseKeyOn(
65 field.$.searchInput, 27, '', 'Escape');
66 assertFalse(field.showingSearch, 'Pressing escape closes field.');
67 assertNotEquals(field.$.searchInput, field.root.activeElement);
68
69 MockInteractions.pressAndReleaseKeyOn(
70 document.body, 70, 'ctrl', 'f');
71 assertTrue(field.showingSearch);
72 assertEquals(field.$.searchInput, field.root.activeElement);
73 });
74
55 teardown(function() { 75 teardown(function() {
56 element.historyData_ = []; 76 element.historyData_ = [];
57 element.searchedTerm = ''; 77 element.searchedTerm = '';
58 registerMessageCallback('queryHistory', this, undefined); 78 registerMessageCallback('queryHistory', this, undefined);
59 toolbar.count = 0; 79 toolbar.count = 0;
60 }); 80 });
61 }); 81 });
62 } 82 }
63 return { 83 return {
64 registerTests: registerTests 84 registerTests: registerTests
65 }; 85 };
66 }); 86 });
OLDNEW
« no previous file with comments | « chrome/test/data/webui/md_history/history_overflow_menu_test.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698