mirror of https://github.com/laurent22/joplin.git
parent
0b63ba1a28
commit
64684dc896
|
@ -230,6 +230,7 @@ packages/app-desktop/gui/MainScreen/commands/showNoteProperties.js
|
|||
packages/app-desktop/gui/MainScreen/commands/showPrompt.js
|
||||
packages/app-desktop/gui/MainScreen/commands/showShareFolderDialog.js
|
||||
packages/app-desktop/gui/MainScreen/commands/showShareNoteDialog.js
|
||||
packages/app-desktop/gui/MainScreen/commands/showSpellCheckerMenu.test.js
|
||||
packages/app-desktop/gui/MainScreen/commands/showSpellCheckerMenu.js
|
||||
packages/app-desktop/gui/MainScreen/commands/toggleEditors.js
|
||||
packages/app-desktop/gui/MainScreen/commands/toggleLayoutMoveMode.js
|
||||
|
|
|
@ -210,6 +210,7 @@ packages/app-desktop/gui/MainScreen/commands/showNoteProperties.js
|
|||
packages/app-desktop/gui/MainScreen/commands/showPrompt.js
|
||||
packages/app-desktop/gui/MainScreen/commands/showShareFolderDialog.js
|
||||
packages/app-desktop/gui/MainScreen/commands/showShareNoteDialog.js
|
||||
packages/app-desktop/gui/MainScreen/commands/showSpellCheckerMenu.test.js
|
||||
packages/app-desktop/gui/MainScreen/commands/showSpellCheckerMenu.js
|
||||
packages/app-desktop/gui/MainScreen/commands/toggleEditors.js
|
||||
packages/app-desktop/gui/MainScreen/commands/toggleLayoutMoveMode.js
|
||||
|
|
|
@ -0,0 +1,51 @@
|
|||
import { runtime } from './showSpellCheckerMenu';
|
||||
import { AppState } from '../../../app.reducer';
|
||||
|
||||
jest.mock('../../../services/bridge', () => ({
|
||||
__esModule: true,
|
||||
default: () => ({
|
||||
Menu: {
|
||||
buildFromTemplate: jest.fn().mockReturnValue({
|
||||
popup: jest.fn(),
|
||||
}),
|
||||
},
|
||||
}),
|
||||
}));
|
||||
|
||||
describe('mapStateTotitle', () => {
|
||||
|
||||
test('should return null if spellchecker.enabled is false', () => {
|
||||
|
||||
const mockState: Partial<AppState> = {
|
||||
settings: {
|
||||
'spellChecker.enabled': false,
|
||||
'spellChecker.languages': ['en-GB'],
|
||||
},
|
||||
};
|
||||
const result = runtime().mapStateToTitle(mockState);
|
||||
expect(result).toBeNull();
|
||||
});
|
||||
|
||||
test('should return null if spellChecker.languages is empty', () => {
|
||||
const mockState: Partial<AppState> = {
|
||||
settings: {
|
||||
'spellChecker.enabled': true,
|
||||
'spellChecker.languages': [],
|
||||
},
|
||||
};
|
||||
const result = runtime().mapStateToTitle(mockState);
|
||||
expect(result).toBeNull();
|
||||
});
|
||||
|
||||
test('should return list of countryDisplayName with correct format', () => {
|
||||
const mockState: Partial<AppState> = {
|
||||
settings: {
|
||||
'spellChecker.enabled': true,
|
||||
'spellChecker.languages': ['en-GB', 'en-US', 'en-CA', 'es-ES', 'es-MX'],
|
||||
},
|
||||
};
|
||||
const result = runtime().mapStateToTitle(mockState);
|
||||
expect(result).toBe('en, es');
|
||||
|
||||
});
|
||||
});
|
|
@ -30,8 +30,10 @@ export const runtime = (): CommandRuntime => {
|
|||
const s: string[] = [];
|
||||
// eslint-disable-next-line github/array-foreach -- Old code before rule was applied
|
||||
languages.forEach((language: string) => {
|
||||
s.push(language.split('-')[0]);
|
||||
const onlyLanguage = language.split('-')[0];
|
||||
if (!s.includes(onlyLanguage)) { s.push(onlyLanguage); }
|
||||
});
|
||||
|
||||
return s.join(', ');
|
||||
},
|
||||
};
|
||||
|
|
|
@ -12,7 +12,12 @@ async function processDirectory(dir, indexFilePath = null, typeScriptType = null
|
|||
|
||||
const tsFiles = glob.sync('{**/*.ts,**/*.tsx}', {
|
||||
cwd: dir,
|
||||
}).filter(f => `${dir}/${f}` !== indexFilePath);
|
||||
}).filter(f => `${dir}/${f}` !== indexFilePath)
|
||||
//
|
||||
// Exclude Jest test files to
|
||||
// not include them in index.ts
|
||||
//
|
||||
.filter(f => !f.endsWith('.test.ts'));
|
||||
|
||||
tsFiles.sort();
|
||||
|
||||
|
|
Loading…
Reference in New Issue