1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-07-16 00:14:34 +02:00

Desktop: Fixes #5927: Update menu item labels when the language changes

This commit is contained in:
Laurent Cozic
2021-12-31 07:50:32 +01:00
parent e813d15ef2
commit f451633a51
3 changed files with 19 additions and 7 deletions

View File

@ -163,6 +163,7 @@ describe('services_CommandService', function() {
it('should create menu items from commands', (async () => {
const service = newService();
const utils = new MenuUtils(service);
const locale = 'fr_FR';
registerCommand(service, createCommand('test1', {
execute: () => {},
@ -178,7 +179,7 @@ describe('services_CommandService', function() {
clickedCommands.push(commandName);
};
const menuItems = utils.commandsToMenuItems(['test1', 'test2'], onClick);
const menuItems = utils.commandsToMenuItems(['test1', 'test2'], onClick, locale);
menuItems.test1.click();
menuItems.test2.click();
@ -186,7 +187,10 @@ describe('services_CommandService', function() {
expect(clickedCommands.join('_')).toBe('test1_test2');
// Also check that the same commands always return strictly the same menu
expect(utils.commandsToMenuItems(['test1', 'test2'], onClick)).toBe(utils.commandsToMenuItems(['test1', 'test2'], onClick));
expect(utils.commandsToMenuItems(['test1', 'test2'], onClick, locale)).toBe(utils.commandsToMenuItems(['test1', 'test2'], onClick, locale));
// And check that if the locale changes, new menu items are returned
expect(utils.commandsToMenuItems(['test1', 'test2'], onClick, locale)).not.toBe(utils.commandsToMenuItems(['test1', 'test2'], onClick, 'en_GB'));
}));
it('should give menu item props from state', (async () => {