From 71612af7eb81fa77c0be98a2a69e4852f4003e66 Mon Sep 17 00:00:00 2001 From: Stephen Blott Date: Sat, 8 Oct 2016 07:52:19 +0100 Subject: Refactor (and fix) key-parsing regexp. Fixes #2299. Also, separate this regexp out into its constituent parts, because it is becoming too different to read. --- tests/unit_tests/commands_test.coffee | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/unit_tests/commands_test.coffee b/tests/unit_tests/commands_test.coffee index 508e298b..2c2e9542 100644 --- a/tests/unit_tests/commands_test.coffee +++ b/tests/unit_tests/commands_test.coffee @@ -15,12 +15,19 @@ context "Key mappings", @testKeySequence "A", "A", 1 @testKeySequence "ab", "a/b", 2 + should "recognise non-alphabetic keys", -> + @testKeySequence "#", "#", 1 + @testKeySequence ".", ".", 1 + @testKeySequence "##", "#/#", 2 + @testKeySequence "..", "./.", 2 + should "parse keys with modifiers", -> @testKeySequence "", "", 1 @testKeySequence "", "", 1 @testKeySequence "", "", 1 @testKeySequence "", "/", 2 @testKeySequence "", "", 1 + @testKeySequence "z", "z/", 2 should "normalize with modifiers", -> # Modifiers should be in alphabetical order. @@ -33,7 +40,7 @@ context "Key mappings", @testKeySequence "", "", 1 @testKeySequence "", "", 1 - should "handle angle brackets", -> + should "handle angle brackets which are part of not modifiers", -> @testKeySequence "<", "<", 1 @testKeySequence ">", ">", 1 @@ -46,6 +53,8 @@ context "Key mappings", @testKeySequence "<", "", 2 @testKeySequence ">", ">", 1 + @testKeySequence "", "", 3 + should "negative tests", -> # These should not be parsed as modifiers. @testKeySequence "", "", 5 -- cgit v1.2.3