From 956108e8343550ce400c4c69fad0c4d97413dec4 Mon Sep 17 00:00:00 2001 From: NejcZdovc Date: Mon, 22 Jan 2018 08:07:35 +0100 Subject: [PATCH] Fixes upgrade of bookmark/folder width Resolves #9517 Resolves #9939 Auditors: Test Plan: --- app/browser/reducers/bookmarkToolbarReducer.js | 11 +++++++++-- .../browser/reducers/bookmarkToolbarReducerTest.js | 2 +- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/app/browser/reducers/bookmarkToolbarReducer.js b/app/browser/reducers/bookmarkToolbarReducer.js index 8621487dd81..cc75a48dcd8 100644 --- a/app/browser/reducers/bookmarkToolbarReducer.js +++ b/app/browser/reducers/bookmarkToolbarReducer.js @@ -2,6 +2,8 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this file, * You can obtain one at http://mozilla.org/MPL/2.0/. */ +const Immutable = require('immutable') + // Constants const appConstants = require('../../../js/constants/appConstants') @@ -20,13 +22,18 @@ const bookmarkToolbarReducer = (state, action, immutableAction) => { { // update session for 0.21.x version const bookmarks = bookmarksState.getBookmarks(state) + let list = Immutable.List() if (bookmarks.first() && !bookmarks.first().has('width')) { - textCalc.calcTextList(bookmarks.toList()) + list = bookmarks.toList() } const bookmarkFolders = bookmarkFoldersState.getFolders(state) if (bookmarkFolders.first() && !bookmarkFolders.first().has('width')) { - textCalc.calcTextList(bookmarkFolders.toList()) + list = list.concat(bookmarkFolders.toList()) + } + + if (!list.isEmpty()) { + textCalc.calcTextList(list) } } break diff --git a/test/unit/app/browser/reducers/bookmarkToolbarReducerTest.js b/test/unit/app/browser/reducers/bookmarkToolbarReducerTest.js index b1aa1fef7a0..32330bad97e 100644 --- a/test/unit/app/browser/reducers/bookmarkToolbarReducerTest.js +++ b/test/unit/app/browser/reducers/bookmarkToolbarReducerTest.js @@ -122,7 +122,7 @@ describe('bookmarkToolbarReducer unit test', function () { bookmarkToolbarReducer(stateWithData, { actionType: appConstants.APP_SET_STATE }) - assert.equal(spyCalc.callCount, 2) + assert.equal(spyCalc.callCount, 1) }) it('we are on version 0.21', function () {