| 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);
|
|
|
|
|