|
1 | 1 | /* global describe, it, before */
|
2 | 2 |
|
3 | 3 | const Brave = require('../lib/brave')
|
| 4 | +const Immutable = require('immutable') |
4 | 5 | const {urlInput, navigator, navigatorNotBookmarked, saveButton, deleteButton} = require('../lib/selectors')
|
5 | 6 | const siteTags = require('../../js/constants/siteTags')
|
6 | 7 |
|
@@ -196,5 +197,43 @@ describe('bookmark tests', function () {
|
196 | 197 | })
|
197 | 198 | })
|
198 | 199 | })
|
| 200 | + |
| 201 | + it('rebuilds the menu when add a list of items', function * () { |
| 202 | + const bookmarkTitle = 'bookmark-rebuild-menu-demo' |
| 203 | + const folderName = 'bookmark-folder-rebuild-menu-demo' |
| 204 | + const sites = Immutable.fromJS([ |
| 205 | + { |
| 206 | + customTitle: folderName, |
| 207 | + folderId: 1, |
| 208 | + parentFolderId: 0, |
| 209 | + tags: [siteTags.BOOKMARK_FOLDER] |
| 210 | + }, |
| 211 | + { |
| 212 | + lastAccessedTime: 123, |
| 213 | + title: bookmarkTitle, |
| 214 | + location: 'https://brave.com', |
| 215 | + tags: [siteTags.BOOKMARK] |
| 216 | + } |
| 217 | + ]) |
| 218 | + yield this.app.client |
| 219 | + .addSiteList(sites) |
| 220 | + .waitUntil(function () { |
| 221 | + return this.getAppState().then((val) => { |
| 222 | + const bookmarksMenu = val.value.menu.template.find((item) => { |
| 223 | + return item.label === 'Bookmarks' |
| 224 | + }) |
| 225 | + if (bookmarksMenu && bookmarksMenu.submenu) { |
| 226 | + const bookmark = bookmarksMenu.submenu.find((item) => { |
| 227 | + return item.label === bookmarkTitle |
| 228 | + }) |
| 229 | + const bookmarkFolder = bookmarksMenu.submenu.find((item) => { |
| 230 | + return item.label === folderName |
| 231 | + }) |
| 232 | + if (bookmark && bookmarkFolder) return true |
| 233 | + } |
| 234 | + return false |
| 235 | + }) |
| 236 | + }) |
| 237 | + }) |
199 | 238 | })
|
200 | 239 | })
|
0 commit comments