diff --git a/common/core/web/input-processor/test.sh b/common/core/web/input-processor/test.sh
index a3c46c65cf..b2d9bf0d52 100755
--- a/common/core/web/input-processor/test.sh
+++ b/common/core/web/input-processor/test.sh
@@ -54,22 +54,36 @@ if [ $FETCH_DEPS = true ]; then
fi
# Ensures that the lexical model compiler has been built locally.
-echo_heading "Preparing Lexical Model Compiler for test use"
-pushd $WORKING_DIRECTORY/node_modules/@keymanapp/lexical-model-compiler
-npm run build
-popd
+#echo_heading "Preparing Lexical Model Compiler for test use"
+#pushd $WORKING_DIRECTORY/node_modules/@keymanapp/lexical-model-compiler
+#npm run build
+#popd
test-headless ( ) {
if (( CI_REPORTING )); then
FLAGS="$FLAGS --reporter mocha-teamcity-reporter"
fi
- npm run mocha -- --recursive $FLAGS ./tests/cases/
+ # Poor Man's Modules until we support ES6 throughout
+ PREPEND=./tests/cases/prepend.js
+ (cat ../../../../resources/web-environment/build/index.js; echo) > $PREPEND
+ (cat ../utils/build/index.js; echo) >> $PREPEND
+ (cat ../keyboard-processor/build/index.js; echo) >> $PREPEND
+ (cat ../input-processor/build/index.js; echo) >> $PREPEND
+ (cat tests/cases/inputProcessor.js; echo) >> $PREPEND
+
+ # TODO: We will re-enable languageProcessor tests when we have sorted out
+ # paths and modules for lmc
+ #(cat tests/cases/languageProcessor.js; echo) >> $PREPEND
+
+ npm run mocha -- --recursive $FLAGS ./tests/cases/prepend.js
+
+ rm $PREPEND
}
if [ $FETCH_DEPS = true ]; then
# First, run tests on the keyboard processor.
- pushd $WORKING_DIRECTORY/node_modules/@keymanapp/keyboard-processor
+ pushd "$KEYMAN_ROOT/common/core/web/keyboard-processor"
./test.sh -skip-package-install || fail "Tests failed by dependencies; aborting integration tests."
popd
fi
diff --git a/common/core/web/input-processor/tests/cases/inputProcessor.js b/common/core/web/input-processor/tests/cases/inputProcessor.js
index e885817e10..4fd7fde4b8 100644
--- a/common/core/web/input-processor/tests/cases/inputProcessor.js
+++ b/common/core/web/input-processor/tests/cases/inputProcessor.js
@@ -2,13 +2,12 @@ var assert = require('chai').assert;
var fs = require("fs");
var vm = require("vm");
-let InputProcessor = require('../../dist');
-
// Required initialization setup.
-global.com = InputProcessor.com; // exports all keyboard-processor namespacing.
global.keyman = {}; // So that keyboard-based checks against the global `keyman` succeed.
// 10.0+ dependent keyboards, like khmer_angkor, will otherwise fail to load.
+let InputProcessor = com.keyman.text.InputProcessor;
+
let device = {
formFactor: 'phone',
OS: 'ios',
@@ -55,7 +54,7 @@ describe('InputProcessor', function() {
var keyboard;
// Easy peasy long context: use the input processor's full source!
- let coreSourceCode = fs.readFileSync('dist/index.js', 'utf-8');
+ let coreSourceCode = fs.readFileSync('build/index.js', 'utf-8');
// At the time this test block was written... 810485 chars.
// Let's force it to the same order of magnitude, even if the codebase grows.
diff --git a/common/core/web/keyboard-processor/src/keyboards/activeLayout.ts b/common/core/web/keyboard-processor/src/keyboards/activeLayout.ts
index ac9647cdd3..c5d83448e4 100644
--- a/common/core/web/keyboard-processor/src/keyboards/activeLayout.ts
+++ b/common/core/web/keyboard-processor/src/keyboards/activeLayout.ts
@@ -1,6 +1,18 @@
namespace com.keyman.keyboards {
type KeyDistribution = text.KeyDistribution;
+ // TS 3.9 changed behavior of getters to make them
+ // non-enumerable by default. This broke our 'polyfill'
+ // functions which depended on enumeration to copy the
+ // relevant props over.
+ // https://github.com/microsoft/TypeScript/pull/32264#issuecomment-677718191
+ function Enumerable(
+ target: unknown,
+ propertyKey: string,
+ descriptor: PropertyDescriptor
+ ) {
+ descriptor.enumerable = true;
+ };
export class ActiveKey implements LayoutKey {
@@ -52,6 +64,7 @@ namespace com.keyman.keyboards {
*
* Is used to determine the keycode for input events, rule-matching, and keystroke processing.
*/
+ @Enumerable
public get baseKeyID(): string {
if(typeof this.id === 'undefined') {
return undefined;
@@ -78,6 +91,7 @@ namespace com.keyman.keyboards {
*
* Useful when the active layer of an input-event is already known.
*/
+ @Enumerable
public get coreID(): string {
if(typeof this.id === 'undefined') {
return undefined;
@@ -110,6 +124,7 @@ namespace com.keyman.keyboards {
*
* Useful when only the active keyboard is known about an input event.
*/
+ @Enumerable
public get elementID(): string {
if(typeof this.id === 'undefined') {
return undefined;
diff --git a/common/core/web/keyboard-processor/src/tsconfig.json b/common/core/web/keyboard-processor/src/tsconfig.json
index 57a98fa4d9..b58a6b509f 100644
--- a/common/core/web/keyboard-processor/src/tsconfig.json
+++ b/common/core/web/keyboard-processor/src/tsconfig.json
@@ -10,7 +10,8 @@
"target": "es5",
"types": ["node"],
"lib": ["es6"],
- "outFile": "../build/index.js"
+ "outFile": "../build/index.js",
+ "experimentalDecorators": true,
},
"references": [
{ "path": "../../../../../common/models/types" },
diff --git a/common/core/web/keyboard-processor/test.sh b/common/core/web/keyboard-processor/test.sh
index ae82949fad..909ffdabfb 100755
--- a/common/core/web/keyboard-processor/test.sh
+++ b/common/core/web/keyboard-processor/test.sh
@@ -55,13 +55,43 @@ test-headless ( ) {
FLAGS="$FLAGS --reporter mocha-teamcity-reporter"
fi
- npm run mocha -- --recursive $FLAGS ./tests/cases/
+ # Poor Man's Modules until we support ES6 throughout
+ PREPEND=./tests/cases/prepend.js
+ rm -f $PREPEND
+ for n in tests/cases/*.js; do
+ echo $n
+ (cat ../../../../resources/web-environment/build/index.js; echo) > $PREPEND
+ (cat ../utils/build/index.js; echo) >> $PREPEND
+ (cat ../tools/recorder/build/nodeProctor/index.js; echo) >> $PREPEND
+ (cat ../keyboard-processor/build/index.js; echo) >> $PREPEND
+ (cat $n; echo) >> $PREPEND;
+ npm run mocha -- --recursive $FLAGS $PREPEND || die
+ rm $PREPEND
+ done
+
+ # Poor Man's Modules until we support ES6 throughout
+ PREPEND=./tests/cases/engine/prepend.js
+ rm -f $PREPEND
+ for n in tests/cases/engine/*.js; do
+ echo $n
+ (cat ../../../../resources/web-environment/build/index.js; echo) > $PREPEND
+ (cat ../utils/build/index.js; echo) >> $PREPEND
+ (cat ../tools/recorder/build/nodeProctor/index.js; echo) >> $PREPEND
+ (cat ../keyboard-processor/build/index.js; echo) >> $PREPEND
+ (cat $n; echo) >> $PREPEND;
+ npm run mocha -- --recursive $FLAGS $PREPEND || die
+ rm $PREPEND
+ done
+
+ # npm run mocha -- --recursive $FLAGS ./tests/cases/
}
-# Build test dependency
-pushd "$KEYMAN_ROOT/common/core/web/tools/recorder/src"
-./build.sh -skip-package-install || fail "recorder-core compilation failed."
-popd
+if [ $FETCH_DEPS = true ]; then
+ # Build test dependency
+ pushd "$KEYMAN_ROOT/common/core/web/tools/recorder/src"
+ ./build.sh -skip-package-install || fail "recorder-core compilation failed."
+ popd
+fi
# Run headless (browserless) tests.
echo_heading "Running Keyboard Processor test suite"
diff --git a/common/core/web/keyboard-processor/tests/cases/basic-engine.js b/common/core/web/keyboard-processor/tests/cases/basic-engine.js
index b04b1619bb..809d110d5c 100644
--- a/common/core/web/keyboard-processor/tests/cases/basic-engine.js
+++ b/common/core/web/keyboard-processor/tests/cases/basic-engine.js
@@ -2,11 +2,11 @@ var assert = require('chai').assert;
let fs = require('fs');
let vm = require('vm');
-let KeyboardProcessor = require('../../dist');
-let KMWRecorder = require('../../../tools/recorder/dist/nodeProctor');
+let KeyboardProcessor = com.keyman.text.KeyboardProcessor;
+global.keyman = {};
-// Required initialization setup.
-global.com = KeyboardProcessor.com; // exports all keyboard-processor namespacing.
+// Initialize supplementary plane string extensions
+String.kmwEnableSupplementaryPlane(false);
describe('Engine - Basic Simulation', function() {
let testJSONtext = fs.readFileSync('../tests/resources/json/engine_tests/basic_lao_simulation.json');
@@ -41,7 +41,7 @@ describe('Engine - Basic Simulation', function() {
// Converts each test set into its own Mocha-level test.
for(let set of testSuite.inputTestSets) {
let proctor = new KMWRecorder.NodeProctor(keyboard, device, assert.equal);
-
+
if(!proctor.compatibleWithSuite(testSuite)) {
it.skip(set.toTestName() + " - Cannot run this test suite on Node.");
} else {
diff --git a/common/core/web/keyboard-processor/tests/cases/basic-init.js b/common/core/web/keyboard-processor/tests/cases/basic-init.js
index c1ed7f6f07..a789104362 100644
--- a/common/core/web/keyboard-processor/tests/cases/basic-init.js
+++ b/common/core/web/keyboard-processor/tests/cases/basic-init.js
@@ -2,15 +2,12 @@ var assert = require('chai').assert;
var fs = require("fs");
var vm = require("vm");
-let KeyboardProcessor = require('../../dist');
-
-// Required initialization setup.
-global.com = KeyboardProcessor.com; // exports all keyboard-processor namespacing.
-global.keyman = {}; // So that keyboard-based checks against the global `keyman` succeed.
- // 10.0+ dependent keyboards, like khmer_angkor, will otherwise fail to load.
+let KeyboardProcessor = com.keyman.text.KeyboardProcessor;
+global.keyman = {};
+global.com = com;
// Initialize supplementary plane string extensions
-String.kmwEnableSupplementaryPlane(false);
+String.kmwEnableSupplementaryPlane(false);
// Test the KeyboardProcessor interface.
describe('KeyboardProcessor', function() {
diff --git a/common/core/web/keyboard-processor/tests/cases/chirality.js b/common/core/web/keyboard-processor/tests/cases/chirality.js
index 251ef39d03..c6406c9928 100644
--- a/common/core/web/keyboard-processor/tests/cases/chirality.js
+++ b/common/core/web/keyboard-processor/tests/cases/chirality.js
@@ -2,11 +2,11 @@ var assert = require('chai').assert;
let fs = require('fs');
let vm = require('vm');
-let KeyboardProcessor = require('../../dist');
-let KMWRecorder = require('../../../tools/recorder/dist/nodeProctor');
+let KeyboardProcessor = com.keyman.text.KeyboardProcessor;
+global.keyman = {};
-// Required initialization setup.
-global.com = KeyboardProcessor.com; // exports all keyboard-processor namespacing.
+// Initialize supplementary plane string extensions
+String.kmwEnableSupplementaryPlane(false);
describe('Engine - Chirality', function() {
let testJSONtext = fs.readFileSync('../tests/resources/json/engine_tests/chirality.json');
@@ -41,7 +41,7 @@ describe('Engine - Chirality', function() {
// Converts each test set into its own Mocha-level test.
for(let set of testSuite.inputTestSets) {
let proctor = new KMWRecorder.NodeProctor(keyboard, device, assert.equal);
-
+
if(!proctor.compatibleWithSuite(testSuite)) {
it.skip(set.toTestName() + " - Cannot run this test suite on Node.");
} else if(set.constraint.target == 'hardware') {
diff --git a/common/core/web/keyboard-processor/tests/cases/deadkeys.js b/common/core/web/keyboard-processor/tests/cases/deadkeys.js
index c77300983d..939b704098 100644
--- a/common/core/web/keyboard-processor/tests/cases/deadkeys.js
+++ b/common/core/web/keyboard-processor/tests/cases/deadkeys.js
@@ -2,11 +2,12 @@ var assert = require('chai').assert;
let fs = require('fs');
let vm = require('vm');
-let KeyboardProcessor = require('../../dist');
-let KMWRecorder = require('../../../tools/recorder/dist/nodeProctor');
+let KeyboardProcessor = com.keyman.text.KeyboardProcessor;
+global.keyman = {};
+global.com = com;
-// Required initialization setup.
-global.com = KeyboardProcessor.com; // exports all keyboard-processor namespacing.
+// Initialize supplementary plane string extensions
+String.kmwEnableSupplementaryPlane(false);
describe('Engine - Deadkeys', function() {
let testJSONtext = fs.readFileSync('../tests/resources/json/engine_tests/deadkeys.json');
@@ -41,7 +42,7 @@ describe('Engine - Deadkeys', function() {
// Converts each test set into its own Mocha-level test.
for(let set of testSuite.inputTestSets) {
let proctor = new KMWRecorder.NodeProctor(keyboard, device, assert.equal);
-
+
if(!proctor.compatibleWithSuite(testSuite)) {
it.skip(set.toTestName() + " - Cannot run this test suite on Node.");
} else {
diff --git a/common/core/web/keyboard-processor/tests/cases/engine/context.js b/common/core/web/keyboard-processor/tests/cases/engine/context.js
index 646cb9dadd..65bc4336f2 100644
--- a/common/core/web/keyboard-processor/tests/cases/engine/context.js
+++ b/common/core/web/keyboard-processor/tests/cases/engine/context.js
@@ -2,22 +2,26 @@ var assert = require('chai').assert;
let fs = require('fs');
let vm = require('vm');
-let KeyboardProcessor = require('../../../dist');
-let KMWRecorder = require('../../../../tools/recorder/dist/nodeProctor');
+let KeyboardProcessor = com.keyman.text.KeyboardProcessor;
+global.keyman = {};
+global.com = com;
-/*
+// Initialize supplementary plane string extensions
+String.kmwEnableSupplementaryPlane(false);
+
+/*
* ABOUT THIS TEST SUITE
* ---------------------
- *
+ *
* This suite contains two types of tests, both designed to test all possible variations
* of behaviors that `KeyboardInterface.fullContextMatch` may be expected to handle.
- *
+ *
* Type 1: White-box tests for validity of the generated context-cache
* - uses only the `baseSequence` of each test spec definition; does not
* use any `fullMatchDefs` entries.
* - uses the specified `contextCache` entry of each test spec in assertions
* - CTRL+F `Tests "stage 1" of fullContextMatch` for more details.
- *
+ *
* Type 2: Black-box rule-matching tests
* - uses both `baseSequence` and `fullMatchDefs` entries of a test spec
* - tests that each simulation sequence's output either passes or fails against
@@ -26,9 +30,6 @@ let KMWRecorder = require('../../../../tools/recorder/dist/nodeProctor');
* It should be a removable limitation, though.
*/
-// Required initialization setup.
-global.com = KeyboardProcessor.com; // exports all keyboard-processor namespacing.
-
let device = {
formFactor: 'desktop',
OS: 'windows',
@@ -68,12 +69,13 @@ function runEngineRuleSet(ruleSet, defaultNoun) {
// Now for the real test!
let processor = new KeyboardProcessor();
+ processor.device = device;
processor.activeKeyboard = keyboard;
var res = processor.keyboardInterface.fullContextMatch(ruleDef.n, target, ruleDef.rule);
var msg = matchTest.msg;
if(!msg) {
- msg = defaultNoun + " incorrectly reported as " + (matchTest.result ? "unmatched!" : "matched!");
+ msg = defaultNoun + " incorrectly reported as " + (matchTest.result ? "unmatched!" : "matched!");
}
assert.equal(res, matchTest.result, msg);
}
@@ -463,7 +465,7 @@ var ANY_CONTEXT_TEST_2 = {
*
* store(ac) 'ac'
* store(bc) 'bc'
- *
+ *
* 'c' any(ac) any(bc) context(3) context(2) > 'success'
*/
var ANY_CONTEXT_TEST_3 = {
@@ -520,7 +522,7 @@ var ANY_CONTEXT_TEST_3 = {
*
* store(ab) 'ab'
* store(bc) 'bc'
- *
+ *
* 'c' any(ab) index(bc, 2) 'a' > 'success'
*/
var ANY_INDEX_TEST_1 = {
@@ -567,7 +569,7 @@ var ANY_INDEX_TEST_1 = {
*
* store(ab) 'ab'
* store(bc) 'bc'
- *
+ *
* 'c' any(ab) index(bc, 2) index(bc, 2) index(ab, 2) > 'success'
*/
var ANY_INDEX_TEST_2 = {
@@ -614,7 +616,7 @@ var ANY_INDEX_TEST_2 = {
*
* store(ab) 'ab'
* store(bc) 'bc'
- *
+ *
* 'c' any(ab) any(bc) index(bc, 3) index(ab, 2) > 'success'
*/
var ANY_INDEX_TEST_3 = {
@@ -747,7 +749,7 @@ var DEADKEY_STORE_TEST_2 = {
*
* store(match) dk(0) dk(1) dk(2)
* store(abc) 'abc'
- *
+ *
* any(match) index(abc, 1) > 'success'
*/
var DEADKEY_STORE_TEST_3 = {
@@ -880,7 +882,7 @@ var NOTANY_NUL_TEST_1 = {
*
* store(match) dk(0) dk(1) dk(2)
* store(abc) 'abc'
- *
+ *
* notany(match) any(abc) > 'success'
*/
var NOTANY_NUL_TEST_2 = {
@@ -917,7 +919,7 @@ var NOTANY_NUL_TEST_2 = {
*
* store(first) dk(0) 'b' dk(2)
* store(second) 'a' dk(1) 'c'
- *
+ *
* notany(first) any(second) > 'success'
*/
var NOTANY_NUL_TEST_3 = {
@@ -964,8 +966,8 @@ var NOTANY_NUL_TEST_3 = {
}]
};
-var DEADKEY_RULE_SET = [ DEADKEY_TEST_1, DEADKEY_TEST_2, DEADKEY_TEST_3, DEADKEY_TEST_4,
- DEADKEY_TEST_5, DEADKEY_TEST_6
+var DEADKEY_RULE_SET = [ DEADKEY_TEST_1, DEADKEY_TEST_2, DEADKEY_TEST_3, DEADKEY_TEST_4,
+ DEADKEY_TEST_5, DEADKEY_TEST_6
];
var ANY_CONTEXT_RULE_SET = [ ANY_CONTEXT_TEST_1, ANY_CONTEXT_TEST_2, ANY_CONTEXT_TEST_3 ];
var ANY_INDEX_RULE_SET = [ ANY_INDEX_TEST_1, ANY_INDEX_TEST_2, ANY_INDEX_TEST_3 ];
@@ -1007,6 +1009,7 @@ describe('Engine - Context Matching', function() {
// Now for the real test!
let processor = new KeyboardProcessor();
+ processor.device = device;
processor.activeKeyboard = keyboard;
var res = processor.keyboardInterface._BuildExtendedContext(ruleDef.n, ruleDef.ln, target);
@@ -1067,7 +1070,7 @@ describe('Engine - Context Matching', function() {
runEngineRuleSet([ANY_INDEX_TEST_3]);
});
});
-
+
describe('handles interactions with deadkeys in stores', function() {
it('for any on pure deadkey store: DEADKEY_STORE_TEST_1', function() {
runEngineRuleSet([DEADKEY_STORE_TEST_1]);
diff --git a/common/core/web/keyboard-processor/tests/cases/engine/notany_context.js b/common/core/web/keyboard-processor/tests/cases/engine/notany_context.js
index 1b502fa99b..7db2d05fee 100644
--- a/common/core/web/keyboard-processor/tests/cases/engine/notany_context.js
+++ b/common/core/web/keyboard-processor/tests/cases/engine/notany_context.js
@@ -2,16 +2,11 @@ const assert = require('chai').assert;
const fs = require('fs');
const vm = require('vm');
-const KeyboardProcessor = require('../../../dist');
-const KMWRecorder = require('../../../../tools/recorder/dist/nodeProctor');
-
-// Required initialization setup.
-global.com = KeyboardProcessor.com; // exports all keyboard-processor namespacing.
-global.keyman = {}; // So that keyboard-based checks against the global `keyman` succeed.
- // 10.0+ dependent keyboards, like khmer_angkor, will otherwise fail to load.
+let KeyboardProcessor = com.keyman.text.KeyboardProcessor;
+global.keyman = {};
// Initialize supplementary plane string extensions
-String.kmwEnableSupplementaryPlane(false);
+String.kmwEnableSupplementaryPlane(false);
const device = {
formFactor: 'desktop',
@@ -32,7 +27,7 @@ function runEngineRuleSet(ruleSet) {
}
/**
- * Wrapper to simplify running tests -- supports either virtual key codes as string (e.g. 'A' is VK_A)
+ * Wrapper to simplify running tests -- supports either virtual key codes as string (e.g. 'A' is VK_A)
* or an array of integers. Does not currently support modifiers (not needed here).
* @param {String|Array} input Virtual key codes of each character (as string or array)
* @param {String} output Expected output
@@ -40,11 +35,11 @@ function runEngineRuleSet(ruleSet) {
function runStringRuleSet(input, output) {
const rule = {
- "inputs":
+ "inputs":
typeof input == 'string'
- ? input.split("").map(ch =>
+ ? input.split("").map(ch =>
{ return { "type": "key", "keyCode": ch.charCodeAt(0), "states": 10752, "modifiers": 0, "modifierChanged": false, "isVirtualKey": true } })
- : input.map(ch =>
+ : input.map(ch =>
{ return { "type": "key", "keyCode": ch, "states": 10752, "modifiers": 0, "modifierChanged": false, "isVirtualKey": true } }),
"output": output
};
diff --git a/common/core/web/keyboard-processor/tests/cases/engine/stores.js b/common/core/web/keyboard-processor/tests/cases/engine/stores.js
index 66f0a57b20..4b14748c20 100644
--- a/common/core/web/keyboard-processor/tests/cases/engine/stores.js
+++ b/common/core/web/keyboard-processor/tests/cases/engine/stores.js
@@ -2,36 +2,43 @@ var assert = require('chai').assert;
let fs = require('fs');
let vm = require('vm');
-let KeyboardProcessor = require('../../../dist');
-let KMWRecorder = require('../../../../tools/recorder/dist/nodeProctor');
+let KeyboardProcessor = com.keyman.text.KeyboardProcessor;
+global.keyman = {};
-// Required initialization setup.
-global.com = KeyboardProcessor.com; // exports all keyboard-processor namespacing.
+// Initialize supplementary plane string extensions
+String.kmwEnableSupplementaryPlane(false);
+
+let device = {
+ formFactor: 'desktop',
+ OS: 'windows',
+ browser: 'native'
+}
describe('Engine - Stores', function() {
var toSupplementaryPairString = function(code){
var H = Math.floor((code - 0x10000) / 0x400) + 0xD800;
var L = (code - 0x10000) % 0x400 + 0xDC00;
-
+
return String.fromCharCode(H, L);
}
it('Store \'Explosion\'', function() {
let processor = new KeyboardProcessor();
+ processor.device = device;
// A 'hollow' Keyboard that only follows default rules. That said, we need a Keyboard
// instance to host cache data for our exploded store tests.
processor.activeKeyboard = new com.keyman.keyboards.Keyboard();
// Function defined at top of file; creates supplementary pairs for extended Unicode codepoints.
var u = toSupplementaryPairString;
-
+
var STORES = [
{smp: false, in: "apple", out: ['a','p','p','l','e']},
//In JS-escaped form: "\\ud804\\udd12\\ud804\\udd0d\\ud804\\udd0f\\ud804\\udd10\\ud804\\udd0a\\ud804\\udd05"
//(Supplementary pairs, copied from the easy_chakma keyboard.)
{smp: true, in: "𑄒𑄍𑄏𑄐𑄊𑄅", out: ["𑄒","𑄍","𑄏","𑄐","𑄊","𑄅"]},
// Built in-line via function. Looks functionally equivalent to "apple", but with SMP characters.
- {smp: true, in: (u(0x1d5ba)+u(0x1d5c9)+u(0x1d5c9)+u(0x1d5c5)+u(0x1d5be)),
+ {smp: true, in: (u(0x1d5ba)+u(0x1d5c9)+u(0x1d5c9)+u(0x1d5c5)+u(0x1d5be)),
out: [u(0x1d5ba), u(0x1d5c9), u(0x1d5c9), u(0x1d5c5), u(0x1d5be)]}
];
diff --git a/common/core/web/keyboard-processor/tests/cases/engine/unmatched_final_group.js b/common/core/web/keyboard-processor/tests/cases/engine/unmatched_final_group.js
index 40d02487a1..30d126fcc5 100644
--- a/common/core/web/keyboard-processor/tests/cases/engine/unmatched_final_group.js
+++ b/common/core/web/keyboard-processor/tests/cases/engine/unmatched_final_group.js
@@ -2,11 +2,11 @@ var assert = require('chai').assert;
let fs = require('fs');
let vm = require('vm');
-let KeyboardProcessor = require('../../../dist');
-let KMWRecorder = require('../../../../tools/recorder/dist/nodeProctor');
+let KeyboardProcessor = com.keyman.text.KeyboardProcessor;
+global.keyman = {};
-// Required initialization setup.
-global.com = KeyboardProcessor.com; // exports all keyboard-processor namespacing.
+// Initialize supplementary plane string extensions
+String.kmwEnableSupplementaryPlane(false);
describe('Engine - Unmatched Final Groups', function() {
let testJSONtext = fs.readFileSync('../tests/resources/json/engine_tests/ghp_enter.json');
diff --git a/common/core/web/keyboard-processor/tests/cases/transcriptions.js b/common/core/web/keyboard-processor/tests/cases/transcriptions.js
index 59f644670d..c351ded8d0 100644
--- a/common/core/web/keyboard-processor/tests/cases/transcriptions.js
+++ b/common/core/web/keyboard-processor/tests/cases/transcriptions.js
@@ -1,16 +1,15 @@
var assert = require('chai').assert;
-let KeyboardProcessor = require('../../dist');
-// Required initialization setup.
-global.com = KeyboardProcessor.com; // exports all keyboard-processor namespacing.
+global.keyman = {};
+// Initialize supplementary plane string extensions
String.kmwEnableSupplementaryPlane(false);
describe("Transcriptions and Transforms", function() {
var toSupplementaryPairString = function(code){
var H = Math.floor((code - 0x10000) / 0x400) + 0xD800;
var L = (code - 0x10000) % 0x400 + 0xDC00;
-
+
return String.fromCharCode(H, L);
}
@@ -50,7 +49,7 @@ describe("Transcriptions and Transforms", function() {
* Other modules coming later will need it, though.
*/
var transcription = target.buildTranscriptionFrom(original, null);
-
+
assert.equal(transcription.transform.insert, "s", "Failed to recognize inserted text");
assert.equal(transcription.transform.deleteLeft, 0, "Incorrectly detected left-of-caret deletions");
assert.equal(transcription.transform.deleteRight, 0, "Incorrectly detected right-of-caret deletions");
@@ -322,11 +321,11 @@ but not himself.`; // Sheev Palpatine, in the Star Wars prequels.
// could eventually run in 'headless' mode.
var target = new Mock("apple");
var original = Mock.from(target);
-
+
target.setDeadkeyCaret(4);
target.insertDeadkeyBeforeCaret(0);
target.setDeadkeyCaret(1);
- target.insertDeadkeyBeforeCaret(1);
+ target.insertDeadkeyBeforeCaret(1);
target.setDeadkeyCaret(2);
target.insertDeadkeyBeforeCaret(2); // 'a' dk(1) 'p' dk(2) | 'p' 'l' dk(0) 'e'
@@ -337,8 +336,8 @@ but not himself.`; // Sheev Palpatine, in the Star Wars prequels.
target.setDeadkeyCaret(3);
target.deleteCharsBeforeCaret(2);
- target.insertTextBeforeCaret("b");
- target.insertDeadkeyBeforeCaret(3); // In effect: 'a' dk(1) 'b' dk(3) | 'l' dk(0) 'e'
+ target.insertTextBeforeCaret("b");
+ target.insertDeadkeyBeforeCaret(3); // In effect: 'a' dk(1) 'b' dk(3) | 'l' dk(0) 'e'
var transcription = target.buildTranscriptionFrom(original, null);
@@ -350,7 +349,7 @@ but not himself.`; // Sheev Palpatine, in the Star Wars prequels.
var rem = transcription.removedDks;
assert.equal(rem.length, 1, "Incorrect count for removed deadkeys");
assert.deepEqual({d: rem[0].d, p: rem[0].p}, {d: 2, p: 2}, "Selected wrong deadkey as removed");
-
+
var ins = transcription.insertedDks;
assert.equal(ins.length, 1, "Incorrect count for inserted deadkeys");
assert.deepEqual({d: ins[0].d, p: ins[0].p}, {d: 3, p:2}, "Selected wrong deadkey as inserted");
diff --git a/common/core/web/keyboard-processor/tests/cases/versions.js b/common/core/web/keyboard-processor/tests/cases/versions.js
index 2345602de3..e3c6a42768 100644
--- a/common/core/web/keyboard-processor/tests/cases/versions.js
+++ b/common/core/web/keyboard-processor/tests/cases/versions.js
@@ -1,8 +1,9 @@
var assert = require('chai').assert;
-let KeyboardProcessor = require('../../dist');
-// Required initialization setup.
-global.com = KeyboardProcessor.com; // exports all keyboard-processor namespacing.
+global.keyman = {};
+
+// Initialize supplementary plane string extensions
+String.kmwEnableSupplementaryPlane(false);
describe('Version Logic', function() {
it('Should provide a default, fallback value when nothing is specified', function() {
@@ -42,5 +43,5 @@ describe('Version Logic', function() {
// Ensures the first "precede" check's return is flipped when the order's flipped.
assert.equal(v9_1_0.compareTo(v9_0_1), 1);
});
-
+
});
\ No newline at end of file
diff --git a/common/core/web/tools/recorder/src/build.sh b/common/core/web/tools/recorder/src/build.sh
index f8b44bf529..87c4606f33 100755
--- a/common/core/web/tools/recorder/src/build.sh
+++ b/common/core/web/tools/recorder/src/build.sh
@@ -57,12 +57,12 @@ PATH="../node_modules/.bin:$PATH"
compiler="npm run tsc --"
compilecmd="$compiler"
-$compilecmd -p "$SCRIPT_DIR/tsconfig.json"
+$compilecmd --build "$SCRIPT_DIR/tsconfig.json"
if [ $? -ne 0 ]; then
fail "KeymanWeb recorder-core compilation failed."
fi
-$compilecmd -p "$SCRIPT_DIR/nodeProctor.tsconfig.json"
+$compilecmd --build "$SCRIPT_DIR/nodeProctor.tsconfig.json"
if [ $? -ne 0 ]; then
fail "Node-based unit-test Proctor compilation failed."
fi
diff --git a/common/core/web/tools/recorder/src/index.ts b/common/core/web/tools/recorder/src/index.ts
index 60cf7ad0b1..35c228c26c 100644
--- a/common/core/web/tools/recorder/src/index.ts
+++ b/common/core/web/tools/recorder/src/index.ts
@@ -1,4 +1,3 @@
-///
///
namespace KMWRecorder {
@@ -92,7 +91,7 @@ namespace KMWRecorder {
static fromJSONObject(obj: any): RecordedKeystroke {
if(obj && obj.type) {
if(obj.type == "key") {
- return new RecordedPhysicalKeystroke(obj as RecordedPhysicalKeystroke);
+ return new RecordedPhysicalKeystroke(obj as RecordedPhysicalKeystroke);
} else if(obj && obj.type) {
return new RecordedSyntheticKeystroke(obj as RecordedSyntheticKeystroke);
}
@@ -375,7 +374,7 @@ namespace KMWRecorder {
this.id = activeStub.KLC;
this.name = activeStub.KL;
this.region = activeStub.KR;
-
+
// Fonts.
if(activeStub.KFont) {
this.font = new FontStubForLanguage(activeStub.KFont);
@@ -515,7 +514,7 @@ namespace KMWRecorder {
this.result = output;
}
}
-
+
export interface TestSet> {
constraint: Constraint;
@@ -649,7 +648,7 @@ namespace KMWRecorder {
public specVersion: com.keyman.utils.Version = KeyboardTest.CURRENT_VERSION;
/**
- * The version of KMW in which the Recorder was first written. Worked from 10.0 to 13.0 with
+ * The version of KMW in which the Recorder was first written. Worked from 10.0 to 13.0 with
* only backward-compatible changes and minor tweaks to conform to internal API shifts.
*/
public static readonly FALLBACK_VERSION = new com.keyman.utils.Version("10.0");
@@ -667,8 +666,8 @@ namespace KMWRecorder {
inputTestSets: TestSet[];
/**
- * Reconstructs a KeyboardTest object from its JSON representation, restoring its methods.
- * @param fromJSON
+ * Reconstructs a KeyboardTest object from its JSON representation, restoring its methods.
+ * @param fromJSON
*/
constructor(fromJSON?: string|KeyboardStub|KeyboardTest) {
if(!fromJSON) {
@@ -720,7 +719,7 @@ namespace KMWRecorder {
var newSet = new RecordedSequenceTestSet(new Constraint(constraint));
this.inputTestSets.push(newSet);
- newSet.addTest(seq);
+ newSet.addTest(seq);
}
test(proctor: Proctor) {
diff --git a/common/core/web/tools/recorder/src/nodeProctor.ts b/common/core/web/tools/recorder/src/nodeProctor.ts
index 39dcae4746..0ae4b5adcc 100644
--- a/common/core/web/tools/recorder/src/nodeProctor.ts
+++ b/common/core/web/tools/recorder/src/nodeProctor.ts
@@ -1,5 +1,3 @@
-///
-///
namespace KMWRecorder {
export class NodeProctor extends Proctor {
diff --git a/common/core/web/tools/recorder/src/nodeProctor.tsconfig.json b/common/core/web/tools/recorder/src/nodeProctor.tsconfig.json
index d13317335d..064a8dd69a 100644
--- a/common/core/web/tools/recorder/src/nodeProctor.tsconfig.json
+++ b/common/core/web/tools/recorder/src/nodeProctor.tsconfig.json
@@ -1,19 +1,28 @@
{
+ "extends": "../../../../../../tsconfig-base.json",
+
"compilerOptions": {
- "allowJs": true,
- "module": "none",
- "outDir": "../dist/",
- "inlineSources": true,
- "inlineSourceMap": true,
- "target": "es5",
- "types": ["node"],
- "lib": ["es6"],
- "outFile": "../dist/nodeProctor.js"
+ "allowJs": true,
+ "module": "none",
+ "outDir": "../build/nodeProctor/",
+ "outFile": "../build/nodeProctor/index.js",
+ "inlineSources": true,
+ "inlineSourceMap": true,
+ "target": "es5",
+ "types": ["node"],
+ "lib": ["es6"]
},
+
"files": [
- "../node_modules/@keymanapp/models-types/index.d.ts",
- "../node_modules/@keymanapp/web-environment/environment.inc.ts",
- "../node_modules/@keymanapp/web-utils/src/index.ts",
- "nodeProctor.ts"
+ "index.ts",
+ "proctor.ts",
+ "nodeProctor.ts"
+ ],
+
+ "references": [
+ { "path": "../../../../../../resources/web-environment" },
+ { "path": "../../../../../../common/core/web/utils" },
+ { "path": "../../../../../../common/core/web/keyboard-processor/src" },
+ { "path": "../../../../../../common/web/lm-message-types" }
]
}
diff --git a/common/core/web/tools/recorder/src/tsconfig.json b/common/core/web/tools/recorder/src/tsconfig.json
index 55a709583b..714b0175ad 100644
--- a/common/core/web/tools/recorder/src/tsconfig.json
+++ b/common/core/web/tools/recorder/src/tsconfig.json
@@ -1,19 +1,27 @@
{
+ "extends": "../../../../../../tsconfig-base.json",
+
"compilerOptions": {
- "allowJs": true,
- "module": "none",
- "outDir": "../build/",
- "inlineSources": true,
- "inlineSourceMap": true,
- "target": "es5",
- "types": ["node"],
- "lib": ["es6"],
- "outFile": "../build/index.js"
+ "allowJs": true,
+ "module": "none",
+ "outDir": "../build/",
+ "inlineSources": true,
+ "inlineSourceMap": true,
+ "target": "es5",
+ "types": ["node"],
+ "lib": ["es6"],
+ "outFile": "../build/index.js"
},
+
"files": [
- "../node_modules/@keymanapp/models-types/index.d.ts",
- "../node_modules/@keymanapp/web-environment/environment.inc.ts",
- "../node_modules/@keymanapp/web-utils/src/index.ts",
- "index.ts"
+ "index.ts",
+ "proctor.ts"
+ ],
+
+ "references": [
+ { "path": "../../../../../../resources/web-environment" },
+ { "path": "../../../../../../common/core/web/utils" },
+ { "path": "../../../../../../common/core/web/keyboard-processor/src" },
+ { "path": "../../../../../../common/web/lm-message-types" }
]
}
diff --git a/common/web/keyman-version/build.sh b/common/web/keyman-version/build.sh
old mode 100644
new mode 100755
diff --git a/web/source/build.sh b/web/source/build.sh
index 6a1c17ebe7..95e9b9445a 100755
--- a/web/source/build.sh
+++ b/web/source/build.sh
@@ -473,7 +473,7 @@ if [ $BUILD_COREWEB = true ]; then
# TEMP STUB LMLayerWorkerCode
pwd
- cat $INTERMEDIATE/keymanweb.js ../../common/predictive-text/build/intermediate/index.js > $INTERMEDIATE/km1.js
+ cat $INTERMEDIATE/keymanweb.js <(echo) ../../common/predictive-text/build/index.js > $INTERMEDIATE/km1.js
mv $INTERMEDIATE/km1.js $INTERMEDIATE/keymanweb.js
echo Native TypeScript compiled as $INTERMEDIATE/keymanweb.js
diff --git a/web/source/build_dev_resources.sh b/web/source/build_dev_resources.sh
index 6dde04fdb8..1f113c9191 100755
--- a/web/source/build_dev_resources.sh
+++ b/web/source/build_dev_resources.sh
@@ -1,5 +1,5 @@
#! /bin/bash
-#
+#
# Compiles development-related KeymanWeb resources for use with developing/running tests.
# - the Recorder module (for engine tests)
# - the DOM module (for touch-alias and element-interface tests)
@@ -49,7 +49,7 @@ compilecmd="$compiler"
for (( n=0; n<$PRODUCT_COUNT; n++ )) # Apparently, args ends up zero-based, meaning $2 => n=1.
do
- $compilecmd -p $NODE_SOURCE/tsconfig.${SCRIPT_TAGS[$n]}.json
+ $compilecmd --build $NODE_SOURCE/tsconfig.${SCRIPT_TAGS[$n]}.json
if [ $? -ne 0 ]; then
fail "Typescript compilation failed for '${SCRIPT_TAGS[$n]}'."
fi
diff --git a/web/source/tsconfig.dev_resources.json b/web/source/tsconfig.dev_resources.json
index c3510167fa..02a76fc879 100644
--- a/web/source/tsconfig.dev_resources.json
+++ b/web/source/tsconfig.dev_resources.json
@@ -1,17 +1,28 @@
{
+ "extends": "../../tsconfig-base.json",
+
"compilerOptions": {
- "allowJs": true,
- "inlineSources": true,
- "module": "none",
- "outFile": "../release/dev_resources/dev_resources.js",
- "sourceMap": true,
- "target": "es5"
- },
+ "allowJs": true,
+ "inlineSources": true,
+ "module": "none",
+ "outFile": "../release/dev_resources/dev_resources.js",
+ "sourceMap": true,
+ "target": "es5"
+ },
+
"files": [
- "../node_modules/@keymanapp/keyboard-processor/src/text/outputTarget.ts",
- "../node_modules/@keymanapp/web-environment/environment.inc.ts",
- "../node_modules/@keymanapp/web-utils/src/index.ts",
- "../node_modules/@keymanapp/lexical-model-layer/message.d.ts",
- "dom/targets/wrapElement.ts"
+ "dom/targets/wrapElement.ts",
+ "dom/targets/input.ts",
+ "dom/targets/textarea.ts",
+ "dom/targets/contentEditable.ts",
+ "dom/targets/designIFrame.ts",
+ "dom/targets/touchAlias.ts",
+ ],
+
+ "references": [
+ { "path": "../../common/core/web/keyboard-processor/src" },
+ { "path": "../../resources/web-environment" },
+ { "path": "../../common/core/web/utils" },
+ { "path": "../../common/web/lm-message-types" }
]
}
diff --git a/web/tools/recorder/browserDriver.ts b/web/tools/recorder/browserDriver.ts
index 4922a998af..83e062d7f1 100644
--- a/web/tools/recorder/browserDriver.ts
+++ b/web/tools/recorder/browserDriver.ts
@@ -1,5 +1,3 @@
-///
-
namespace KMWRecorder {
export class BrowserDriver {
static readonly physicalEventClass: string = "KeyboardEvent";
@@ -44,7 +42,7 @@ namespace KMWRecorder {
event = document.createEvent(BrowserDriver.physicalEventClass);
// An override to ensure that IE's method gets called.
// Many thanks to https://gist.github.com/termi/4654819, line 142 at the time of writing this.
- var success = (event).initKeyboardEvent(BrowserDriver.physicalEventType, false, true, null, eventSpec.key, /*this.code,*/ eventSpec.location,
+ var success = (event).initKeyboardEvent(BrowserDriver.physicalEventType, false, true, null, eventSpec.key, /*this.code,*/ eventSpec.location,
eventSpec.generateModifierString(), 0, 0);
}
diff --git a/web/tools/recorder/build.sh b/web/tools/recorder/build.sh
index 7d90e80384..efefa4018e 100755
--- a/web/tools/recorder/build.sh
+++ b/web/tools/recorder/build.sh
@@ -1,5 +1,5 @@
#! /bin/bash
-#
+#
# Compiles development-related KeymanWeb resources for use with developing/running tests.
# - the Recorder module (for engine tests)
# - the DOM module (for touch-alias and element-interface tests)
@@ -35,7 +35,7 @@ popd
compiler="npm run tsc --"
compilecmd="$compiler"
-$compilecmd -p "$SCRIPT_DIR/tsconfig.json"
+$compilecmd --build "$SCRIPT_DIR/tsconfig.json"
if [ $? -ne 0 ]; then
fail "KeymanWeb test sequence recorder compilation failed."
fi
diff --git a/web/tools/recorder/scribe.ts b/web/tools/recorder/scribe.ts
index 073f344721..70885d5116 100644
--- a/web/tools/recorder/scribe.ts
+++ b/web/tools/recorder/scribe.ts
@@ -1,22 +1,20 @@
-///
-///
//Since TS won't recognize the types b/c no "import"/"require" statements.
// A small-scale manual definition.
-declare class EventEmitter {
- /** Add a listener for a given event */
- on(event: string, func: (...args: any[]) => boolean, context?: any);
- /** Add a one-time listener for a given event */
- once(event: string, func: (...args: any[]) => boolean, context?: any);
- removeListener(event: string, func: (...args: any[]) => boolean, context?: any, once?: boolean);
+// declare class EventEmitter {
+// /** Add a listener for a given event */
+// on(event: string, func: (...args: any[]) => boolean, context?: any);
+// /** Add a one-time listener for a given event */
+// once(event: string, func: (...args: any[]) => boolean, context?: any);
+// removeListener(event: string, func: (...args: any[]) => boolean, context?: any, once?: boolean);
- // Defines their alternately-themed aliases.
- addListener: typeof EventEmitter.prototype.on;
- off: typeof EventEmitter.prototype.removeListener;
+// // Defines their alternately-themed aliases.
+// addListener: typeof EventEmitter.prototype.on;
+// off: typeof EventEmitter.prototype.removeListener;
- // Defines the actual event-raising function.
- emit(eventName: string, ...args: any[]);
-}
+// // Defines the actual event-raising function.
+// emit(eventName: string, ...args: any[]);
+// }
// Makes sure the code below knows that the namespaces exist.
namespace com.keyman {
@@ -35,8 +33,8 @@ namespace com.keyman {
namespace KMWRecorder {
/**
- * Contains browser-dependent code used to transcribe browser-based events
- * so that thay may be reconstructed for use in KMW testing.
+ * Contains browser-dependent code used to transcribe browser-based events
+ * so that thay may be reconstructed for use in KMW testing.
*/
export class Scribe extends EventEmitter {
//#region Static methods for recording input events
@@ -155,7 +153,7 @@ namespace KMWRecorder {
} else {
delete this.currentSequence.msg;
}
-
+
this.raiseRecordChanged();
}
@@ -196,7 +194,7 @@ namespace KMWRecorder {
window.setTimeout(function() {
recorderScribe.addInputRecord(recording, in_output.getText());
}, 1);
-
+
return retVal;
}
@@ -244,7 +242,7 @@ namespace KMWRecorder {
recorderScribe.emit('stub-changed', JSON.stringify(kbdRecord));
// var ta_activeStub = document.getElementById('activeStub');
// ta_activeStub.value = JSON.stringify(kbdRecord);
-
+
if(!sameKbd && !recorderScribe.keyboardJustActivated) {
recorderScribe.testDefinition = new KMWRecorder.KeyboardTest(kbdRecord);
}
diff --git a/web/tools/recorder/tsconfig.json b/web/tools/recorder/tsconfig.json
index 1b29c715ea..d9d74c437a 100644
--- a/web/tools/recorder/tsconfig.json
+++ b/web/tools/recorder/tsconfig.json
@@ -1,16 +1,26 @@
{
+ "extends": "../../../tsconfig-base.json",
"compilerOptions": {
- "allowJs": true,
- "inlineSources": true,
- "module": "none",
- "outFile": "build/recorder_InputEvents.js",
- "sourceMap": true,
- "target": "es5"
- },
+ "allowJs": true,
+ "inlineSources": true,
+ "module": "none",
+ "outFile": "build/recorder_InputEvents.js",
+ "sourceMap": true,
+ "target": "es5"
+ },
+
"files": [
- "../../node_modules/@keymanapp/web-environment/environment.inc.ts",
- "../../node_modules/@keymanapp/web-utils/src/index.ts",
- "../../node_modules/@keymanapp/lexical-model-layer/message.d.ts",
- "browserProctor.ts"
+ "browserProctor.ts",
+ "browserDriver.ts",
+ "scribe.ts"
+ ],
+
+ "references": [
+ { "path": "../../../resources/web-environment" },
+ { "path": "../../../common/core/web/utils" },
+ { "path": "../../../common/core/web/keyboard-processor/src" },
+ { "path": "../../../common/core/web/input-processor/src" },
+ { "path": "../../../common/core/web/tools/recorder/src" },
+ { "path": "../../../common/web/lm-message-types" }
]
}
diff --git a/web/unit_tests/test.sh b/web/unit_tests/test.sh
index 1a3389652d..c4acc05235 100755
--- a/web/unit_tests/test.sh
+++ b/web/unit_tests/test.sh
@@ -129,7 +129,7 @@ cd ../tools/recorder
# Run our headless tests first.
# First: Web-core tests.
-pushd $WORKING_DIRECTORY/node_modules/@keymanapp/input-processor
+pushd "$KEYMAN_ROOT/common/core/web/input-processor"
./test.sh $HEADLESS_FLAGS || fail "Tests failed by dependencies; aborting integration tests."
# Once done, now we run the integrated (KeymanWeb) tests.
popd