diff --git a/devices/pc/keyboard/keyboard-test.xml b/devices/pc/keyboard/keyboard-test.xml
index 5d90fef5b..42b81ef7d 100644
--- a/devices/pc/keyboard/keyboard-test.xml
+++ b/devices/pc/keyboard/keyboard-test.xml
@@ -7,5 +7,6 @@
↑
↓
→
- TEST
+ HELLO
+ GOODBYE
diff --git a/modules/pcjs/lib/keyboard.js b/modules/pcjs/lib/keyboard.js
index 1cc87eb45..6f18149f2 100644
--- a/modules/pcjs/lib/keyboard.js
+++ b/modules/pcjs/lib/keyboard.js
@@ -1048,14 +1048,6 @@ Keyboard.prototype.setBinding = function(sHTMLType, sBinding, control, sValue)
};
return true;
- case "test":
- this.bindings[id] = control;
- control.onclick = function onClickTest(event) {
- if (kbd.cpu) kbd.cpu.setFocus();
- return kbd.injectKeys(sValue);
- };
- return true;
-
default:
/*
* Maintain support for older button codes; eg, map button code "ctrl-c" to CLICKCODE "CTRL_C"
@@ -1072,7 +1064,8 @@ Keyboard.prototype.setBinding = function(sHTMLType, sBinding, control, sValue)
};
}(this, sCode, Keyboard.CLICKCODES[sCode]);
return true;
- } else if (Keyboard.SOFTCODES[sBinding] !== undefined) {
+ }
+ else if (Keyboard.SOFTCODES[sBinding] !== undefined) {
this.cSoftCodes++;
this.bindings[id] = control;
var fnDown = function(kbd, sKey, simCode) {
@@ -1094,6 +1087,19 @@ Keyboard.prototype.setBinding = function(sHTMLType, sBinding, control, sValue)
}
return true;
}
+ else if (sValue) {
+ /*
+ * Instead of just having a dedicated "test" control, we now treat any unrecognized control with
+ * a data value as a test control. The only caveat is that such controls must have binding IDs that
+ * do not conflict with predefined controls (which, of course, is the only way you can get here).
+ */
+ this.bindings[id] = control;
+ control.onclick = function onClickTest(event) {
+ if (kbd.cpu) kbd.cpu.setFocus();
+ return kbd.injectKeys(sValue);
+ };
+ return true;
+ }
break;
}
}