From e6ab03164cee5e4a5f0c61e76b219424286d50df Mon Sep 17 00:00:00 2001 From: ansuz Date: Tue, 12 Apr 2016 14:34:47 +0200 Subject: [PATCH] import TypingTests.js and expose at the console RTWYSIWYG-54 > implement tests for components of the WYSIWYG editor --- www/pad/main.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/www/pad/main.js b/www/pad/main.js index b5f43e722..b29c4d8ac 100644 --- a/www/pad/main.js +++ b/www/pad/main.js @@ -8,10 +8,11 @@ define([ '/common/toolbar.js', '/common/cursor.js', '/common/json-ot.js', + '/common/TypingTests.js', '/bower_components/diff-dom/diffDOM.js', '/bower_components/jquery/dist/jquery.min.js', '/customize/pad.js' -], function (Config, Messages, Crypto, realtimeInput, Hyperjson, Hyperscript, Toolbar, Cursor, JsonOT) { +], function (Config, Messages, Crypto, realtimeInput, Hyperjson, Hyperscript, Toolbar, Cursor, JsonOT, TypingTest) { var $ = window.jQuery; var ifrw = $('#pad-iframe')[0].contentWindow; var Ckeditor; // to be initialized later... @@ -328,6 +329,17 @@ define([ inner.addEventListener('keydown', cursor.brFix); editor.on('change', propogate); + + // export the typing tests to the window. + // call like `test = easyTest()` + // terminate the test like `test.cancel()` + var easyTest = window.easyTest = function () { + cursor.update(); + var start = cursor.Range.start; + var test = TypingTest.testInput(inner, start.el, start.offset, propogate); + propogate(); + return test; + }; }); };