Repository: guacamole-website Updated Branches: refs/heads/master 4a87ae489 -> 66eb08c22
Include Guacamole.InputSink and listenTo() in keyboard test if available. Project: http://git-wip-us.apache.org/repos/asf/guacamole-website/repo Commit: http://git-wip-us.apache.org/repos/asf/guacamole-website/commit/8993355a Tree: http://git-wip-us.apache.org/repos/asf/guacamole-website/tree/8993355a Diff: http://git-wip-us.apache.org/repos/asf/guacamole-website/diff/8993355a Branch: refs/heads/master Commit: 8993355aa01302138eae0af5e119de136c01b65a Parents: 4a87ae4 Author: Michael Jumper <mjum...@apache.org> Authored: Wed Oct 3 06:54:02 2018 -0700 Committer: Michael Jumper <mjum...@apache.org> Committed: Wed Oct 3 06:54:02 2018 -0700 ---------------------------------------------------------------------- pub/tests/guac/keyboard-test.html | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/guacamole-website/blob/8993355a/pub/tests/guac/keyboard-test.html ---------------------------------------------------------------------- diff --git a/pub/tests/guac/keyboard-test.html b/pub/tests/guac/keyboard-test.html index 6a10a56..71849f1 100644 --- a/pub/tests/guac/keyboard-test.html +++ b/pub/tests/guac/keyboard-test.html @@ -27,7 +27,7 @@ <body> - <textarea></textarea> + <textarea id="field"></textarea> <div id="log"></div> @@ -38,6 +38,7 @@ <!-- Load required guacamole-common-js modules from git --> <script type="text/javascript"> + GIT_GUAC.loadModule('InputSink.js'); GIT_GUAC.loadModule('Keyboard.js'); GIT_GUAC.loadModule('Version.js'); </script> @@ -57,6 +58,22 @@ var keyboard = new Guacamole.Keyboard(document); + // Listen to additional elements if version of API being + // tested defines listenTo() + if (keyboard.listenTo) { + + keyboard.listenTo(document.getElementById('field')); + + // Use Guacamole.InputSink if available in version of API + // being tested + if (Guacamole.InputSink) { + var sink = new Guacamole.InputSink(); + document.body.appendChild(sink.getElement()); + keyboard.listenTo(sink.getElement()); + } + + } + keyboard.onkeydown = function(keysym) { log.log("guacamole", "keydown", "0x" + keysym.toString(16), X11_KEYSYM[keysym]);