| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 suite('selection state', function() { | 5 suite('selection state', function() { |
| 6 var state; | 6 var state; |
| 7 var action; | 7 var action; |
| 8 | 8 |
| 9 function select(items, anchor, add) { | 9 function select(items, anchor, add) { |
| 10 return { | 10 return { |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 }); | 71 }); |
| 72 | 72 |
| 73 test('is cleared when search cleared', function() { | 73 test('is cleared when search cleared', function() { |
| 74 action = select(['1', '2', '3'], '3', false); | 74 action = select(['1', '2', '3'], '3', false); |
| 75 state = bookmarks.SelectionState.updateSelection(state, action); | 75 state = bookmarks.SelectionState.updateSelection(state, action); |
| 76 | 76 |
| 77 action = bookmarks.actions.clearSearch(); | 77 action = bookmarks.actions.clearSearch(); |
| 78 state = bookmarks.SelectionState.updateSelection(state, action); | 78 state = bookmarks.SelectionState.updateSelection(state, action); |
| 79 assertDeepEquals({}, state.items); | 79 assertDeepEquals({}, state.items); |
| 80 }); | 80 }); |
| 81 |
| 82 test('deselect items', function() { |
| 83 action = select(['1', '2', '3'], '3', false); |
| 84 state = bookmarks.SelectionState.updateSelection(state, action); |
| 85 |
| 86 action = bookmarks.actions.deselectItems(); |
| 87 state = bookmarks.SelectionState.updateSelection(state, action); |
| 88 assertDeepEquals({}, state.items); |
| 89 }); |
| 81 }); | 90 }); |
| 82 | 91 |
| 83 suite('closed folder state', function() { | 92 suite('closed folder state', function() { |
| 84 var nodes; | 93 var nodes; |
| 85 var state; | 94 var state; |
| 86 var action; | 95 var action; |
| 87 | 96 |
| 88 setup(function() { | 97 setup(function() { |
| 89 nodes = testTree( | 98 nodes = testTree( |
| 90 createFolder( | 99 createFolder( |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 // Case 2: Clear search by selecting a new folder. | 308 // Case 2: Clear search by selecting a new folder. |
| 300 action = bookmarks.actions.selectFolder('2'); | 309 action = bookmarks.actions.selectFolder('2'); |
| 301 var selectedState = bookmarks.reduceAction(searchedState, action); | 310 var selectedState = bookmarks.reduceAction(searchedState, action); |
| 302 | 311 |
| 303 assertEquals('2', selectedState.selectedFolder); | 312 assertEquals('2', selectedState.selectedFolder); |
| 304 assertDeepEquals(['3'], bookmarks.util.getDisplayedList(selectedState)); | 313 assertDeepEquals(['3'], bookmarks.util.getDisplayedList(selectedState)); |
| 305 assertEquals('', selectedState.search.term); | 314 assertEquals('', selectedState.search.term); |
| 306 assertDeepEquals([], selectedState.search.results); | 315 assertDeepEquals([], selectedState.search.results); |
| 307 }); | 316 }); |
| 308 }); | 317 }); |
| OLD | NEW |