| Index: chrome/test/data/webui/md_history/history_list_test.js
|
| diff --git a/chrome/test/data/webui/md_history/history_list_test.js b/chrome/test/data/webui/md_history/history_list_test.js
|
| index ede3c6d4f05412547bdf3258746e2d1ff6d93d3a..54c9bc088b866bab9cb4b5e2a82cf37978db3a55 100644
|
| --- a/chrome/test/data/webui/md_history/history_list_test.js
|
| +++ b/chrome/test/data/webui/md_history/history_list_test.js
|
| @@ -3,57 +3,30 @@
|
| // found in the LICENSE file.
|
|
|
| cr.define('md_history.history_list_test', function() {
|
| - // Array of test history data.
|
| - var TEST_HISTORY_RESULTS = [
|
| - {
|
| - "dateRelativeDay": "Today - Wednesday, December 9, 2015",
|
| - "title": "Google",
|
| - "url": "https://www.google.com"
|
| - },
|
| - {
|
| - "dateRelativeDay": "Yesterday - Tuesday, December 8, 2015",
|
| - "title": "Wikipedia",
|
| - "url": "https://en.wikipedia.com"
|
| - },
|
| - {
|
| - "dateRelativeDay": "Monday, December 7, 2015",
|
| - "title": "Example",
|
| - "url": "https://www.example.com"
|
| - },
|
| - {
|
| - "dateRelativeDay": "Monday, December 7, 2015",
|
| - "title": "Google",
|
| - "url": "https://www.google.com"
|
| - }
|
| - ];
|
| -
|
| - var ADDITIONAL_RESULTS = [
|
| - {
|
| - "dateRelativeDay": "Monday, December 7, 2015",
|
| - "url": "https://en.wikipedia.com"
|
| - },
|
| - {
|
| - "dateRelativeDay": "Monday, December 7, 2015",
|
| - "url": "https://www.youtube.com"
|
| - },
|
| - {
|
| - "dateRelativeDay": "Sunday, December 6, 2015",
|
| - "url": "https://www.google.com"
|
| - },
|
| - {
|
| - "dateRelativeDay": "Saturday, December 5, 2015",
|
| - "url": "https://www.example.com"
|
| - }
|
| - ];
|
| -
|
| function registerTests() {
|
| suite('history-list', function() {
|
| var element;
|
| var toolbar;
|
| + var TEST_HISTORY_RESULTS;
|
| + var ADDITIONAL_RESULTS;
|
|
|
| suiteSetup(function() {
|
| element = $('history-list');
|
| toolbar = $('toolbar');
|
| +
|
| + TEST_HISTORY_RESULTS = [
|
| + createHistoryEntry('2016-03-15', 'https://www.google.com'),
|
| + createHistoryEntry('2016-03-14', 'https://en.wikipedia.org'),
|
| + createHistoryEntry('2016-03-13 10:00', 'https://www.example.com'),
|
| + createHistoryEntry('2016-03-13 9:00', 'https://www.google.com')
|
| + ];
|
| +
|
| + ADDITIONAL_RESULTS = [
|
| + createHistoryEntry('2016-03-12 10:00', 'https://en.wikipedia.org'),
|
| + createHistoryEntry('2016-03-12 9:50', 'https://www.youtube.com'),
|
| + createHistoryEntry('2016-03-11', 'https://www.google.com'),
|
| + createHistoryEntry('2016-03-10', 'https://www.example.com')
|
| + ];
|
| });
|
|
|
| test('setting first and last items', function() {
|
| @@ -124,9 +97,9 @@ cr.define('md_history.history_list_test', function() {
|
| assertEquals(toBeRemoved[0].url, element.historyData[0].url);
|
| assertEquals(toBeRemoved[1].url, element.historyData[1].url);
|
| assertEquals(toBeRemoved[0].timestamps,
|
| - element.historyData[0].timestamps);
|
| + element.historyData[0].allTimestamps);
|
| assertEquals(toBeRemoved[1].timestamps,
|
| - element.historyData[1].timestamps);
|
| + element.historyData[1].allTimestamps);
|
|
|
| done();
|
| });
|
| @@ -162,11 +135,11 @@ cr.define('md_history.history_list_test', function() {
|
|
|
| assertEquals(element.historyData.length, 5);
|
| assertEquals(element.historyData[0].dateRelativeDay,
|
| - "Today - Wednesday, December 9, 2015");
|
| + '2016-03-15');
|
| assertEquals(element.historyData[2].dateRelativeDay,
|
| - "Monday, December 7, 2015");
|
| + '2016-03-13');
|
| assertEquals(element.historyData[4].dateRelativeDay,
|
| - "Sunday, December 6, 2015");
|
| + '2016-03-11');
|
|
|
| // Checks that the first and last items have been reset correctly.
|
| assertTrue(element.historyData[2].isFirstItem);
|
| @@ -180,7 +153,9 @@ cr.define('md_history.history_list_test', function() {
|
| });
|
|
|
| test('search results display with correct item title', function(done) {
|
| - element.addNewResults(TEST_HISTORY_RESULTS, 'Google');
|
| + element.addNewResults(
|
| + [createHistoryEntry('2016-03-15', 'https://www.google.com')],
|
| + 'Google');
|
|
|
| flush(function() {
|
| assertTrue(element.historyData[0].isFirstItem);
|
| @@ -193,7 +168,7 @@ cr.define('md_history.history_list_test', function() {
|
| assertTrue(index != -1);
|
|
|
| // Check that the search term is bolded correctly in the history-item.
|
| - assertEquals(title.innerHTML, '<b>Google</b>');
|
| + assertGT(title.innerHTML.indexOf('<b>google</b>'), -1);
|
| done();
|
| });
|
| });
|
| @@ -217,6 +192,7 @@ cr.define('md_history.history_list_test', function() {
|
|
|
| teardown(function() {
|
| element.historyData = [];
|
| + registerMessageCallback('removeVisits', this, undefined);
|
| });
|
| });
|
| }
|
|
|