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

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

Issue 2684693004: MD History: Remove list-container and list-behavior (Closed)
Patch Set: Rename listeners Created 3 years, 10 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 var TEST_HISTORY_RESULTS = [ 5 var TEST_HISTORY_RESULTS = [
6 createHistoryEntry('2016-03-16 10:00', 'http://www.google.com'), 6 createHistoryEntry('2016-03-16 10:00', 'http://www.google.com'),
7 createHistoryEntry('2016-03-16 9:00', 'http://www.example.com'), 7 createHistoryEntry('2016-03-16 9:00', 'http://www.example.com'),
8 createHistoryEntry('2016-03-16 7:01', 'http://www.badssl.com'), 8 createHistoryEntry('2016-03-16 7:01', 'http://www.badssl.com'),
9 createHistoryEntry('2016-03-16 7:00', 'http://www.website.com'), 9 createHistoryEntry('2016-03-16 7:00', 'http://www.website.com'),
10 createHistoryEntry('2016-03-16 4:00', 'http://www.website.com'), 10 createHistoryEntry('2016-03-16 4:00', 'http://www.website.com'),
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 MockInteractions.tap(item.$['time-accessed']); 53 MockInteractions.tap(item.$['time-accessed']);
54 assertEquals(item.$['checkbox'], item.root.activeElement); 54 assertEquals(item.$['checkbox'], item.root.activeElement);
55 }); 55 });
56 }); 56 });
57 }); 57 });
58 58
59 suite('<history-item> integration test', function() { 59 suite('<history-item> integration test', function() {
60 var element; 60 var element;
61 61
62 setup(function() { 62 setup(function() {
63 element = replaceApp().$['history'].$['infinite-list']; 63 element = replaceApp().$.history;
64 }); 64 });
65 65
66 test('basic separator insertion', function() { 66 test('basic separator insertion', function() {
67 element.addNewResults(TEST_HISTORY_RESULTS); 67 element.addNewResults(TEST_HISTORY_RESULTS);
68 return PolymerTest.flushTasks().then(function() { 68 return PolymerTest.flushTasks().then(function() {
69 // Check that the correct number of time gaps are inserted. 69 // Check that the correct number of time gaps are inserted.
70 var items = Polymer.dom(element.root).querySelectorAll('history-item'); 70 var items = Polymer.dom(element.root).querySelectorAll('history-item');
71 71
72 assertTrue(items[0].hasTimeGap); 72 assertTrue(items[0].hasTimeGap);
73 assertTrue(items[1].hasTimeGap); 73 assertTrue(items[1].hasTimeGap);
(...skipping 15 matching lines...) Expand all
89 assertFalse(items[1].hasTimeGap); 89 assertFalse(items[1].hasTimeGap);
90 assertFalse(items[2].hasTimeGap); 90 assertFalse(items[2].hasTimeGap);
91 }); 91 });
92 }); 92 });
93 93
94 test('separator insertion after deletion', function() { 94 test('separator insertion after deletion', function() {
95 element.addNewResults(TEST_HISTORY_RESULTS); 95 element.addNewResults(TEST_HISTORY_RESULTS);
96 return PolymerTest.flushTasks().then(function() { 96 return PolymerTest.flushTasks().then(function() {
97 var items = Polymer.dom(element.root).querySelectorAll('history-item'); 97 var items = Polymer.dom(element.root).querySelectorAll('history-item');
98 98
99 element.removeItemsByPath(['historyData_.3']); 99 element.removeItemsByIndex_([3]);
100 assertEquals(5, element.historyData_.length); 100 assertEquals(5, element.historyData_.length);
101 101
102 // Checks that a new time gap separator has been inserted. 102 // Checks that a new time gap separator has been inserted.
103 assertTrue(items[2].hasTimeGap); 103 assertTrue(items[2].hasTimeGap);
104 104
105 element.removeItemsByPath(['historyData_.3']); 105 element.removeItemsByIndex_([3]);
106 106
107 // Checks time gap separator is removed. 107 // Checks time gap separator is removed.
108 assertFalse(items[2].hasTimeGap); 108 assertFalse(items[2].hasTimeGap);
109 }); 109 });
110 }); 110 });
111 111
112 test('remove bookmarks', function() { 112 test('remove bookmarks', function() {
113 element.addNewResults(TEST_HISTORY_RESULTS); 113 element.addNewResults(TEST_HISTORY_RESULTS);
114 return PolymerTest.flushTasks().then(function() { 114 return PolymerTest.flushTasks().then(function() {
115 element.set('historyData_.1.starred', true); 115 element.set('historyData_.1.starred', true);
116 element.set('historyData_.5.starred', true); 116 element.set('historyData_.5.starred', true);
117 return PolymerTest.flushTasks(); 117 return PolymerTest.flushTasks();
118 }).then(function() { 118 }).then(function() {
119 119
120 items = Polymer.dom(element.root).querySelectorAll('history-item'); 120 items = Polymer.dom(element.root).querySelectorAll('history-item');
121 121
122 items[1].$$('#bookmark-star').focus(); 122 items[1].$$('#bookmark-star').focus();
123 MockInteractions.tap(items[1].$$('#bookmark-star')); 123 MockInteractions.tap(items[1].$$('#bookmark-star'));
124 124
125 // Check that focus is shifted to overflow menu icon. 125 // Check that focus is shifted to overflow menu icon.
126 assertEquals(items[1].root.activeElement, items[1].$['menu-button']); 126 assertEquals(items[1].root.activeElement, items[1].$['menu-button']);
127 // Check that all items matching this url are unstarred. 127 // Check that all items matching this url are unstarred.
128 assertEquals(element.historyData_[1].starred, false); 128 assertEquals(element.historyData_[1].starred, false);
129 assertEquals(element.historyData_[5].starred, false); 129 assertEquals(element.historyData_[5].starred, false);
130 }); 130 });
131 }); 131 });
132 }); 132 });
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/md_history_ui.cc ('k') | chrome/test/data/webui/md_history/history_list_test.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698