From bb92f569fb5d2dedc6a1fa1507334a6cbcb0110a Mon Sep 17 00:00:00 2001 From: "Dr Mark C. Sinclair" Date: Mon, 8 Apr 2024 11:58:28 +0100 Subject: [PATCH] chore(developer): add check run sets keyboard_info.isRTL if set in jsFile test --- .../test/test-keyboard-info-compiler.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/developer/src/kmc-keyboard-info/test/test-keyboard-info-compiler.ts b/developer/src/kmc-keyboard-info/test/test-keyboard-info-compiler.ts index 1e0f76ee9b..abfd03971e 100644 --- a/developer/src/kmc-keyboard-info/test/test-keyboard-info-compiler.ts +++ b/developer/src/kmc-keyboard-info/test/test-keyboard-info-compiler.ts @@ -198,6 +198,22 @@ describe('keyboard-info-compiler', function () { assert.isUndefined(keyboard_info.isRTL); }); + it('check run sets keyboard_info.isRTL if set in jsFile', async function() { + const kpjFilename = KHMER_ANGKOR_KPJ; + const sources = KHMER_ANGKOR_SOURCES; + const compiler = new KeyboardInfoCompiler(); + assert.isTrue(await compiler.init(callbacks, {sources})); + let jsFile = compiler['loadJsFile'](sources.jsFilename); + jsFile = jsFile.replace('this\.KN="Khmer Angkor";', '$&\n this\.KRTL=1;'); // insert this.KRTL=1 + const origCompilerLoadJsFile = compiler['loadJsFile']; + compiler['loadJsFile'] = (_filename: string) => jsFile; + const result = await compiler.run(kpjFilename, null); + compiler['loadJsFile'] = origCompilerLoadJsFile; + assert.isNotNull(result); + const keyboard_info = JSON.parse(new TextDecoder().decode(result.artifacts.keyboard_info.data)); + assert.isTrue(keyboard_info.isRTL); + }); + it('check run returns null if fillLanguages fails', async function() { const kpjFilename = KHMER_ANGKOR_KPJ; const sources = KHMER_ANGKOR_SOURCES;