| 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 23 matching lines...) Expand all Loading... |
| 34 anchor: '2', | 34 anchor: '2', |
| 35 }; | 35 }; |
| 36 assertDeepEquals(expected, action); | 36 assertDeepEquals(expected, action); |
| 37 }); | 37 }); |
| 38 | 38 |
| 39 test('can shift-select in regular list', function() { | 39 test('can shift-select in regular list', function() { |
| 40 store.data.selection.anchor = '2'; | 40 store.data.selection.anchor = '2'; |
| 41 action = bookmarks.actions.selectItem('4', false, true, store.data); | 41 action = bookmarks.actions.selectItem('4', false, true, store.data); |
| 42 | 42 |
| 43 assertDeepEquals(['2', '8', '4'], action.items); | 43 assertDeepEquals(['2', '8', '4'], action.items); |
| 44 assertDeepEquals('4', action.anchor); | 44 // Shift-selection doesn't change anchor. |
| 45 assertDeepEquals('2', action.anchor); |
| 45 }); | 46 }); |
| 46 | 47 |
| 47 test('can shift-select in search results', function() { | 48 test('can shift-select in search results', function() { |
| 48 store.data.selectedFolder = null; | 49 store.data.selectedFolder = null; |
| 49 store.data.search = { | 50 store.data.search = { |
| 50 term: 'test', | 51 term: 'test', |
| 51 results: ['1', '4', '8'], | 52 results: ['1', '4', '8'], |
| 52 inProgress: false, | 53 inProgress: false, |
| 53 }; | 54 }; |
| 54 store.data.selection.anchor = '8'; | 55 store.data.selection.anchor = '8'; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 action = bookmarks.actions.selectFolder('2', nodes); | 87 action = bookmarks.actions.selectFolder('2', nodes); |
| 87 assertEquals(null, action); | 88 assertEquals(null, action); |
| 88 | 89 |
| 89 action = bookmarks.actions.selectFolder('42', nodes); | 90 action = bookmarks.actions.selectFolder('42', nodes); |
| 90 assertEquals(null, action); | 91 assertEquals(null, action); |
| 91 | 92 |
| 92 action = bookmarks.actions.selectFolder('1', nodes); | 93 action = bookmarks.actions.selectFolder('1', nodes); |
| 93 assertEquals('select-folder', action.name); | 94 assertEquals('select-folder', action.name); |
| 94 assertEquals('1', action.id); | 95 assertEquals('1', action.id); |
| 95 }); | 96 }); |
| OLD | NEW |