Chromium Code Reviews| Index: chrome/test/data/webui/md_history/history_grouped_list_test.js |
| diff --git a/chrome/test/data/webui/md_history/history_grouped_list_test.js b/chrome/test/data/webui/md_history/history_grouped_list_test.js |
| index 1b990afafa0f8e05f7f86ee11b2af55edaee26c1..3781ff7197f6ffb6efa68c7e2926421c94790385 100644 |
| --- a/chrome/test/data/webui/md_history/history_grouped_list_test.js |
| +++ b/chrome/test/data/webui/md_history/history_grouped_list_test.js |
| @@ -9,14 +9,17 @@ cr.define('md_history.history_grouped_list_test', function() { |
| var toolbar; |
| var groupedList; |
| var sidebar; |
| + var listContainer; |
| var SIMPLE_RESULTS; |
| var PER_DAY_RESULTS; |
| var PER_MONTH_RESULTS; |
| + |
| suiteSetup(function() { |
| app = $('history-app'); |
| app.grouped_ = true; |
| + listContainer = app.$['history']; |
| toolbar = app.$['toolbar']; |
| sidebar = app.$['content-side-bar']; |
| @@ -135,17 +138,82 @@ cr.define('md_history.history_grouped_list_test', function() { |
| test('items rendered when expanded', function() { |
| app.set('queryState_.range', HistoryRange.WEEK); |
| app.historyResult(createHistoryInfo(), SIMPLE_RESULTS); |
| - var getItems = function() { |
| - return Polymer.dom(groupedList.root) |
| - .querySelectorAll('history-item'); |
| - }; |
| return flush().then(function() { |
| - assertEquals(0, getItems().length); |
| + assertEquals( |
| + 0, polymerQuerySelectorAll(groupedList, 'history-item').length); |
| MockInteractions.tap(groupedList.$$('.domain-heading')); |
| return flush(); |
| }).then(function() { |
| - assertEquals(2, getItems().length); |
| + assertEquals( |
| + 2, polymerQuerySelectorAll(groupedList, 'history-item').length); |
| + }); |
| + }); |
| + |
| + test('items deletion in week view', function(done) { |
| + var results = [ |
| + createHistoryEntry('2016-03-13', 'https://en.wikipedia.org/a'), |
| + createHistoryEntry('2016-03-13', 'https://en.wikipedia.org/b'), |
| + createHistoryEntry('2016-03-13', 'https://en.wikipedia.org/c'), |
| + createHistoryEntry('2016-03-13', 'https://en.wikipedia.org/d'), |
| + createHistoryEntry('2016-03-13', 'https://www.youtube.com/a'), |
| + createHistoryEntry('2016-03-13', 'https://www.youtube.com/b'), |
| + createHistoryEntry('2016-03-11', 'https://en.wikipedia.org'), |
| + createHistoryEntry('2016-03-10', 'https://www.youtube.com') |
| + ]; |
| + app.set('queryState_.range', HistoryRange.WEEK); |
| + app.historyResult(createHistoryInfo(), results); |
| + |
| + waitForEvent(groupedList, 'dom-change', function() { |
| + return polymerQuerySelectorAll( |
| + groupedList, '.dropdown-indicator').length == 4; |
| + }).then(function() { |
| + polymerQuerySelectorAll(groupedList, '.dropdown-indicator'). |
| + forEach(MockInteractions.tap); |
| + |
| + return flush(); |
| + }).then(function() { |
| + var items = polymerQuerySelectorAll(groupedList, 'history-item'); |
| + |
| + MockInteractions.tap(items[0].$.checkbox); |
| + MockInteractions.tap(items[2].$.checkbox); |
| + MockInteractions.tap(items[4].$.checkbox); |
| + MockInteractions.tap(items[5].$.checkbox); |
| + MockInteractions.tap(items[6].$.checkbox); |
| + MockInteractions.tap(items[7].$.checkbox); |
| + |
| + // Select and deselect item 1. |
| + MockInteractions.tap(items[1].$.checkbox); |
| + MockInteractions.tap(items[1].$.checkbox); |
| + |
| + registerMessageCallback('removeVisits', this, function() { |
| + flush().then(function() { |
| + deleteComplete(); |
| + return waitForEvent(groupedList, 'dom-change', function() { |
| + return polymerQuerySelectorAll( |
| + groupedList, '.dropdown-indicator').length == 1; |
| + }); |
| + }).then(function() { |
| + items = polymerQuerySelectorAll(groupedList, 'history-item'); |
| + assertEquals(2, items.length); |
| + assertEquals('https://en.wikipedia.org/b', items[0].item.title); |
| + assertEquals('https://en.wikipedia.org/d', items[1].item.title); |
|
tsergeant
2016/08/05 01:39:09
You should assert that there are no empty domains
calamity
2016/08/09 02:56:00
Done.
|
| + |
| + assertEquals( |
| + 1, polymerQuerySelectorAll(groupedList, |
| + '.group-container').length); |
| + |
| + assertFalse(listContainer.$.dialog.open); |
| + done(); |
| + }); |
| + }); |
| + |
| + MockInteractions.tap(app.$.toolbar.$$('#delete-button')); |
| + |
| + // Confirmation dialog should appear. |
| + assertTrue(listContainer.$.dialog.open); |
| + |
| + MockInteractions.tap(listContainer.$$('.action-button')); |
| }); |
| }); |