Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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('<bookmarks-store>', function() { | 5 suite('<bookmarks-store>', function() { |
| 6 var store; | 6 var store; |
| 7 var TEST_TREE; | 7 var TEST_TREE; |
| 8 | 8 |
| 9 setup(function() { | 9 setup(function() { |
| 10 TEST_TREE = { | 10 TEST_TREE = { |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 164 store.onBookmarkRemoved_('2', {parentId:'1', index:'0'}); | 164 store.onBookmarkRemoved_('2', {parentId:'1', index:'0'}); |
| 165 assertTrue(store.idToNodeMap_['1'].isSelected); | 165 assertTrue(store.idToNodeMap_['1'].isSelected); |
| 166 assertEquals('1', store.selectedId); | 166 assertEquals('1', store.selectedId); |
| 167 | 167 |
| 168 // A folder with selected folder in it gets removed. | 168 // A folder with selected folder in it gets removed. |
| 169 store.selectedId = '3'; | 169 store.selectedId = '3'; |
| 170 store.onBookmarkRemoved_('1', {parentId:'0', index:'0'}); | 170 store.onBookmarkRemoved_('1', {parentId:'0', index:'0'}); |
| 171 assertTrue(store.idToNodeMap_['0'].isSelected); | 171 assertTrue(store.idToNodeMap_['0'].isSelected); |
| 172 assertEquals('0', store.selectedId); | 172 assertEquals('0', store.selectedId); |
| 173 }); | 173 }); |
| 174 | |
| 175 test('bookmark gets updated after editing', function() { | |
| 176 // Edit title updates idToNodeMap_ properly. | |
| 177 store.onBookmarkChanged_('4', {'title': 'test'}); | |
| 178 assertEquals('test', store.idToNodeMap_['4'].title); | |
| 179 assertEquals('link4', store.idToNodeMap_['4'].url); | |
| 180 | |
| 181 // Edit url updates idToNodeMap_ properly. | |
| 182 store.onBookmarkChanged_('5', {'url': 'http://www.google.com'}); | |
| 183 assertEquals(undefined, store.idToNodeMap_['5'].title); | |
| 184 assertEquals('http://www.google.com', store.idToNodeMap_['5'].url); | |
| 185 | |
| 186 // Edit url and title updates idToNodeMap_ properly. | |
| 187 store.onBookmarkChanged_( | |
| 188 '2', {'title': 'test', 'url': 'http://www.google.com'}); | |
| 189 assertEquals('test', store.idToNodeMap_['2'].title); | |
| 190 assertEquals('http://www.google.com', store.idToNodeMap_['2'].url); | |
| 191 }); | |
|
jiaxi
2017/01/06 06:03:53
As discussed offline, integration test with someth
| |
| 174 }); | 192 }); |
| OLD | NEW |