diff options
author | Florian Bruhin <me@the-compiler.org> | 2020-12-22 12:32:14 +0100 |
---|---|---|
committer | Florian Bruhin <me@the-compiler.org> | 2020-12-22 12:32:14 +0100 |
commit | ae8d6e0800a6ea343f982f123be61873699391e4 (patch) | |
tree | 86fcbfd622734077005c27b7bfad3e59e356c748 | |
parent | ffa2f9eca927ceeba4b6539f6b7a57fa58ba9380 (diff) | |
parent | 7aca1e257c3c14c257d4f1eb08cee35d323324e0 (diff) | |
download | qutebrowser-ae8d6e0800a6ea343f982f123be61873699391e4.tar.gz qutebrowser-ae8d6e0800a6ea343f982f123be61873699391e4.zip |
Merge remote-tracking branch 'origin/pr/5966'
-rwxr-xr-x | misc/userscripts/qute-lastpass | 7 | ||||
-rw-r--r-- | tests/end2end/features/keyinput.feature | 8 | ||||
-rw-r--r-- | tests/unit/misc/userscripts/test_qute_lastpass.py | 4 |
3 files changed, 14 insertions, 5 deletions
diff --git a/misc/userscripts/qute-lastpass b/misc/userscripts/qute-lastpass index cd584ae3a..e71630792 100755 --- a/misc/userscripts/qute-lastpass +++ b/misc/userscripts/qute-lastpass @@ -105,8 +105,11 @@ def fake_key_raw(text): sequence = '' for character in text: - # Escape all characters by default, space requires special handling - sequence += ('" "' if character == ' ' else '\\{}'.format(character)) + # Escape all characters by default, space, '<' and '>' requires special handling + sequence += ('" "' if character == ' ' else + '<less>' if character == '<' else + '<greater>' if character == '>' else + '\\{}'.format(character)) qute_command('fake-key {}'.format(sequence)) diff --git a/tests/end2end/features/keyinput.feature b/tests/end2end/features/keyinput.feature index aa9009f7c..0e344947d 100644 --- a/tests/end2end/features/keyinput.feature +++ b/tests/end2end/features/keyinput.feature @@ -56,11 +56,17 @@ Feature: Keyboard input Scenario: :fake-key sending keychain to the website When I open data/keyinput/log.html - And I run :fake-key xy + And I run :fake-key x<greater>y<less>" " Then the javascript message "key press: 88" should be logged And the javascript message "key release: 88" should be logged + And the javascript message "key press: 190" should be logged + And the javascript message "key release: 190" should be logged And the javascript message "key press: 89" should be logged And the javascript message "key release: 89" should be logged + And the javascript message "key press: 188" should be logged + And the javascript message "key release: 188" should be logged + And the javascript message "key press: 32" should be logged + And the javascript message "key release: 32" should be logged Scenario: :fake-key sending keypress to qutebrowser When I run :fake-key -g x diff --git a/tests/unit/misc/userscripts/test_qute_lastpass.py b/tests/unit/misc/userscripts/test_qute_lastpass.py index 20646edd0..7b5f35ace 100644 --- a/tests/unit/misc/userscripts/test_qute_lastpass.py +++ b/tests/unit/misc/userscripts/test_qute_lastpass.py @@ -82,10 +82,10 @@ class TestQuteLastPassComponents: def test_fake_key_raw(self, qutecommand_mock): """Test if fake_key_raw properly escapes characters.""" - qute_lastpass.fake_key_raw('john.doe@example.com ') + qute_lastpass.fake_key_raw('john.<<doe>>@example.com ') qutecommand_mock.assert_called_once_with( - 'fake-key \\j\\o\\h\\n\\.\\d\\o\\e\\@\\e\\x\\a\\m\\p\\l\\e\\.\\c\\o\\m" "' + 'fake-key \\j\\o\\h\\n\\.<less><less>\\d\\o\\e<greater><greater>\\@\\e\\x\\a\\m\\p\\l\\e\\.\\c\\o\\m" "' ) def test_dmenu(self, subprocess_mock): |