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

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: use date interval format 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 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 var getInfo = function() {
99 assertEquals('Now', toolbar.queryEndTime); 99 var info = createHistoryInfo();
100 }); 100 info.queryStartMonth = 'Dec 2016';
101 info.queryInterval = 'Yesterday - Now';
102 return info;
103 };
104 app.set('queryState_.range', HistoryRange.MONTH);
105 app.historyResult(getInfo(), SIMPLE_RESULTS);
106 assertEquals(
107 'Dec 2016', toolbar.$$('#grouped-date').textContent.trim());
108
109 app.set('queryState_.range', HistoryRange.WEEK);
110 app.historyResult(getInfo(), SIMPLE_RESULTS);
111 assertEquals(
112 'Yesterday - Now', toolbar.$$('#grouped-date').textContent.trim());
101 }); 113 });
102 114
103 test('items grouped by day in week view', function() { 115 test('items grouped by day in week view', function() {
104 app.set('queryState_.range', HistoryRange.WEEK); 116 app.set('queryState_.range', HistoryRange.WEEK);
105 app.historyResult(createHistoryInfo(), PER_DAY_RESULTS); 117 app.historyResult(createHistoryInfo(), PER_DAY_RESULTS);
106 return PolymerTest.flushTasks().then(function() { 118 return PolymerTest.flushTasks().then(function() {
107 var data = groupedList.groupedHistoryData_; 119 var data = groupedList.groupedHistoryData_;
108 120
109 // 3 cards. 121 // 3 cards.
110 assertEquals(3, data.length); 122 assertEquals(3, data.length);
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 assertEquals( 317 assertEquals(
306 JSON.stringify(expected), 318 JSON.stringify(expected),
307 JSON.stringify(groupedList.buildRemovalTree_(paths))); 319 JSON.stringify(groupedList.buildRemovalTree_(paths)));
308 }); 320 });
309 }); 321 });
310 } 322 }
311 return { 323 return {
312 registerTests: registerTests 324 registerTests: registerTests
313 }; 325 };
314 }); 326 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698