| 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 /** | 5 /** |
| 6 * @fileoverview Test suite for action creators that depend on the page state | 6 * @fileoverview Test suite for action creators that depend on the page state |
| 7 * and/or have non-trivial logic. | 7 * and/or have non-trivial logic. |
| 8 */ | 8 */ |
| 9 | 9 |
| 10 suite('selectItem', function() { | 10 suite('selectItem', function() { |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 assertDeepEquals(['4'], action.items); | 67 assertDeepEquals(['4'], action.items); |
| 68 | 68 |
| 69 // Anchor set to an item which doesn't exist. | 69 // Anchor set to an item which doesn't exist. |
| 70 store.data.selection.anchor = '42'; | 70 store.data.selection.anchor = '42'; |
| 71 | 71 |
| 72 action = bookmarks.actions.selectItem('8', true, true, store.data); | 72 action = bookmarks.actions.selectItem('8', true, true, store.data); |
| 73 assertEquals('8', action.anchor); | 73 assertEquals('8', action.anchor); |
| 74 assertDeepEquals(['8'], action.items); | 74 assertDeepEquals(['8'], action.items); |
| 75 }); | 75 }); |
| 76 }); | 76 }); |
| 77 |
| 78 test('selectFolder prevents selecting invalid nodes', function() { |
| 79 var nodes = testTree(createFolder('1', [ |
| 80 createItem('2'), |
| 81 ])); |
| 82 |
| 83 var action = bookmarks.actions.selectFolder(ROOT_NODE_ID, nodes); |
| 84 assertEquals(null, action); |
| 85 |
| 86 action = bookmarks.actions.selectFolder('2', nodes); |
| 87 assertEquals(null, action); |
| 88 |
| 89 action = bookmarks.actions.selectFolder('42', nodes); |
| 90 assertEquals(null, action); |
| 91 |
| 92 action = bookmarks.actions.selectFolder('1', nodes); |
| 93 assertEquals('select-folder', action.name); |
| 94 assertEquals('1', action.id); |
| 95 }); |
| OLD | NEW |