| 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;
|
|
|