Chromium Code Reviews| 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 44c1b53a8a430fefbf42c7a5c532997cac15558e..4600fa29686dbbfe51051d2150f9cf95680beea5 100644 |
| --- a/chrome/test/data/webui/md_history/history_toolbar_test.js |
| +++ b/chrome/test/data/webui/md_history/history_toolbar_test.js |
| @@ -7,6 +7,7 @@ cr.define('md_history.history_toolbar_test', function() { |
| var TEST_HISTORY_RESULTS = [ |
| { |
| "dateRelativeDay": "Today - Wednesday, December 9, 2015", |
| + "title": "Google", |
| "url": "https://www.google.com" |
| } |
| ]; |
| @@ -22,7 +23,7 @@ cr.define('md_history.history_toolbar_test', function() { |
| }); |
| test('selecting checkbox causes toolbar to change', function() { |
| - element.addNewResults(TEST_HISTORY_RESULTS); |
| + element.addNewResults(TEST_HISTORY_RESULTS, ''); |
| flush(function() { |
| var item = element.$$('history-card').$$('history-item'); |
| @@ -45,7 +46,52 @@ cr.define('md_history.history_toolbar_test', function() { |
| }); |
| }); |
| + test('search term gathered correctly from toolbar', function(done) { |
|
tsergeant
2016/02/02 02:57:36
So many tests \o/
|
| + registerMessageCallback('queryHistory', this, function (info) { |
| + assertEquals(info[0], 'Test'); |
| + done(); |
| + }); |
| + |
| + toolbar.onSearchTermSearch('Test'); |
| + }); |
| + |
| + test('search results display with correct title', function(done) { |
| + element.addNewResults(TEST_HISTORY_RESULTS, 'Google'); |
| + |
| + flush(function() { |
| + var heading = element.$$('history-card').$$('#date-accessed'); |
| + var title = element.$$('history-card').$$('history-item').$['title']; |
| + |
| + assertEquals(heading.textContent, |
|
tsergeant
2016/02/02 02:57:36
This feels kinda brittle -- you're testing the pre
hsampson
2016/02/03 02:37:59
Done. Yup that's way better.
|
| + '\n Found 1 search result for \'Google\'.\n '); |
| + assertEquals(title.innerHTML, '<b>Google</b>'); |
| + done(); |
| + }); |
| + }); |
| + |
| + test('correct display message when no history available', function(done) { |
| + element.addNewResults([], ''); |
| + |
| + flush(function() { |
| + assertEquals(element.$$('#no-results').textContent, |
| + 'No history entries found.'); |
| + done(); |
| + }) |
| + }); |
| + |
| + test('correct display message when no search results returned', |
| + function(done) { |
| + element.addNewResults([], 'Test'); |
| + |
| + flush(function() { |
| + assertEquals(element.$$('#no-results').textContent, |
| + 'No search results found.'); |
| + done(); |
| + }) |
| + }); |
| + |
| teardown(function() { |
| + element.historyDataByDay_ = []; |
| toolbar.count = 0; |
| }); |
| }); |