Test menus with included setup options
This commit is contained in:
parent
c5d5f5abb8
commit
236a23d1ea
|
@ -155,6 +155,9 @@ exports.createTemplate = (options, messages) => {
|
|||
});
|
||||
}
|
||||
|
||||
fileMenu.submenu.unshift({
|
||||
type: 'separator',
|
||||
});
|
||||
fileMenu.submenu.unshift({
|
||||
label: messages.menuSetupAsNewDevice.message,
|
||||
click: setupAsNewDevice,
|
||||
|
|
|
@ -0,0 +1,180 @@
|
|||
[
|
||||
{
|
||||
"submenu": [
|
||||
{
|
||||
"label": "About Signal Desktop",
|
||||
"click": null
|
||||
},
|
||||
{
|
||||
"type": "separator"
|
||||
},
|
||||
{
|
||||
"label": "Preferences…",
|
||||
"accelerator": "CommandOrControl+,",
|
||||
"click": null
|
||||
},
|
||||
{
|
||||
"type": "separator"
|
||||
},
|
||||
{
|
||||
"role": "hide"
|
||||
},
|
||||
{
|
||||
"role": "hideothers"
|
||||
},
|
||||
{
|
||||
"role": "unhide"
|
||||
},
|
||||
{
|
||||
"type": "separator"
|
||||
},
|
||||
{
|
||||
"role": "quit"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"label": "&File",
|
||||
"submenu": [
|
||||
{
|
||||
"label": "Set up with import",
|
||||
"click": null
|
||||
},
|
||||
{
|
||||
"label": "Set up as new device",
|
||||
"click": null
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"label": "&Edit",
|
||||
"submenu": [
|
||||
{
|
||||
"role": "undo"
|
||||
},
|
||||
{
|
||||
"role": "redo"
|
||||
},
|
||||
{
|
||||
"type": "separator"
|
||||
},
|
||||
{
|
||||
"role": "cut"
|
||||
},
|
||||
{
|
||||
"role": "copy"
|
||||
},
|
||||
{
|
||||
"role": "paste"
|
||||
},
|
||||
{
|
||||
"role": "pasteandmatchstyle"
|
||||
},
|
||||
{
|
||||
"role": "delete"
|
||||
},
|
||||
{
|
||||
"role": "selectall"
|
||||
},
|
||||
{
|
||||
"type": "separator"
|
||||
},
|
||||
{
|
||||
"label": "Speech",
|
||||
"submenu": [
|
||||
{
|
||||
"role": "startspeaking"
|
||||
},
|
||||
{
|
||||
"role": "stopspeaking"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"label": "&View",
|
||||
"submenu": [
|
||||
{
|
||||
"role": "resetzoom"
|
||||
},
|
||||
{
|
||||
"role": "zoomin"
|
||||
},
|
||||
{
|
||||
"role": "zoomout"
|
||||
},
|
||||
{
|
||||
"type": "separator"
|
||||
},
|
||||
{
|
||||
"role": "togglefullscreen"
|
||||
},
|
||||
{
|
||||
"type": "separator"
|
||||
},
|
||||
{
|
||||
"label": "Debug Log",
|
||||
"click": null
|
||||
},
|
||||
{
|
||||
"type": "separator"
|
||||
},
|
||||
{
|
||||
"role": "toggledevtools"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"label": "&Window",
|
||||
"role": "window",
|
||||
"submenu": [
|
||||
{
|
||||
"accelerator": "CmdOrCtrl+W",
|
||||
"role": "close"
|
||||
},
|
||||
{
|
||||
"accelerator": "CmdOrCtrl+M",
|
||||
"role": "minimize"
|
||||
},
|
||||
{
|
||||
"role": "zoom"
|
||||
},
|
||||
{
|
||||
"label": "Show",
|
||||
"click": null
|
||||
},
|
||||
{
|
||||
"type": "separator"
|
||||
},
|
||||
{
|
||||
"role": "front"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"label": "&Help",
|
||||
"role": "help",
|
||||
"submenu": [
|
||||
{
|
||||
"label": "Go to release notes",
|
||||
"click": null
|
||||
},
|
||||
{
|
||||
"type": "separator"
|
||||
},
|
||||
{
|
||||
"label": "Go to forums",
|
||||
"click": null
|
||||
},
|
||||
{
|
||||
"label": "Go to support page",
|
||||
"click": null
|
||||
},
|
||||
{
|
||||
"label": "File a bug",
|
||||
"click": null
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
|
@ -0,0 +1,135 @@
|
|||
[
|
||||
{
|
||||
"label": "&File",
|
||||
"submenu": [
|
||||
{
|
||||
"label": "Set up with import",
|
||||
"click": null
|
||||
},
|
||||
{
|
||||
"label": "Set up as new device",
|
||||
"click": null
|
||||
},
|
||||
{
|
||||
"type": "separator"
|
||||
},
|
||||
{
|
||||
"label": "Preferences…",
|
||||
"accelerator": "CommandOrControl+,",
|
||||
"click": null
|
||||
},
|
||||
{
|
||||
"type": "separator"
|
||||
},
|
||||
{
|
||||
"role": "quit"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"label": "&Edit",
|
||||
"submenu": [
|
||||
{
|
||||
"role": "undo"
|
||||
},
|
||||
{
|
||||
"role": "redo"
|
||||
},
|
||||
{
|
||||
"type": "separator"
|
||||
},
|
||||
{
|
||||
"role": "cut"
|
||||
},
|
||||
{
|
||||
"role": "copy"
|
||||
},
|
||||
{
|
||||
"role": "paste"
|
||||
},
|
||||
{
|
||||
"role": "pasteandmatchstyle"
|
||||
},
|
||||
{
|
||||
"role": "delete"
|
||||
},
|
||||
{
|
||||
"role": "selectall"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"label": "&View",
|
||||
"submenu": [
|
||||
{
|
||||
"role": "resetzoom"
|
||||
},
|
||||
{
|
||||
"role": "zoomin"
|
||||
},
|
||||
{
|
||||
"role": "zoomout"
|
||||
},
|
||||
{
|
||||
"type": "separator"
|
||||
},
|
||||
{
|
||||
"role": "togglefullscreen"
|
||||
},
|
||||
{
|
||||
"type": "separator"
|
||||
},
|
||||
{
|
||||
"label": "Debug Log",
|
||||
"click": null
|
||||
},
|
||||
{
|
||||
"type": "separator"
|
||||
},
|
||||
{
|
||||
"role": "toggledevtools"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"label": "&Window",
|
||||
"role": "window",
|
||||
"submenu": [
|
||||
{
|
||||
"role": "minimize"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"label": "&Help",
|
||||
"role": "help",
|
||||
"submenu": [
|
||||
{
|
||||
"label": "Go to release notes",
|
||||
"click": null
|
||||
},
|
||||
{
|
||||
"type": "separator"
|
||||
},
|
||||
{
|
||||
"label": "Go to forums",
|
||||
"click": null
|
||||
},
|
||||
{
|
||||
"label": "Go to support page",
|
||||
"click": null
|
||||
},
|
||||
{
|
||||
"label": "File a bug",
|
||||
"click": null
|
||||
},
|
||||
{
|
||||
"type": "separator"
|
||||
},
|
||||
{
|
||||
"label": "About Signal Desktop",
|
||||
"click": null
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
|
@ -3,36 +3,43 @@ const { assert } = require('chai');
|
|||
const SignalMenu = require('../../app/menu');
|
||||
const { load: loadLocale } = require('../../app/locale');
|
||||
|
||||
const FIXTURE_MENU_MAC_OS = require('./fixtures/menu-mac-os');
|
||||
const FIXTURE_MENU_WINDOWS_LINUX = require('./fixtures/menu-windows-linux');
|
||||
|
||||
const PLATFORMS = [
|
||||
{
|
||||
label: 'macOS',
|
||||
platform: 'darwin',
|
||||
fixture: FIXTURE_MENU_MAC_OS,
|
||||
fixtures: {
|
||||
default: './fixtures/menu-mac-os',
|
||||
setup: './fixtures/menu-mac-os-setup',
|
||||
},
|
||||
},
|
||||
{
|
||||
label: 'Windows',
|
||||
platform: 'win32',
|
||||
fixture: FIXTURE_MENU_WINDOWS_LINUX,
|
||||
fixtures: {
|
||||
default: './fixtures/menu-windows-linux',
|
||||
setup: './fixtures/menu-windows-linux-setup',
|
||||
},
|
||||
},
|
||||
{
|
||||
label: 'Linux',
|
||||
platform: 'linux',
|
||||
fixture: FIXTURE_MENU_WINDOWS_LINUX,
|
||||
fixtures: {
|
||||
default: './fixtures/menu-windows-linux',
|
||||
setup: './fixtures/menu-windows-linux-setup',
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
const INCLUDE_SETUP_OPTIONS = [false];
|
||||
const INCLUDE_SETUP_OPTIONS = [false, true];
|
||||
|
||||
describe('SignalMenu', () => {
|
||||
describe('createTemplate', () => {
|
||||
PLATFORMS.forEach(({ label, platform, fixture }) => {
|
||||
PLATFORMS.forEach(({ label, platform, fixtures }) => {
|
||||
context(label, () => {
|
||||
INCLUDE_SETUP_OPTIONS.forEach((includeSetup) => {
|
||||
const prefix = includeSetup ? 'with' : 'without';
|
||||
context(`${prefix} included setup`, () => {
|
||||
context(`${prefix} setup options`, () => {
|
||||
it('should return correct template', () => {
|
||||
const logger = {
|
||||
error(message) {
|
||||
|
@ -58,6 +65,9 @@ describe('SignalMenu', () => {
|
|||
const { messages } = loadLocale({ appLocale, logger });
|
||||
|
||||
const actual = SignalMenu.createTemplate(options, messages);
|
||||
const fixturePath = includeSetup ? fixtures.setup : fixtures.default;
|
||||
// eslint-disable-next-line global-require, import/no-dynamic-require
|
||||
const fixture = require(fixturePath);
|
||||
assert.deepEqual(actual, fixture);
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue