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

Side by Side Diff: chrome/test/data/webui/md_history/history_grouped_list_test.js

Issue 2570253002: [MD History] Fix toolbar dates in grouped mode. (Closed)
Patch Set: rebase Created 3 years, 11 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 suite('history-grouped-list', function() { 5 suite('history-grouped-list', function() {
6 var app; 6 var app;
7 var toolbar; 7 var toolbar;
8 var groupedList; 8 var groupedList;
9 var sidebar; 9 var sidebar;
10 var listContainer; 10 var listContainer;
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 assertEquals('history', sidebar.$.menu.selected); 71 assertEquals('history', sidebar.$.menu.selected);
72 72
73 app.set('queryState_.range', HistoryRange.MONTH); 73 app.set('queryState_.range', HistoryRange.MONTH);
74 assertEquals('grouped-list', content.selected); 74 assertEquals('grouped-list', content.selected);
75 assertEquals('history', sidebar.$.menu.selected); 75 assertEquals('history', sidebar.$.menu.selected);
76 }); 76 });
77 77
78 test('items grouped by domain', function() { 78 test('items grouped by domain', function() {
79 app.set('queryState_.range', HistoryRange.WEEK); 79 app.set('queryState_.range', HistoryRange.WEEK);
80 var info = createHistoryInfo(); 80 var info = createHistoryInfo();
81 info.queryStartTime = 'Yesterday';
82 info.queryEndTime = 'Now';
83 app.historyResult(info, SIMPLE_RESULTS); 81 app.historyResult(info, SIMPLE_RESULTS);
84 return PolymerTest.flushTasks().then(function() { 82 return PolymerTest.flushTasks().then(function() {
85 var data = groupedList.groupedHistoryData_; 83 var data = groupedList.groupedHistoryData_;
86 // 1 card for the day with 3 domains. 84 // 1 card for the day with 3 domains.
87 assertEquals(1, data.length); 85 assertEquals(1, data.length);
88 assertEquals(3, data[0].domains.length); 86 assertEquals(3, data[0].domains.length);
89 87
90 // Most visits at the top. 88 // Most visits at the top.
91 assertEquals(2, data[0].domains[0].visits.length); 89 assertEquals(2, data[0].domains[0].visits.length);
92 assertEquals(1, data[0].domains[1].visits.length); 90 assertEquals(1, data[0].domains[1].visits.length);
93 assertEquals(1, data[0].domains[2].visits.length); 91 assertEquals(1, data[0].domains[2].visits.length);
92 });
93 });
94 94
95 // Ensure the toolbar displays the correct begin and end time. 95 test('toolbar dates appear in grouped mode', function() {
96 assertEquals('Yesterday', toolbar.queryStartTime); 96 var getInfo = function() {
97 assertEquals('Now', toolbar.queryEndTime); 97 var info = createHistoryInfo();
98 }); 98 info.queryStartMonth = 'Dec 2016';
99 info.queryInterval = 'Yesterday - Now';
100 return info;
101 };
102 app.set('queryState_.range', HistoryRange.MONTH);
103 app.historyResult(getInfo(), SIMPLE_RESULTS);
104 assertEquals(
105 'Dec 2016', toolbar.$$('#grouped-date').textContent.trim());
106
107 app.set('queryState_.range', HistoryRange.WEEK);
108 app.historyResult(getInfo(), SIMPLE_RESULTS);
109 assertEquals(
110 'Yesterday - Now', toolbar.$$('#grouped-date').textContent.trim());
99 }); 111 });
100 112
101 test('items grouped by day in week view', function() { 113 test('items grouped by day in week view', function() {
102 app.set('queryState_.range', HistoryRange.WEEK); 114 app.set('queryState_.range', HistoryRange.WEEK);
103 app.historyResult(createHistoryInfo(), PER_DAY_RESULTS); 115 app.historyResult(createHistoryInfo(), PER_DAY_RESULTS);
104 return PolymerTest.flushTasks().then(function() { 116 return PolymerTest.flushTasks().then(function() {
105 var data = groupedList.groupedHistoryData_; 117 var data = groupedList.groupedHistoryData_;
106 118
107 // 3 cards. 119 // 3 cards.
108 assertEquals(3, data.length); 120 assertEquals(3, data.length);
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 children: [], 304 children: [],
293 }, 305 },
294 ], 306 ],
295 }; 307 };
296 308
297 assertEquals( 309 assertEquals(
298 JSON.stringify(expected), 310 JSON.stringify(expected),
299 JSON.stringify(groupedList.buildRemovalTree_(paths))); 311 JSON.stringify(groupedList.buildRemovalTree_(paths)));
300 }); 312 });
301 }); 313 });
OLDNEW
« no previous file with comments | « chrome/test/data/webui/history_browsertest.js ('k') | chrome/test/data/webui/md_history/test_util.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698