forked from brave/browser-laptop
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactors MenuBar and MenuBarItem into redux component
Resolves brave#8652 Auditors: @bsclifton @bridiver Test Plan: - open menu on windows - try clicking around - everything should behave as did before
- Loading branch information
Showing
7 changed files
with
130 additions
and
58 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) | ||
}) | ||
}) | ||
}) |