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

Unified Diff: chrome/test/data/webui/md_history/history_list_test.js

Issue 2239623002: [MD History] Add shift-selection to the history lists. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@reshadow
Patch Set: rebase, fix closure compile Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: chrome/test/data/webui/md_history/history_list_test.js
diff --git a/chrome/test/data/webui/md_history/history_list_test.js b/chrome/test/data/webui/md_history/history_list_test.js
index 766a9a29fd01b27f9bfd6d8105ef32ffa4f78c45..1f6d888c4daba3c4a4e4b7a8fa882d3012bf7ceb 100644
--- a/chrome/test/data/webui/md_history/history_list_test.js
+++ b/chrome/test/data/webui/md_history/history_list_test.js
@@ -41,25 +41,92 @@ cr.define('md_history.history_list_test', function() {
// Make sure that the array of data that determines whether or not an
// item is selected is what we expect after selecting the two items.
- assertFalse(element.historyData_[0].selected);
- assertFalse(element.historyData_[1].selected);
- assertTrue(element.historyData_[2].selected);
- assertTrue(element.historyData_[3].selected);
+ assertDeepEquals([false, false, true, true],
+ element.historyData_.map(i => i.selected));
toolbar.onClearSelectionTap_();
// Make sure that clearing the selection updates both the array and
// the actual history-items affected.
- assertFalse(element.historyData_[0].selected);
- assertFalse(element.historyData_[1].selected);
- assertFalse(element.historyData_[2].selected);
- assertFalse(element.historyData_[3].selected);
+ assertDeepEquals([false, false, false, false],
+ element.historyData_.map(i => i.selected));
assertFalse(items[2].$.checkbox.checked);
assertFalse(items[3].$.checkbox.checked);
});
});
+ test('selection of multiple items using shift click', function() {
+ app.historyResult(createHistoryInfo(), TEST_HISTORY_RESULTS);
+ return flush().then(function() {
+ var items = polymerSelectAll(element, 'history-item');
+
+ MockInteractions.tap(items[1].$.checkbox);
+ assertDeepEquals([false, true, false, false],
+ element.historyData_.map(i => i.selected));
+ assertDeepEquals(
+ ['historyData_.1'],
+ Array.from(element.selectedPaths).sort());
+
+ // Shift-select to the last item.
+ shiftClick(items[3].$.checkbox);
+ assertDeepEquals([false, true, true, true],
+ element.historyData_.map(i => i.selected));
+ assertDeepEquals(
+ ['historyData_.1', 'historyData_.2', 'historyData_.3'],
+ Array.from(element.selectedPaths).sort());
+
+ // Shift-select back to the first item.
+ shiftClick(items[0].$.checkbox);
+ assertDeepEquals([true, true, true, true],
+ element.historyData_.map(i => i.selected));
+ assertDeepEquals(
+ [
+ 'historyData_.0', 'historyData_.1', 'historyData_.2',
+ 'historyData_.3'
+ ],
+ Array.from(element.selectedPaths).sort());
+
+ // Shift-deselect to the third item.
+ shiftClick(items[2].$.checkbox);
+ assertDeepEquals([false, false, false, true],
+ element.historyData_.map(i => i.selected));
+ assertDeepEquals(
+ ['historyData_.3'],
+ Array.from(element.selectedPaths).sort());
+
+ // Select the second item.
+ MockInteractions.tap(items[1].$.checkbox);
+ assertDeepEquals([false, true, false, true],
+ element.historyData_.map(i => i.selected));
+ assertDeepEquals(
+ ['historyData_.1', 'historyData_.3'],
+ Array.from(element.selectedPaths).sort());
+
+ // Shift-deselect to the last item.
+ shiftClick(items[3].$.checkbox);
+ assertDeepEquals([false, false, false, false],
+ element.historyData_.map(i => i.selected));
+ assertDeepEquals(
+ [],
+ Array.from(element.selectedPaths).sort());
+
+ // Shift-select back to the third item.
+ shiftClick(items[2].$.checkbox);
+ assertDeepEquals([false, false, true, true],
+ element.historyData_.map(i => i.selected));
+ assertDeepEquals(
+ ['historyData_.2', 'historyData_.3'],
+ Array.from(element.selectedPaths).sort());
+
+ // Remove selected items.
+ element.removeItemsByPath(Array.from(element.selectedPaths));
+ assertDeepEquals(
+ ['https://www.google.com', 'https://www.example.com'],
+ element.historyData_.map(i => i.title));
+ });
+ });
+
test('setting first and last items', function() {
app.historyResult(createHistoryInfo(), TEST_HISTORY_RESULTS);
« no previous file with comments | « chrome/test/data/webui/md_history/history_grouped_list_test.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