This repository has been archived by the owner on Dec 11, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 975
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8656 from NejcZdovc/redux/menubar
Refactors MenuBar and MenuBarItem into redux component
- Loading branch information
Showing
7 changed files
with
133 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* 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 {isWindows} = require('../lib/platformUtil') | ||
const {getSetting} = require('../../../js/settings') | ||
const settings = require('../../../js/constants/settings') | ||
|
||
const api = { | ||
isMenuBarVisible: (windowState) => { | ||
return isWindows() && (!getSetting(settings.AUTO_HIDE_MENU) || windowState.getIn(['ui', 'menubar', 'isVisible'])) | ||
} | ||
} | ||
|
||
module.exports = api |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* global describe, it */ | ||
const Immutable = require('immutable') | ||
const contextMenuState = require('../../../../../app/common/state/contextMenuState.js') | ||
const assert = require('chai').assert | ||
|
||
const defaultWindowState = Immutable.fromJS({ | ||
ui: { | ||
contextMenu: { | ||
selectedIndex: null | ||
} | ||
} | ||
}) | ||
|
||
describe('contextMenuState', function () { | ||
describe('selectedIndex', function () { | ||
it('returns null if selectedIndex is not set', function () { | ||
const result = contextMenuState.selectedIndex(defaultWindowState) | ||
assert.equal(result, null) | ||
}) | ||
|
||
it('returns null if selectedIndex is only number', function () { | ||
const index = 0 | ||
const newState = defaultWindowState.setIn(['ui', 'contextMenu', 'selectedIndex'], index) | ||
const result = contextMenuState.selectedIndex(newState) | ||
assert.equal(result, null) | ||
}) | ||
|
||
it('returns array of selected index', function () { | ||
const index = [0] | ||
const newState = defaultWindowState.setIn(['ui', 'contextMenu', 'selectedIndex'], index) | ||
const result = contextMenuState.selectedIndex(newState) | ||
assert.equal(result, index) | ||
}) | ||
}) | ||
}) |