Move menu tests to TypeScript
This commit is contained in:
parent
a014337e72
commit
206f461370
9 changed files with 273 additions and 1180 deletions
|
@ -1,4 +1,4 @@
|
||||||
// Copyright 2017-2020 Signal Messenger, LLC
|
// Copyright 2017-2022 Signal Messenger, LLC
|
||||||
// SPDX-License-Identifier: AGPL-3.0-only
|
// SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
import { join } from 'path';
|
import { join } from 'path';
|
||||||
|
@ -43,7 +43,7 @@ export function load({
|
||||||
logger,
|
logger,
|
||||||
}: {
|
}: {
|
||||||
appLocale: string;
|
appLocale: string;
|
||||||
logger: LoggerType;
|
logger: Pick<LoggerType, 'error'>;
|
||||||
}): LocaleType {
|
}): LocaleType {
|
||||||
if (!appLocale) {
|
if (!appLocale) {
|
||||||
throw new TypeError('`appLocale` is required');
|
throw new TypeError('`appLocale` is required');
|
||||||
|
|
|
@ -1,160 +0,0 @@
|
||||||
[
|
|
||||||
{
|
|
||||||
"label": "&File",
|
|
||||||
"submenu": [
|
|
||||||
{
|
|
||||||
"label": "Set Up as New Device",
|
|
||||||
"click": null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "separator"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Create/upload sticker pack",
|
|
||||||
"click": null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"accelerator": "CommandOrControl+,",
|
|
||||||
"label": "Preferences…",
|
|
||||||
"click": null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "separator"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Quit Signal",
|
|
||||||
"role": "quit"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "&Edit",
|
|
||||||
"submenu": [
|
|
||||||
{
|
|
||||||
"label": "Undo",
|
|
||||||
"role": "undo"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Redo",
|
|
||||||
"role": "redo"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "separator"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Cut",
|
|
||||||
"role": "cut"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Copy",
|
|
||||||
"role": "copy"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Paste",
|
|
||||||
"role": "paste"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Paste and Match Style",
|
|
||||||
"role": "pasteAndMatchStyle"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Delete",
|
|
||||||
"role": "delete"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Select All",
|
|
||||||
"role": "selectAll"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "&View",
|
|
||||||
"submenu": [
|
|
||||||
{
|
|
||||||
"label": "Actual Size",
|
|
||||||
"role": "resetZoom"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"accelerator": "Control+=",
|
|
||||||
"label": "Zoom In",
|
|
||||||
"role": "zoomIn"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Zoom Out",
|
|
||||||
"role": "zoomOut"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "separator"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Toggle Full Screen",
|
|
||||||
"role": "togglefullscreen"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "separator"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Debug Log",
|
|
||||||
"click": null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "separator"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Toggle Developer Tools",
|
|
||||||
"role": "toggleDevTools"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "&Window",
|
|
||||||
"role": "window",
|
|
||||||
"submenu": [
|
|
||||||
{
|
|
||||||
"label": "Minimize",
|
|
||||||
"role": "minimize"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "&Help",
|
|
||||||
"role": "help",
|
|
||||||
"submenu": [
|
|
||||||
{
|
|
||||||
"label": "Show Keyboard Shortcuts",
|
|
||||||
"accelerator": "CmdOrCtrl+/",
|
|
||||||
"click": null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "separator"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Contact Us",
|
|
||||||
"click": null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Go to Release Notes",
|
|
||||||
"click": null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Go to Forums",
|
|
||||||
"click": null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Go to Support Page",
|
|
||||||
"click": null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Join the Beta",
|
|
||||||
"click": null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "separator"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "About Signal Desktop",
|
|
||||||
"click": null
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
|
@ -1,153 +0,0 @@
|
||||||
[
|
|
||||||
{
|
|
||||||
"label": "&File",
|
|
||||||
"submenu": [
|
|
||||||
{
|
|
||||||
"label": "Create/upload sticker pack",
|
|
||||||
"click": null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"accelerator": "CommandOrControl+,",
|
|
||||||
"label": "Preferences…",
|
|
||||||
"click": null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "separator"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Quit Signal",
|
|
||||||
"role": "quit"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "&Edit",
|
|
||||||
"submenu": [
|
|
||||||
{
|
|
||||||
"label": "Undo",
|
|
||||||
"role": "undo"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Redo",
|
|
||||||
"role": "redo"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "separator"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Cut",
|
|
||||||
"role": "cut"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Copy",
|
|
||||||
"role": "copy"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Paste",
|
|
||||||
"role": "paste"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Paste and Match Style",
|
|
||||||
"role": "pasteAndMatchStyle"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Delete",
|
|
||||||
"role": "delete"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Select All",
|
|
||||||
"role": "selectAll"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "&View",
|
|
||||||
"submenu": [
|
|
||||||
{
|
|
||||||
"label": "Actual Size",
|
|
||||||
"role": "resetZoom"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"accelerator": "Control+=",
|
|
||||||
"label": "Zoom In",
|
|
||||||
"role": "zoomIn"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Zoom Out",
|
|
||||||
"role": "zoomOut"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "separator"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Toggle Full Screen",
|
|
||||||
"role": "togglefullscreen"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "separator"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Debug Log",
|
|
||||||
"click": null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "separator"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Toggle Developer Tools",
|
|
||||||
"role": "toggleDevTools"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "&Window",
|
|
||||||
"role": "window",
|
|
||||||
"submenu": [
|
|
||||||
{
|
|
||||||
"label": "Minimize",
|
|
||||||
"role": "minimize"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "&Help",
|
|
||||||
"role": "help",
|
|
||||||
"submenu": [
|
|
||||||
{
|
|
||||||
"label": "Show Keyboard Shortcuts",
|
|
||||||
"accelerator": "CmdOrCtrl+/",
|
|
||||||
"click": null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "separator"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Contact Us",
|
|
||||||
"click": null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Go to Release Notes",
|
|
||||||
"click": null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Go to Forums",
|
|
||||||
"click": null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Go to Support Page",
|
|
||||||
"click": null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Join the Beta",
|
|
||||||
"click": null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "separator"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "About Signal Desktop",
|
|
||||||
"click": null
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
|
@ -1,232 +0,0 @@
|
||||||
[
|
|
||||||
{
|
|
||||||
"label": "Signal Desktop",
|
|
||||||
"submenu": [
|
|
||||||
{
|
|
||||||
"label": "About Signal Desktop",
|
|
||||||
"click": null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "separator"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Preferences…",
|
|
||||||
"accelerator": "CommandOrControl+,",
|
|
||||||
"click": null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "separator"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Services",
|
|
||||||
"role": "services"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "separator"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Hide",
|
|
||||||
"role": "hide"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Hide Others",
|
|
||||||
"role": "hideOthers"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Show All",
|
|
||||||
"role": "unhide"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "separator"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Quit Signal",
|
|
||||||
"role": "quit"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "&File",
|
|
||||||
"submenu": [
|
|
||||||
{
|
|
||||||
"label": "Set Up as New Device",
|
|
||||||
"click": null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "separator"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Create/upload sticker pack",
|
|
||||||
"click": null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "separator"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"accelerator": "CmdOrCtrl+W",
|
|
||||||
"label": "Close Window",
|
|
||||||
"role": "close"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "&Edit",
|
|
||||||
"submenu": [
|
|
||||||
{
|
|
||||||
"label": "Undo",
|
|
||||||
"role": "undo"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Redo",
|
|
||||||
"role": "redo"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "separator"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Cut",
|
|
||||||
"role": "cut"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Copy",
|
|
||||||
"role": "copy"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Paste",
|
|
||||||
"role": "paste"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Paste and Match Style",
|
|
||||||
"role": "pasteAndMatchStyle"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Delete",
|
|
||||||
"role": "delete"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Select All",
|
|
||||||
"role": "selectAll"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "separator"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Speech",
|
|
||||||
"submenu": [
|
|
||||||
{
|
|
||||||
"label": "Start speaking",
|
|
||||||
"role": "startSpeaking"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Stop speaking",
|
|
||||||
"role": "stopSpeaking"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "&View",
|
|
||||||
"submenu": [
|
|
||||||
{
|
|
||||||
"label": "Actual Size",
|
|
||||||
"role": "resetZoom"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"accelerator": "Command+=",
|
|
||||||
"label": "Zoom In",
|
|
||||||
"role": "zoomIn"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Zoom Out",
|
|
||||||
"role": "zoomOut"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "separator"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Toggle Full Screen",
|
|
||||||
"role": "togglefullscreen"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "separator"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Debug Log",
|
|
||||||
"click": null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "separator"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Toggle Developer Tools",
|
|
||||||
"role": "toggleDevTools"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Force Update",
|
|
||||||
"click": null
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "&Window",
|
|
||||||
"role": "window",
|
|
||||||
"submenu": [
|
|
||||||
{
|
|
||||||
"label": "Minimize",
|
|
||||||
"accelerator": "CmdOrCtrl+M",
|
|
||||||
"role": "minimize"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Zoom",
|
|
||||||
"role": "zoom"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Show",
|
|
||||||
"accelerator": "CmdOrCtrl+Shift+0",
|
|
||||||
"click": null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "separator"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Bring All to Front",
|
|
||||||
"role": "front"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "&Help",
|
|
||||||
"role": "help",
|
|
||||||
"submenu": [
|
|
||||||
{
|
|
||||||
"label": "Show Keyboard Shortcuts",
|
|
||||||
"accelerator": "CmdOrCtrl+/",
|
|
||||||
"click": null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "separator"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Contact Us",
|
|
||||||
"click": null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Go to Release Notes",
|
|
||||||
"click": null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Go to Forums",
|
|
||||||
"click": null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Go to Support Page",
|
|
||||||
"click": null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Join the Beta",
|
|
||||||
"click": null
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
|
@ -1,225 +0,0 @@
|
||||||
[
|
|
||||||
{
|
|
||||||
"label": "Signal Desktop",
|
|
||||||
"submenu": [
|
|
||||||
{
|
|
||||||
"label": "About Signal Desktop",
|
|
||||||
"click": null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "separator"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Preferences…",
|
|
||||||
"accelerator": "CommandOrControl+,",
|
|
||||||
"click": null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "separator"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Services",
|
|
||||||
"role": "services"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "separator"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Hide",
|
|
||||||
"role": "hide"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Hide Others",
|
|
||||||
"role": "hideOthers"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Show All",
|
|
||||||
"role": "unhide"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "separator"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Quit Signal",
|
|
||||||
"role": "quit"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "&File",
|
|
||||||
"submenu": [
|
|
||||||
{
|
|
||||||
"label": "Create/upload sticker pack",
|
|
||||||
"click": null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "separator"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"accelerator": "CmdOrCtrl+W",
|
|
||||||
"label": "Close Window",
|
|
||||||
"role": "close"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "&Edit",
|
|
||||||
"submenu": [
|
|
||||||
{
|
|
||||||
"label": "Undo",
|
|
||||||
"role": "undo"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Redo",
|
|
||||||
"role": "redo"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "separator"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Cut",
|
|
||||||
"role": "cut"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Copy",
|
|
||||||
"role": "copy"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Paste",
|
|
||||||
"role": "paste"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Paste and Match Style",
|
|
||||||
"role": "pasteAndMatchStyle"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Delete",
|
|
||||||
"role": "delete"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Select All",
|
|
||||||
"role": "selectAll"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "separator"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Speech",
|
|
||||||
"submenu": [
|
|
||||||
{
|
|
||||||
"label": "Start speaking",
|
|
||||||
"role": "startSpeaking"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Stop speaking",
|
|
||||||
"role": "stopSpeaking"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "&View",
|
|
||||||
"submenu": [
|
|
||||||
{
|
|
||||||
"label": "Actual Size",
|
|
||||||
"role": "resetZoom"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"accelerator": "Command+=",
|
|
||||||
"label": "Zoom In",
|
|
||||||
"role": "zoomIn"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Zoom Out",
|
|
||||||
"role": "zoomOut"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "separator"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Toggle Full Screen",
|
|
||||||
"role": "togglefullscreen"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "separator"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Debug Log",
|
|
||||||
"click": null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "separator"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Toggle Developer Tools",
|
|
||||||
"role": "toggleDevTools"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Force Update",
|
|
||||||
"click": null
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "&Window",
|
|
||||||
"role": "window",
|
|
||||||
"submenu": [
|
|
||||||
{
|
|
||||||
"label": "Minimize",
|
|
||||||
"accelerator": "CmdOrCtrl+M",
|
|
||||||
"role": "minimize"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Zoom",
|
|
||||||
"role": "zoom"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Show",
|
|
||||||
"accelerator": "CmdOrCtrl+Shift+0",
|
|
||||||
"click": null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "separator"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Bring All to Front",
|
|
||||||
"role": "front"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "&Help",
|
|
||||||
"role": "help",
|
|
||||||
"submenu": [
|
|
||||||
{
|
|
||||||
"label": "Show Keyboard Shortcuts",
|
|
||||||
"accelerator": "CmdOrCtrl+/",
|
|
||||||
"click": null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "separator"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Contact Us",
|
|
||||||
"click": null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Go to Release Notes",
|
|
||||||
"click": null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Go to Forums",
|
|
||||||
"click": null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Go to Support Page",
|
|
||||||
"click": null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Join the Beta",
|
|
||||||
"click": null
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
|
@ -1,164 +0,0 @@
|
||||||
[
|
|
||||||
{
|
|
||||||
"label": "&File",
|
|
||||||
"submenu": [
|
|
||||||
{
|
|
||||||
"label": "Set Up as New Device",
|
|
||||||
"click": null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "separator"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Create/upload sticker pack",
|
|
||||||
"click": null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"accelerator": "CommandOrControl+,",
|
|
||||||
"label": "Preferences…",
|
|
||||||
"click": null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "separator"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Quit Signal",
|
|
||||||
"role": "quit"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "&Edit",
|
|
||||||
"submenu": [
|
|
||||||
{
|
|
||||||
"label": "Undo",
|
|
||||||
"role": "undo"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Redo",
|
|
||||||
"role": "redo"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "separator"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Cut",
|
|
||||||
"role": "cut"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Copy",
|
|
||||||
"role": "copy"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Paste",
|
|
||||||
"role": "paste"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Paste and Match Style",
|
|
||||||
"role": "pasteAndMatchStyle"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Delete",
|
|
||||||
"role": "delete"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Select All",
|
|
||||||
"role": "selectAll"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "&View",
|
|
||||||
"submenu": [
|
|
||||||
{
|
|
||||||
"label": "Actual Size",
|
|
||||||
"role": "resetZoom"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"accelerator": "Control+=",
|
|
||||||
"label": "Zoom In",
|
|
||||||
"role": "zoomIn"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Zoom Out",
|
|
||||||
"role": "zoomOut"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "separator"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Toggle Full Screen",
|
|
||||||
"role": "togglefullscreen"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "separator"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Debug Log",
|
|
||||||
"click": null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "separator"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Toggle Developer Tools",
|
|
||||||
"role": "toggleDevTools"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Force Update",
|
|
||||||
"click": null
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "&Window",
|
|
||||||
"role": "window",
|
|
||||||
"submenu": [
|
|
||||||
{
|
|
||||||
"label": "Minimize",
|
|
||||||
"role": "minimize"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "&Help",
|
|
||||||
"role": "help",
|
|
||||||
"submenu": [
|
|
||||||
{
|
|
||||||
"label": "Show Keyboard Shortcuts",
|
|
||||||
"accelerator": "CmdOrCtrl+/",
|
|
||||||
"click": null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "separator"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Contact Us",
|
|
||||||
"click": null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Go to Release Notes",
|
|
||||||
"click": null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Go to Forums",
|
|
||||||
"click": null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Go to Support Page",
|
|
||||||
"click": null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Join the Beta",
|
|
||||||
"click": null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "separator"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "About Signal Desktop",
|
|
||||||
"click": null
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
|
@ -1,157 +0,0 @@
|
||||||
[
|
|
||||||
{
|
|
||||||
"label": "&File",
|
|
||||||
"submenu": [
|
|
||||||
{
|
|
||||||
"label": "Create/upload sticker pack",
|
|
||||||
"click": null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"accelerator": "CommandOrControl+,",
|
|
||||||
"label": "Preferences…",
|
|
||||||
"click": null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "separator"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Quit Signal",
|
|
||||||
"role": "quit"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "&Edit",
|
|
||||||
"submenu": [
|
|
||||||
{
|
|
||||||
"label": "Undo",
|
|
||||||
"role": "undo"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Redo",
|
|
||||||
"role": "redo"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "separator"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Cut",
|
|
||||||
"role": "cut"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Copy",
|
|
||||||
"role": "copy"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Paste",
|
|
||||||
"role": "paste"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Paste and Match Style",
|
|
||||||
"role": "pasteAndMatchStyle"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Delete",
|
|
||||||
"role": "delete"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Select All",
|
|
||||||
"role": "selectAll"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "&View",
|
|
||||||
"submenu": [
|
|
||||||
{
|
|
||||||
"label": "Actual Size",
|
|
||||||
"role": "resetZoom"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"accelerator": "Control+=",
|
|
||||||
"label": "Zoom In",
|
|
||||||
"role": "zoomIn"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Zoom Out",
|
|
||||||
"role": "zoomOut"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "separator"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Toggle Full Screen",
|
|
||||||
"role": "togglefullscreen"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "separator"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Debug Log",
|
|
||||||
"click": null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "separator"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Toggle Developer Tools",
|
|
||||||
"role": "toggleDevTools"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Force Update",
|
|
||||||
"click": null
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "&Window",
|
|
||||||
"role": "window",
|
|
||||||
"submenu": [
|
|
||||||
{
|
|
||||||
"label": "Minimize",
|
|
||||||
"role": "minimize"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "&Help",
|
|
||||||
"role": "help",
|
|
||||||
"submenu": [
|
|
||||||
{
|
|
||||||
"label": "Show Keyboard Shortcuts",
|
|
||||||
"accelerator": "CmdOrCtrl+/",
|
|
||||||
"click": null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "separator"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Contact Us",
|
|
||||||
"click": null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Go to Release Notes",
|
|
||||||
"click": null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Go to Forums",
|
|
||||||
"click": null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Go to Support Page",
|
|
||||||
"click": null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Join the Beta",
|
|
||||||
"click": null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "separator"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "About Signal Desktop",
|
|
||||||
"click": null
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
|
@ -1,87 +0,0 @@
|
||||||
// Copyright 2018-2020 Signal Messenger, LLC
|
|
||||||
// SPDX-License-Identifier: AGPL-3.0-only
|
|
||||||
|
|
||||||
const { assert } = require('chai');
|
|
||||||
|
|
||||||
const SignalMenu = require('../../app/menu');
|
|
||||||
const { load: loadLocale } = require('../../app/locale');
|
|
||||||
|
|
||||||
const PLATFORMS = [
|
|
||||||
{
|
|
||||||
label: 'macOS',
|
|
||||||
platform: 'darwin',
|
|
||||||
fixtures: {
|
|
||||||
default: './fixtures/menu-mac-os',
|
|
||||||
setup: './fixtures/menu-mac-os-setup',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: 'Windows',
|
|
||||||
platform: 'win32',
|
|
||||||
fixtures: {
|
|
||||||
default: './fixtures/menu-windows',
|
|
||||||
setup: './fixtures/menu-windows-setup',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: 'Linux',
|
|
||||||
platform: 'linux',
|
|
||||||
fixtures: {
|
|
||||||
default: './fixtures/menu-linux',
|
|
||||||
setup: './fixtures/menu-linux-setup',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
];
|
|
||||||
|
|
||||||
const INCLUDE_SETUP_OPTIONS = [false, true];
|
|
||||||
|
|
||||||
describe('SignalMenu', () => {
|
|
||||||
describe('createTemplate', () => {
|
|
||||||
PLATFORMS.forEach(({ label, platform, fixtures }) => {
|
|
||||||
context(label, () => {
|
|
||||||
INCLUDE_SETUP_OPTIONS.forEach(includeSetup => {
|
|
||||||
const prefix = includeSetup ? 'with' : 'without';
|
|
||||||
context(`${prefix} setup options`, () => {
|
|
||||||
it('should return correct template', () => {
|
|
||||||
const logger = {
|
|
||||||
error(message) {
|
|
||||||
throw new Error(message);
|
|
||||||
},
|
|
||||||
};
|
|
||||||
const options = {
|
|
||||||
isProduction: true,
|
|
||||||
devTools: true,
|
|
||||||
openContactUs: null,
|
|
||||||
openForums: null,
|
|
||||||
openJoinTheBeta: null,
|
|
||||||
openReleaseNotes: null,
|
|
||||||
openSupportPage: null,
|
|
||||||
platform,
|
|
||||||
includeSetup,
|
|
||||||
setupAsNewDevice: null,
|
|
||||||
setupAsStandalone: null,
|
|
||||||
forceUpdate: null,
|
|
||||||
showAbout: null,
|
|
||||||
showDebugLog: null,
|
|
||||||
showKeyboardShortcuts: null,
|
|
||||||
showSettings: null,
|
|
||||||
showStickerCreator: null,
|
|
||||||
showWindow: null,
|
|
||||||
};
|
|
||||||
const appLocale = 'en';
|
|
||||||
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);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
271
ts/test-node/app/menu_test.ts
Normal file
271
ts/test-node/app/menu_test.ts
Normal file
|
@ -0,0 +1,271 @@
|
||||||
|
// Copyright 2018-2022 Signal Messenger, LLC
|
||||||
|
// SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
|
import { assert } from 'chai';
|
||||||
|
import { stub } from 'sinon';
|
||||||
|
import type { MenuItemConstructorOptions } from 'electron';
|
||||||
|
|
||||||
|
import type { MenuListType, MenuOptionsType } from '../../../app/menu';
|
||||||
|
import { createTemplate } from '../../../app/menu';
|
||||||
|
import { load as loadLocale } from '../../../app/locale';
|
||||||
|
|
||||||
|
const forceUpdate = stub();
|
||||||
|
const openContactUs = stub();
|
||||||
|
const openForums = stub();
|
||||||
|
const openJoinTheBeta = stub();
|
||||||
|
const openReleaseNotes = stub();
|
||||||
|
const openSupportPage = stub();
|
||||||
|
const setupAsNewDevice = stub();
|
||||||
|
const setupAsStandalone = stub();
|
||||||
|
const showAbout = stub();
|
||||||
|
const showDebugLog = stub();
|
||||||
|
const showKeyboardShortcuts = stub();
|
||||||
|
const showSettings = stub();
|
||||||
|
const showStickerCreator = stub();
|
||||||
|
const showWindow = stub();
|
||||||
|
|
||||||
|
const getExpectedEditMenu = (
|
||||||
|
includeSpeech: boolean
|
||||||
|
): MenuItemConstructorOptions => ({
|
||||||
|
label: '&Edit',
|
||||||
|
submenu: [
|
||||||
|
{ label: 'Undo', role: 'undo' },
|
||||||
|
{ label: 'Redo', role: 'redo' },
|
||||||
|
{ type: 'separator' },
|
||||||
|
{ label: 'Cut', role: 'cut' },
|
||||||
|
{ label: 'Copy', role: 'copy' },
|
||||||
|
{ label: 'Paste', role: 'paste' },
|
||||||
|
{ label: 'Paste and Match Style', role: 'pasteAndMatchStyle' },
|
||||||
|
{ label: 'Delete', role: 'delete' },
|
||||||
|
{ label: 'Select All', role: 'selectAll' },
|
||||||
|
...(includeSpeech
|
||||||
|
? ([
|
||||||
|
{ type: 'separator' },
|
||||||
|
{
|
||||||
|
label: 'Speech',
|
||||||
|
submenu: [
|
||||||
|
{ label: 'Start speaking', role: 'startSpeaking' },
|
||||||
|
{ label: 'Stop speaking', role: 'stopSpeaking' },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
] as MenuListType)
|
||||||
|
: []),
|
||||||
|
],
|
||||||
|
});
|
||||||
|
|
||||||
|
const getExpectedViewMenu = (
|
||||||
|
zoomModifier: 'Command' | 'Control'
|
||||||
|
): MenuItemConstructorOptions => ({
|
||||||
|
label: '&View',
|
||||||
|
submenu: [
|
||||||
|
{ label: 'Actual Size', role: 'resetZoom' },
|
||||||
|
{ accelerator: `${zoomModifier}+=`, label: 'Zoom In', role: 'zoomIn' },
|
||||||
|
{ label: 'Zoom Out', role: 'zoomOut' },
|
||||||
|
{ type: 'separator' },
|
||||||
|
{ label: 'Toggle Full Screen', role: 'togglefullscreen' },
|
||||||
|
{ type: 'separator' },
|
||||||
|
{ label: 'Debug Log', click: showDebugLog },
|
||||||
|
{ type: 'separator' },
|
||||||
|
{ label: 'Toggle Developer Tools', role: 'toggleDevTools' },
|
||||||
|
{ label: 'Force Update', click: forceUpdate },
|
||||||
|
],
|
||||||
|
});
|
||||||
|
|
||||||
|
const getExpectedHelpMenu = (
|
||||||
|
includeAbout: boolean
|
||||||
|
): MenuItemConstructorOptions => ({
|
||||||
|
label: '&Help',
|
||||||
|
role: 'help',
|
||||||
|
submenu: [
|
||||||
|
{
|
||||||
|
label: 'Show Keyboard Shortcuts',
|
||||||
|
accelerator: 'CmdOrCtrl+/',
|
||||||
|
click: showKeyboardShortcuts,
|
||||||
|
},
|
||||||
|
{ type: 'separator' },
|
||||||
|
{ label: 'Contact Us', click: openContactUs },
|
||||||
|
{ label: 'Go to Release Notes', click: openReleaseNotes },
|
||||||
|
{ label: 'Go to Forums', click: openForums },
|
||||||
|
{ label: 'Go to Support Page', click: openSupportPage },
|
||||||
|
{ label: 'Join the Beta', click: openJoinTheBeta },
|
||||||
|
...(includeAbout
|
||||||
|
? ([
|
||||||
|
{ type: 'separator' },
|
||||||
|
{ label: 'About Signal Desktop', click: showAbout },
|
||||||
|
] as MenuListType)
|
||||||
|
: []),
|
||||||
|
],
|
||||||
|
});
|
||||||
|
|
||||||
|
const EXPECTED_MACOS: MenuListType = [
|
||||||
|
{
|
||||||
|
label: 'Signal Desktop',
|
||||||
|
submenu: [
|
||||||
|
{ label: 'About Signal Desktop', click: showAbout },
|
||||||
|
{ type: 'separator' },
|
||||||
|
{
|
||||||
|
label: 'Preferences…',
|
||||||
|
accelerator: 'CommandOrControl+,',
|
||||||
|
click: showSettings,
|
||||||
|
},
|
||||||
|
{ type: 'separator' },
|
||||||
|
{ label: 'Services', role: 'services' },
|
||||||
|
{ type: 'separator' },
|
||||||
|
{ label: 'Hide', role: 'hide' },
|
||||||
|
{ label: 'Hide Others', role: 'hideOthers' },
|
||||||
|
{ label: 'Show All', role: 'unhide' },
|
||||||
|
{ type: 'separator' },
|
||||||
|
{ label: 'Quit Signal', role: 'quit' },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '&File',
|
||||||
|
submenu: [
|
||||||
|
{ label: 'Create/upload sticker pack', click: showStickerCreator },
|
||||||
|
{ type: 'separator' },
|
||||||
|
{ accelerator: 'CmdOrCtrl+W', label: 'Close Window', role: 'close' },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
getExpectedEditMenu(true),
|
||||||
|
getExpectedViewMenu('Command'),
|
||||||
|
{
|
||||||
|
label: '&Window',
|
||||||
|
role: 'window',
|
||||||
|
submenu: [
|
||||||
|
{ label: 'Minimize', accelerator: 'CmdOrCtrl+M', role: 'minimize' },
|
||||||
|
{ label: 'Zoom', role: 'zoom' },
|
||||||
|
{ label: 'Show', accelerator: 'CmdOrCtrl+Shift+0', click: showWindow },
|
||||||
|
{ type: 'separator' },
|
||||||
|
{ label: 'Bring All to Front', role: 'front' },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
getExpectedHelpMenu(false),
|
||||||
|
];
|
||||||
|
|
||||||
|
const EXPECTED_WINDOWS: MenuListType = [
|
||||||
|
{
|
||||||
|
label: '&File',
|
||||||
|
submenu: [
|
||||||
|
{ label: 'Create/upload sticker pack', click: showStickerCreator },
|
||||||
|
{
|
||||||
|
label: 'Preferences…',
|
||||||
|
accelerator: 'CommandOrControl+,',
|
||||||
|
click: showSettings,
|
||||||
|
},
|
||||||
|
{ type: 'separator' },
|
||||||
|
{ label: 'Quit Signal', role: 'quit' },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
getExpectedEditMenu(false),
|
||||||
|
getExpectedViewMenu('Control'),
|
||||||
|
{
|
||||||
|
label: '&Window',
|
||||||
|
role: 'window',
|
||||||
|
submenu: [{ label: 'Minimize', role: 'minimize' }],
|
||||||
|
},
|
||||||
|
getExpectedHelpMenu(true),
|
||||||
|
];
|
||||||
|
|
||||||
|
const EXPECTED_LINUX: MenuListType = EXPECTED_WINDOWS.map(menuItem => {
|
||||||
|
if (menuItem.label === '&View' && Array.isArray(menuItem.submenu)) {
|
||||||
|
return {
|
||||||
|
...menuItem,
|
||||||
|
submenu: menuItem.submenu.filter(
|
||||||
|
submenuItem => submenuItem.label !== 'Force Update'
|
||||||
|
),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
return menuItem;
|
||||||
|
});
|
||||||
|
|
||||||
|
const PLATFORMS = [
|
||||||
|
{
|
||||||
|
label: 'macOS',
|
||||||
|
platform: 'darwin',
|
||||||
|
expectedDefault: EXPECTED_MACOS,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Windows',
|
||||||
|
platform: 'win32',
|
||||||
|
expectedDefault: EXPECTED_WINDOWS,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Linux',
|
||||||
|
platform: 'linux',
|
||||||
|
expectedDefault: EXPECTED_LINUX,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
describe('createTemplate', () => {
|
||||||
|
const { messages } = loadLocale({
|
||||||
|
appLocale: 'en',
|
||||||
|
logger: {
|
||||||
|
error(arg: unknown) {
|
||||||
|
throw new Error(String(arg));
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const actions = {
|
||||||
|
forceUpdate,
|
||||||
|
openContactUs,
|
||||||
|
openForums,
|
||||||
|
openJoinTheBeta,
|
||||||
|
openReleaseNotes,
|
||||||
|
openSupportPage,
|
||||||
|
setupAsNewDevice,
|
||||||
|
setupAsStandalone,
|
||||||
|
showAbout,
|
||||||
|
showDebugLog,
|
||||||
|
showKeyboardShortcuts,
|
||||||
|
showSettings,
|
||||||
|
showStickerCreator,
|
||||||
|
showWindow,
|
||||||
|
};
|
||||||
|
|
||||||
|
PLATFORMS.forEach(({ label, platform, expectedDefault }) => {
|
||||||
|
describe(label, () => {
|
||||||
|
it('should return the correct template without setup options', () => {
|
||||||
|
const options: MenuOptionsType = {
|
||||||
|
development: false,
|
||||||
|
devTools: true,
|
||||||
|
includeSetup: false,
|
||||||
|
isProduction: true,
|
||||||
|
platform,
|
||||||
|
...actions,
|
||||||
|
};
|
||||||
|
|
||||||
|
const actual = createTemplate(options, messages);
|
||||||
|
assert.deepEqual(actual, expectedDefault);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return correct template with setup options', () => {
|
||||||
|
const options: MenuOptionsType = {
|
||||||
|
development: false,
|
||||||
|
devTools: true,
|
||||||
|
includeSetup: true,
|
||||||
|
isProduction: true,
|
||||||
|
platform,
|
||||||
|
...actions,
|
||||||
|
};
|
||||||
|
|
||||||
|
const expected: MenuListType = expectedDefault.map(menuItem => {
|
||||||
|
if (menuItem.label === '&File' && Array.isArray(menuItem.submenu)) {
|
||||||
|
return {
|
||||||
|
...menuItem,
|
||||||
|
submenu: [
|
||||||
|
{ label: 'Set Up as New Device', click: setupAsNewDevice },
|
||||||
|
{ type: 'separator' },
|
||||||
|
...menuItem.submenu,
|
||||||
|
],
|
||||||
|
};
|
||||||
|
}
|
||||||
|
return menuItem;
|
||||||
|
});
|
||||||
|
|
||||||
|
const actual = createTemplate(options, messages);
|
||||||
|
assert.deepEqual(actual, expected);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
Loading…
Add table
Add a link
Reference in a new issue