Skip to content
This repository has been archived by the owner on Dec 11, 2019. It is now read-only.

Commit

Permalink
Merge pull request #9468 from brave/state-paths
Browse files Browse the repository at this point in the history
don’t convert paths to immutable
  • Loading branch information
bsclifton committed Jun 15, 2017
1 parent c9869a2 commit 02a7878
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/common/state/tabState.js
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ const tabState = {
if (index === tabState.TAB_ID_NONE) {
return null
}
return makeImmutable(['tabs', index])
return ['tabs', index]
},

getByTabId: (state, tabId) => {
Expand Down Expand Up @@ -534,7 +534,7 @@ const tabState = {
if (path == null) {
return null
}
return path.push('frame')
return path.concat(['frame'])
} else {
return frameState.getPathByTabId(state, tabId)
}
Expand Down
9 changes: 9 additions & 0 deletions test/unit/app/common/state/tabStateTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,15 @@ const shouldValidateAction = function (cb) {
}

describe('tabState unit tests', function () {
describe('getPathByTabId', function () {
it('returns null if tab is not found', function () {
assert.equal(tabState.getPathByTabId(twoTabsAppState, 333), null)
})
it('returns path if index found (as mutable array)', function () {
assert.deepEqual(tabState.getPathByTabId(twoTabsAppState, 1), ['tabs', 0])
})
})

describe('getByTabId', function () {
before(function () {
this.appState = twoTabsAppState
Expand Down

0 comments on commit 02a7878

Please sign in to comment.