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 6e0cded808a621d55488a78309da20b80a090aea..0d79836e2b1e5128abed1420490443f6985fb479 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(done) { |
| - element.addNewResults(TEST_HISTORY_RESULTS); |
| + element.addNewResults(TEST_HISTORY_RESULTS, ''); |
| flush(function() { |
| var item = element.$$('history-card').$$('history-item'); |
| @@ -47,7 +48,58 @@ cr.define('md_history.history_toolbar_test', function() { |
| }); |
| }); |
| + test('search term gathered correctly from toolbar', function(done) { |
| + 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').textContent; |
| + var title = element.$$('history-card').$$('history-item').$.title; |
| + |
| + var index = heading.search('Found 1 search result for \'Google\'.'); |
|
tsergeant
2016/02/04 02:28:50
Use .indexOf instead of search. indexOf uses a lit
hsampson
2016/02/08 04:40:23
Done.
|
| + |
| + assertTrue(0 <= index); |
|
tsergeant
2016/02/04 02:28:50
Probably assertTrue(index != -1), which is the nor
hsampson
2016/02/08 04:40:23
Done.
|
| + assertEquals(title.innerHTML, '<b>Google</b>'); |
| + done(); |
| + }); |
| + }); |
| + |
| + test('correct display message when no history available', function(done) { |
| + element.addNewResults([], ''); |
| + |
| + flush(function() { |
| + var message = element.$$('#no-results').textContent; |
| + var index = message.search('No history entries found.'); |
|
tsergeant
2016/02/04 02:28:49
As above
hsampson
2016/02/08 04:40:23
Done.
|
| + |
| + assertTrue(0 <= index); |
| + done(); |
| + }) |
| + }); |
| + |
| + test('correct display message when no search results returned', |
| + function(done) { |
| + element.addNewResults([], 'Test'); |
| + |
| + flush(function() { |
| + var message = element.$$('#no-results').textContent; |
| + var index = message.search('No search results found.'); |
|
tsergeant
2016/02/04 02:28:50
As above
hsampson
2016/02/08 04:40:23
Done.
|
| + |
| + assertTrue(0 <= index); |
| + done(); |
| + }) |
| + }); |
| + |
| teardown(function() { |
| + element.historyDataByDay_ = []; |
| toolbar.count = 0; |
| }); |
| }); |