From 811d6e864de485a11bb46d4a0618b9a27027f3c7 Mon Sep 17 00:00:00 2001 From: Stephen Blott Date: Sun, 6 Mar 2016 09:25:19 +0000 Subject: Normal mode tests. With #2022, we can now implement normal-mode key-handling tests. Writing these tests uncovered the bug behind 7774beb6643c0d905f9caba4345453790af948ad. --- content_scripts/mode_key_handler.coffee | 2 ++ content_scripts/vimium_frontend.coffee | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'content_scripts') diff --git a/content_scripts/mode_key_handler.coffee b/content_scripts/mode_key_handler.coffee index 9946dddf..f2c4a745 100644 --- a/content_scripts/mode_key_handler.coffee +++ b/content_scripts/mode_key_handler.coffee @@ -15,6 +15,8 @@ class KeyHandlerMode extends Mode keydownEvents: {} setKeyMapping: (@keyMapping) -> @reset() setPassKeys: (@passKeys) -> @reset() + # Only for tests. + setCommandHandler: (@commandHandler) -> # Reset the key state, optionally retaining the count provided. reset: (@countPrefix = 0) -> diff --git a/content_scripts/vimium_frontend.coffee b/content_scripts/vimium_frontend.coffee index 972911c5..2e57ee1a 100644 --- a/content_scripts/vimium_frontend.coffee +++ b/content_scripts/vimium_frontend.coffee @@ -126,11 +126,11 @@ class NormalMode extends KeyHandlerMode else Utils.invokeCommandString registryEntry.command for i in [0...count] -# Only exported for tests; also, "args..." is only for the tests. -window.initializeModes = (args...) -> +# Only exported for tests. +window.initializeModes = -> # Install the permanent modes. The permanently-installed insert mode tracks focus/blur events, and # activates/deactivates itself accordingly. normalMode is exported only for the tests. - window.normalMode = new NormalMode args... + window.normalMode = new NormalMode new InsertMode permanent: true Scroller.init() -- cgit v1.2.3