Test menu for Windows and Linux
This commit is contained in:
parent
60281b1af9
commit
c2fecba34b
|
@ -0,0 +1,116 @@
|
|||
[
|
||||
{
|
||||
"label": "&File",
|
||||
"submenu": [
|
||||
{
|
||||
"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,56 @@ const { assert } = require('chai');
|
|||
const SignalMenu = require('../../app/menu');
|
||||
const { load: loadLocale } = require('../../app/locale');
|
||||
|
||||
const FIXTURE_MAC_OS_MENU = require('./fixtures/menu-mac-os');
|
||||
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,
|
||||
},
|
||||
{
|
||||
label: 'Windows',
|
||||
platform: 'win32',
|
||||
fixture: FIXTURE_MENU_WINDOWS_LINUX,
|
||||
},
|
||||
{
|
||||
label: 'Linux',
|
||||
platform: 'linux',
|
||||
fixture: FIXTURE_MENU_WINDOWS_LINUX,
|
||||
},
|
||||
];
|
||||
|
||||
describe('SignalMenu', () => {
|
||||
describe('createTemplate', () => {
|
||||
context('on macOS', () => {
|
||||
it('should return correct template', () => {
|
||||
const logger = {
|
||||
error(message) {
|
||||
throw new Error(message);
|
||||
},
|
||||
};
|
||||
const options = {
|
||||
openForums: null,
|
||||
openNewBugForm: null,
|
||||
openReleaseNotes: null,
|
||||
openSupportPage: null,
|
||||
platform: 'darwin',
|
||||
setupAsNewDevice: null,
|
||||
setupAsStandalone: null,
|
||||
setupWithImport: null,
|
||||
showAbout: null,
|
||||
showDebugLog: null,
|
||||
showWindow: null,
|
||||
};
|
||||
const appLocale = 'en';
|
||||
const { messages } = loadLocale({ appLocale, logger });
|
||||
PLATFORMS.forEach(({ label, platform, fixture }) => {
|
||||
context(`on ${label}`, () => {
|
||||
it('should return correct template', () => {
|
||||
const logger = {
|
||||
error(message) {
|
||||
throw new Error(message);
|
||||
},
|
||||
};
|
||||
const options = {
|
||||
openForums: null,
|
||||
openNewBugForm: null,
|
||||
openReleaseNotes: null,
|
||||
openSupportPage: null,
|
||||
platform,
|
||||
setupAsNewDevice: null,
|
||||
setupAsStandalone: null,
|
||||
setupWithImport: null,
|
||||
showAbout: null,
|
||||
showDebugLog: null,
|
||||
showWindow: null,
|
||||
};
|
||||
const appLocale = 'en';
|
||||
const { messages } = loadLocale({ appLocale, logger });
|
||||
|
||||
const actual = SignalMenu.createTemplate(options, messages);
|
||||
assert.deepEqual(actual, FIXTURE_MAC_OS_MENU);
|
||||
const actual = SignalMenu.createTemplate(options, messages);
|
||||
assert.deepEqual(actual, fixture);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue