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

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

Issue 1643693003: MD History: Implement search functionality. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@patch_to_be_uploaded
Patch Set: Fix time-gap-separator insertion. Created 4 years, 10 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_card_manager_test.js
diff --git a/chrome/test/data/webui/md_history/history_card_manager_test.js b/chrome/test/data/webui/md_history/history_card_manager_test.js
index 3b19e2b1fdfe68e45bd0cbb82a3c0fae33be4599..5a5491230ba54f3e3c8acd50dffc0fb2f016b00a 100644
--- a/chrome/test/data/webui/md_history/history_card_manager_test.js
+++ b/chrome/test/data/webui/md_history/history_card_manager_test.js
@@ -7,21 +7,25 @@ cr.define('md_history.history_card_manager_test', function() {
var TEST_HISTORY_RESULTS = [
{
"dateRelativeDay": "Today - Wednesday, December 9, 2015",
+ "title": "Google",
"url": "https://www.google.com",
"allTimestamps": "1",
},
{
"dateRelativeDay": "Yesterday - Tuesday, December 8, 2015",
+ "title": "Wikipedia",
"url": "https://en.wikipedia.com",
"allTimestamps": "2"
},
{
"dateRelativeDay": "Monday, December 7, 2015",
+ "title": "Example",
"url": "https://www.example.com",
"allTimestamps": "3"
},
{
"dateRelativeDay": "Monday, December 7, 2015",
+ "title": "Google",
"url": "https://www.google.com",
"allTimestamps": "4"
}
@@ -58,11 +62,8 @@ cr.define('md_history.history_card_manager_test', function() {
items = [];
});
- setup(function() {
- element.addNewResults(TEST_HISTORY_RESULTS);
- });
-
test('splitting items by day', function() {
+ element.addNewResults(TEST_HISTORY_RESULTS, '');
assertEquals(3, element.historyDataByDay_.length);
// Ensure that the output is in reversed date order.
@@ -79,6 +80,7 @@ cr.define('md_history.history_card_manager_test', function() {
});
test('cancelling selection of multiple items', function(done) {
+ element.addNewResults(TEST_HISTORY_RESULTS, '');
flush(function() {
var cards = Polymer.dom(element.root)
.querySelectorAll('history-card');
@@ -112,7 +114,8 @@ cr.define('md_history.history_card_manager_test', function() {
});
test('updating history results', function() {
- element.addNewResults(ADDITIONAL_RESULTS);
+ element.addNewResults(TEST_HISTORY_RESULTS, '');
+ element.addNewResults(ADDITIONAL_RESULTS, '');
assertEquals(5, element.historyDataByDay_.length);
@@ -136,6 +139,7 @@ cr.define('md_history.history_card_manager_test', function() {
});
test('removeVisits for multiple items', function(done) {
+ element.addNewResults(TEST_HISTORY_RESULTS, '');
// Ensure that the correct identifying data is being used for removal.
registerMessageCallback('removeVisits', this, function (toBeRemoved) {
assertEquals(toBeRemoved[0].url,
@@ -165,6 +169,7 @@ cr.define('md_history.history_card_manager_test', function() {
});
test('deleting multiple items from view', function(done) {
+ element.addNewResults(TEST_HISTORY_RESULTS, '');
flush(function() {
var cards = Polymer.dom(element.root)
.querySelectorAll('history-card');
@@ -193,6 +198,41 @@ cr.define('md_history.history_card_manager_test', function() {
});
});
+ test('search results display with correct item 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;
+
+ // Check that the card title displays the search term somewhere.
+ var index = heading.indexOf('Google');
+ assertTrue(index != -1);
+
+ // Check that the search term is bolded correctly in the history-item.
+ assertEquals(title.innerHTML, '<b>Google</b>');
+ done();
+ });
+ });
+
+ test('correct display message when no history available', function(done) {
+ element.addNewResults([], '');
+
+ flush(function() {
+ assertFalse(element.$['no-results'].hidden);
+ assertTrue(element.$['infinite-list'].hidden);
+
+ element.addNewResults(TEST_HISTORY_RESULTS, '');
+
+ flush(function() {
+ assertTrue(element.$['no-results'].hidden);
+ assertFalse(element.$['infinite-list'].hidden);
+ done();
+ });
+ });
+ });
+
teardown(function() {
for (var i = 0; i < items.length; i++) {
items[i].selected = false;

Powered by Google App Engine
This is Rietveld 408576698