aboutsummaryrefslogtreecommitdiffstats
path: root/content_scripts
diff options
context:
space:
mode:
authorStephen Blott2016-03-06 09:25:19 +0000
committerStephen Blott2016-03-06 09:25:19 +0000
commit811d6e864de485a11bb46d4a0618b9a27027f3c7 (patch)
treefb53e1586b5b322762838d0c34a2f66cbeb86158 /content_scripts
parent7774beb6643c0d905f9caba4345453790af948ad (diff)
downloadvimium-811d6e864de485a11bb46d4a0618b9a27027f3c7.tar.bz2
Normal mode tests.
With #2022, we can now implement normal-mode key-handling tests. Writing these tests uncovered the bug behind 7774beb6643c0d905f9caba4345453790af948ad.
Diffstat (limited to 'content_scripts')
-rw-r--r--content_scripts/mode_key_handler.coffee2
-rw-r--r--content_scripts/vimium_frontend.coffee6
2 files changed, 5 insertions, 3 deletions
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()