Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 suite('app', function() { | |
|
tsergeant
2017/03/30 04:19:57
Nit: Name the suite with the full element name: <b
calamity
2017/04/03 03:48:41
Done.
| |
| 6 var app; | |
| 7 var store; | |
| 8 | |
| 9 setup(function() { | |
| 10 store = new bookmarks.TestStore({ | |
| 11 nodes: testTree(createFolder( | |
| 12 '1', | |
| 13 [ | |
| 14 createFolder('11', []), | |
| 15 ])), | |
| 16 selectedFolder: '1', | |
| 17 }); | |
| 18 bookmarks.Store.instance_ = store; | |
| 19 window.localStorage.clear(); | |
| 20 | |
| 21 app = document.createElement('bookmarks-app'); | |
| 22 replaceBody(app); | |
| 23 }); | |
| 24 | |
| 25 test('write and load closed folder state', function() { | |
| 26 var closedFolders = {'1': true}; | |
| 27 store.data.closedFolders = closedFolders; | |
| 28 store.notifyObservers(); | |
| 29 | |
| 30 // Ensure closed folders are written to local storage. | |
| 31 assertDeepEquals( | |
| 32 JSON.stringify(closedFolders), | |
| 33 window.localStorage[LOCAL_STORAGE_CLOSED_FOLDERS_KEY]); | |
| 34 | |
| 35 store = new bookmarks.TestStore({}); | |
|
tsergeant
2017/03/30 04:19:57
I'm not keen on duplicating all the initialization
calamity
2017/04/03 03:48:41
Done. I also changed acceptInit to acceptInitOnce
| |
| 36 store.acceptInit(); | |
| 37 bookmarks.Store.instance_ = store; | |
| 38 | |
| 39 chrome.bookmarks.getTree = function(fn) { | |
| 40 fn([ | |
| 41 createFolder( | |
| 42 '0', | |
| 43 [ | |
| 44 createFolder( | |
| 45 '1', | |
| 46 [ | |
| 47 createFolder('11', []), | |
| 48 ]), | |
| 49 ]), | |
| 50 ]); | |
| 51 }; | |
| 52 app = document.createElement('bookmarks-app'); | |
| 53 replaceBody(app); | |
| 54 | |
| 55 // Ensure closed folders are read from local storage. | |
| 56 assertDeepEquals(closedFolders, store.data.closedFolders); | |
| 57 }); | |
| 58 }); | |
| OLD | NEW |