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

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: Created 4 years 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 cr.define('md_history.history_grouped_list_test', function() { 5 cr.define('md_history.history_grouped_list_test', function() {
6 function registerTests() { 6 function registerTests() {
7 suite('history-grouped-list', function() { 7 suite('history-grouped-list', function() {
8 var app; 8 var app;
9 var toolbar; 9 var toolbar;
10 var groupedList; 10 var groupedList;
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 assertEquals('history', sidebar.$.menu.selected); 73 assertEquals('history', sidebar.$.menu.selected);
74 74
75 app.set('queryState_.range', HistoryRange.MONTH); 75 app.set('queryState_.range', HistoryRange.MONTH);
76 assertEquals('grouped-list', content.selected); 76 assertEquals('grouped-list', content.selected);
77 assertEquals('history', sidebar.$.menu.selected); 77 assertEquals('history', sidebar.$.menu.selected);
78 }); 78 });
79 79
80 test('items grouped by domain', function() { 80 test('items grouped by domain', function() {
81 app.set('queryState_.range', HistoryRange.WEEK); 81 app.set('queryState_.range', HistoryRange.WEEK);
82 var info = createHistoryInfo(); 82 var info = createHistoryInfo();
83 info.queryStartTime = 'Yesterday';
84 info.queryEndTime = 'Now';
85 app.historyResult(info, SIMPLE_RESULTS); 83 app.historyResult(info, SIMPLE_RESULTS);
86 return PolymerTest.flushTasks().then(function() { 84 return PolymerTest.flushTasks().then(function() {
87 var data = groupedList.groupedHistoryData_; 85 var data = groupedList.groupedHistoryData_;
88 // 1 card for the day with 3 domains. 86 // 1 card for the day with 3 domains.
89 assertEquals(1, data.length); 87 assertEquals(1, data.length);
90 assertEquals(3, data[0].domains.length); 88 assertEquals(3, data[0].domains.length);
91 89
92 // Most visits at the top. 90 // Most visits at the top.
93 assertEquals(2, data[0].domains[0].visits.length); 91 assertEquals(2, data[0].domains[0].visits.length);
94 assertEquals(1, data[0].domains[1].visits.length); 92 assertEquals(1, data[0].domains[1].visits.length);
95 assertEquals(1, data[0].domains[2].visits.length); 93 assertEquals(1, data[0].domains[2].visits.length);
94 });
95 });
96 96
97 // Ensure the toolbar displays the correct begin and end time. 97 test('toolbar dates appear in grouped mode', function() {
98 assertEquals('Yesterday', toolbar.queryStartTime); 98 app.set('queryState_.range', HistoryRange.MONTH);
tsergeant 2016/12/15 06:31:37 This test is a bit confusing to read. The most rel
calamity 2016/12/15 06:57:00 How about this?
99 assertEquals('Now', toolbar.queryEndTime); 99 var info = createHistoryInfo();
tsergeant 2016/12/15 06:31:37 Also, should the new info fields appear in createH
calamity 2016/12/15 06:57:00 Hmm. So, the way this test is set up actually impl
100 }); 100 info.queryStartMonth = 'Dec 2016';
101 info.queryStartTimeShort = 'Yesterday';
102 info.queryEndTimeShort = 'Now';
103 app.historyResult(info, SIMPLE_RESULTS);
104 assertEquals(
105 'Dec 2016', toolbar.$$('#grouped-date').textContent.trim());
106 app.set('queryState_.range', HistoryRange.WEEK);
107 info = createHistoryInfo();
108 info.queryStartMonth = 'Dec 2016';
109 info.queryStartTimeShort = 'Yesterday';
110 info.queryEndTimeShort = 'Now';
111 app.historyResult(info, SIMPLE_RESULTS);
112 assertEquals(
113 loadTimeData.getStringF('historyInterval', 'Yesterday', 'Now'),
114 toolbar.$$('#grouped-date').textContent.trim());
101 }); 115 });
102 116
103 test('items grouped by day in week view', function() { 117 test('items grouped by day in week view', function() {
104 app.set('queryState_.range', HistoryRange.WEEK); 118 app.set('queryState_.range', HistoryRange.WEEK);
105 app.historyResult(createHistoryInfo(), PER_DAY_RESULTS); 119 app.historyResult(createHistoryInfo(), PER_DAY_RESULTS);
106 return PolymerTest.flushTasks().then(function() { 120 return PolymerTest.flushTasks().then(function() {
107 var data = groupedList.groupedHistoryData_; 121 var data = groupedList.groupedHistoryData_;
108 122
109 // 3 cards. 123 // 3 cards.
110 assertEquals(3, data.length); 124 assertEquals(3, data.length);
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 assertEquals( 319 assertEquals(
306 JSON.stringify(expected), 320 JSON.stringify(expected),
307 JSON.stringify(groupedList.buildRemovalTree_(paths))); 321 JSON.stringify(groupedList.buildRemovalTree_(paths)));
308 }); 322 });
309 }); 323 });
310 } 324 }
311 return { 325 return {
312 registerTests: registerTests 326 registerTests: registerTests
313 }; 327 };
314 }); 328 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698