| 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 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 334 | 334 |
| 335 assertDeepEquals(['2', '4', '3'], state['1'].children); | 335 assertDeepEquals(['2', '4', '3'], state['1'].children); |
| 336 | 336 |
| 337 // Move between different folders. | 337 // Move between different folders. |
| 338 action = bookmarks.actions.moveBookmark('4', '5', 0, '1', 1); | 338 action = bookmarks.actions.moveBookmark('4', '5', 0, '1', 1); |
| 339 state = bookmarks.NodeState.updateNodes(state, action); | 339 state = bookmarks.NodeState.updateNodes(state, action); |
| 340 | 340 |
| 341 assertDeepEquals(['2', '3'], state['1'].children); | 341 assertDeepEquals(['2', '3'], state['1'].children); |
| 342 assertDeepEquals(['4'], state['5'].children); | 342 assertDeepEquals(['4'], state['5'].children); |
| 343 }); | 343 }); |
| 344 |
| 345 test('updates when children of a node are reordered', function() { |
| 346 action = bookmarks.actions.reorderChildren('1', ['4', '2', '3']); |
| 347 state = bookmarks.NodeState.updateNodes(state, action); |
| 348 |
| 349 assertDeepEquals(['4', '2', '3'], state['1'].children); |
| 350 }); |
| 344 }); | 351 }); |
| 345 | 352 |
| 346 suite('search state', function() { | 353 suite('search state', function() { |
| 347 var state; | 354 var state; |
| 348 | 355 |
| 349 setup(function() { | 356 setup(function() { |
| 350 // Search touches a few different things, so we test using the entire state: | 357 // Search touches a few different things, so we test using the entire state: |
| 351 state = bookmarks.util.createEmptyState(); | 358 state = bookmarks.util.createEmptyState(); |
| 352 state.nodes = testTree(createFolder('1', [ | 359 state.nodes = testTree(createFolder('1', [ |
| 353 createFolder( | 360 createFolder( |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 413 state = bookmarks.reduceAction(state, action); | 420 state = bookmarks.reduceAction(state, action); |
| 414 | 421 |
| 415 action = bookmarks.actions.removeBookmark('2', '1', 0, state.nodes); | 422 action = bookmarks.actions.removeBookmark('2', '1', 0, state.nodes); |
| 416 state = bookmarks.reduceAction(state, action); | 423 state = bookmarks.reduceAction(state, action); |
| 417 | 424 |
| 418 // 2 and 3 should be removed, since 2 was deleted and 3 was a descendant of | 425 // 2 and 3 should be removed, since 2 was deleted and 3 was a descendant of |
| 419 // 2. | 426 // 2. |
| 420 assertDeepEquals(['1'], state.search.results); | 427 assertDeepEquals(['1'], state.search.results); |
| 421 }); | 428 }); |
| 422 }); | 429 }); |
| OLD | NEW |