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

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

Issue 2126173002: [MD History] Add 2-way binding to query state. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@fix_shit
Patch Set: rebase 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/browser/resources/md_history/app.html ('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 27 matching lines...) Expand all
38 // toolbar decreases. 38 // toolbar decreases.
39 assertEquals(0, toolbar.count); 39 assertEquals(0, toolbar.count);
40 // Ensure that the toolbar boolean states that no items are selected. 40 // Ensure that the toolbar boolean states that no items are selected.
41 assertFalse(toolbar.itemsSelected_); 41 assertFalse(toolbar.itemsSelected_);
42 }); 42 });
43 }); 43 });
44 44
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('Test', info[0]);
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() { 55 test('shortcuts to open search field', function() {
56 var field = toolbar.$['main-toolbar'].getSearchField(); 56 var field = toolbar.$['main-toolbar'].getSearchField();
57 assertFalse(field.showingSearch); 57 assertFalse(field.showingSearch);
58 58
59 MockInteractions.pressAndReleaseKeyOn( 59 MockInteractions.pressAndReleaseKeyOn(
60 document.body, 191, '', '/'); 60 document.body, 191, '', '/');
61 assertTrue(field.showingSearch); 61 assertTrue(field.showingSearch);
62 assertEquals(field.$.searchInput, field.root.activeElement); 62 assertEquals(field.$.searchInput, field.root.activeElement);
63 63
64 MockInteractions.pressAndReleaseKeyOn( 64 MockInteractions.pressAndReleaseKeyOn(
65 field.$.searchInput, 27, '', 'Escape'); 65 field.$.searchInput, 27, '', 'Escape');
66 assertFalse(field.showingSearch, 'Pressing escape closes field.'); 66 assertFalse(field.showingSearch, 'Pressing escape closes field.');
67 assertNotEquals(field.$.searchInput, field.root.activeElement); 67 assertNotEquals(field.$.searchInput, field.root.activeElement);
68 68
69 MockInteractions.pressAndReleaseKeyOn( 69 MockInteractions.pressAndReleaseKeyOn(
70 document.body, 70, 'ctrl', 'f'); 70 document.body, 70, 'ctrl', 'f');
71 assertTrue(field.showingSearch); 71 assertTrue(field.showingSearch);
72 assertEquals(field.$.searchInput, field.root.activeElement); 72 assertEquals(field.$.searchInput, field.root.activeElement);
73 }); 73 });
74
75 test('spinner is active on search' , function(done) {
76 app.queryState_.queryingDisabled = false;
77 registerMessageCallback('queryHistory', this, function (info) {
78 assertTrue(toolbar.spinnerActive);
79 app.historyResult(createHistoryInfo(), TEST_HISTORY_RESULTS);
80 assertFalse(toolbar.spinnerActive);
81 done();
82 });
83
84 toolbar.$$('cr-toolbar').fire('search-changed', 'Test2');
85 });
74 86
75 teardown(function() { 87 teardown(function() {
76 element.historyData_ = []; 88 element.historyData_ = [];
77 element.searchedTerm = ''; 89 element.searchedTerm = '';
78 registerMessageCallback('queryHistory', this, undefined); 90 registerMessageCallback('queryHistory', this, undefined);
79 toolbar.count = 0; 91 toolbar.count = 0;
80 }); 92 });
81 }); 93 });
82 } 94 }
83 return { 95 return {
84 registerTests: registerTests 96 registerTests: registerTests
85 }; 97 };
86 }); 98 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/md_history/app.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698