Chromium Code Reviews| Index: chrome/test/data/webui/md_history/history_list_test.js |
| diff --git a/chrome/test/data/webui/md_history/history_card_manager_test.js b/chrome/test/data/webui/md_history/history_list_test.js |
| similarity index 40% |
| rename from chrome/test/data/webui/md_history/history_card_manager_test.js |
| rename to chrome/test/data/webui/md_history/history_list_test.js |
| index 6e511db02cf9cefe060bc1ddab1d7ad87a2a1da0..43e8dac50c0c4e075899f686eb87b6f56cee6a18 100644 |
| --- a/chrome/test/data/webui/md_history/history_card_manager_test.js |
| +++ b/chrome/test/data/webui/md_history/history_list_test.js |
| @@ -2,7 +2,7 @@ |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| -cr.define('md_history.history_card_manager_test', function() { |
| +cr.define('md_history.history_list_test', function() { |
| // Array of test history data. |
| var TEST_HISTORY_RESULTS = [ |
| { |
| @@ -43,94 +43,79 @@ cr.define('md_history.history_card_manager_test', function() { |
| ]; |
| function registerTests() { |
| - suite('history-card-manager', function() { |
| + suite('history-list', function() { |
| var element; |
| suiteSetup(function() { |
| - element = $('history-card-manager'); |
| + element = $('history-list'); |
| }); |
| setup(function() { |
| element.addNewResults(TEST_HISTORY_RESULTS); |
| }); |
| - test('splitting items by day', function() { |
| - assertEquals(3, element.historyDataByDay_.length); |
| - |
| - // Ensure that the output is in reversed date order. |
| - assertEquals("Today - Wednesday, December 9, 2015", |
| - element.historyDataByDay_[0].date); |
| - assertEquals("Yesterday - Tuesday, December 8, 2015", |
| - element.historyDataByDay_[1].date); |
| - assertEquals("Monday, December 7, 2015", |
| - element.historyDataByDay_[2].date); |
| - assertEquals("https://www.example.com", |
| - element.historyDataByDay_[2].historyItems[0].url); |
| - assertEquals("https://www.google.com", |
| - element.historyDataByDay_[2].historyItems[1].url); |
| + test('setting first and last items', function() { |
| + element.addNewResults(TEST_HISTORY_RESULTS); |
| + |
| + assertTrue(element.historyData[0].isLastItem); |
| + assertTrue(element.historyData[0].isFirstItem); |
| + assertTrue(element.historyData[2].isFirstItem); |
| + assertEquals(undefined, element.historyData[3].isLastItem); |
| }); |
| test('cancelling selection of multiple items', function(done) { |
| var toolbar = $('toolbar'); |
| flush(function() { |
| - var cards = Polymer.dom(element.root) |
| - .querySelectorAll('history-card'); |
| - var items = Polymer.dom(cards[2].root) |
| + var items = Polymer.dom(element.root) |
| .querySelectorAll('history-item'); |
| - MockInteractions.tap(items[0].$.checkbox); |
| - MockInteractions.tap(items[1].$.checkbox); |
| + MockInteractions.tap(items[2].$.checkbox); |
| + MockInteractions.tap(items[3].$.checkbox); |
| + |
|
tsergeant
2016/02/08 00:10:54
Nit: Remove the bonus newline
yingran
2016/02/08 03:20:36
Done.
|
| // Make sure that the array of data that determines whether or not an |
| // item is selected is what we expect after selecting the two items. |
| - assertFalse(element.historyDataByDay_[0].historyItems[0].selected); |
| - assertFalse(element.historyDataByDay_[1].historyItems[0].selected); |
| - assertTrue(element.historyDataByDay_[2].historyItems[0].selected); |
| - assertTrue(element.historyDataByDay_[2].historyItems[1].selected); |
| + assertFalse(element.historyData[0].selected); |
| + assertFalse(element.historyData[1].selected); |
| + assertTrue(element.historyData[2].selected); |
| + assertTrue(element.historyData[3].selected); |
| toolbar.onClearSelectionTap_(); |
| // Make sure that clearing the selection updates both the array and |
| // the actual history-items affected. |
| - assertFalse(element.historyDataByDay_[0].historyItems[0].selected); |
| - assertFalse(element.historyDataByDay_[1].historyItems[0].selected); |
| - assertFalse(element.historyDataByDay_[2].historyItems[0].selected); |
| - assertFalse(element.historyDataByDay_[2].historyItems[1].selected); |
| + assertFalse(element.historyData[0].selected); |
| + assertFalse(element.historyData[1].selected); |
| + assertFalse(element.historyData[2].selected); |
| + assertFalse(element.historyData[3].selected); |
| - assertFalse(items[0].$.checkbox.checked); |
| - assertFalse(items[1].$.checkbox.checked); |
| + assertFalse(items[2].$.checkbox.checked); |
| + assertFalse(items[3].$.checkbox.checked); |
| done(); |
| }); |
| }); |
| - test('updating history results', function() { |
| + test('updating history results', function(done) { |
| element.addNewResults(ADDITIONAL_RESULTS); |
| - assertEquals(5, element.historyDataByDay_.length); |
| - |
| - // Ensure that the output is still in reverse order. |
| - assertEquals("Monday, December 7, 2015", |
| - element.historyDataByDay_[2].date); |
| - assertEquals("Sunday, December 6, 2015", |
| - element.historyDataByDay_[3].date); |
| - assertEquals("Saturday, December 5, 2015", |
| - element.historyDataByDay_[4].date); |
| - |
| - // Ensure that the correct items have been appended to the list. |
| - assertEquals("https://en.wikipedia.com", |
| - element.historyDataByDay_[2].historyItems[2].url); |
| - assertEquals("https://www.youtube.com", |
| - element.historyDataByDay_[2].historyItems[3].url); |
| - assertEquals("https://www.google.com", |
| - element.historyDataByDay_[3].historyItems[0].url); |
| - assertEquals("https://www.example.com", |
| - element.historyDataByDay_[4].historyItems[0].url); |
| + flush(function() { |
| + assertTrue(element.historyData[2].isFirstItem); |
| + assertTrue(element.historyData[5].isLastItem); |
| + |
| + assertTrue(element.historyData[6].isFirstItem); |
| + assertTrue(element.historyData[6].isLastItem); |
| + |
| + assertTrue(element.historyData[7].isFirstItem); |
| + assertEquals(undefined, element.historyData[7].isLastItem); |
| + |
| + done(); |
| + }); |
| }); |
| teardown(function() { |
| - element.historyDataByDay_ = []; |
| + element.historyData= []; |
|
tsergeant
2016/02/08 00:10:54
Nit: Space before equals
yingran
2016/02/08 03:20:36
Done.
|
| }); |
| }); |
| } |