summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorGo MAEDA <maeda@farend.jp>2021-01-26 06:50:34 +0000
committerGo MAEDA <maeda@farend.jp>2021-01-26 06:50:34 +0000
commit082570094a512c06d86fabf9df7a602e42645be4 (patch)
tree054c9f916f1f8d944415ae0abe67023586d5d072 /test
parent876d6fd628ca99c8fb668636e1762e59955abece (diff)
downloadredmine-082570094a512c06d86fabf9df7a602e42645be4.tar.gz
redmine-082570094a512c06d86fabf9df7a602e42645be4.zip
Add keyboard shortcuts for bold, italic and underline buttons (#34549).
Patch by Marius BALTEANU. git-svn-id: http://svn.redmine.org/redmine/trunk@20729 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test')
-rw-r--r--test/system/keyboard_shortcuts_test.rb62
1 files changed, 62 insertions, 0 deletions
diff --git a/test/system/keyboard_shortcuts_test.rb b/test/system/keyboard_shortcuts_test.rb
index 115ee6d74..c71e3e802 100644
--- a/test/system/keyboard_shortcuts_test.rb
+++ b/test/system/keyboard_shortcuts_test.rb
@@ -68,4 +68,66 @@ class InlineAutocompleteSystemTest < ApplicationSystemTestCase
find 'textarea#issue_notes', :visible => true
find 'div#preview_issue_notes', :visible => false
end
+
+ def test_keyboard_shortcuts_for_wiki_toolbar_buttons_using_textile
+ with_settings :text_formatting => 'textile' do
+ log_user('jsmith', 'jsmith')
+ visit 'issues/new'
+
+ find('#issue_description').click.send_keys([modifier_key, 'b'])
+ assert_equal '**', find('#issue_description').value
+
+ # Clear textarea value
+ fill_in 'Description', :with => ''
+ find('#issue_description').send_keys([modifier_key, 'u'])
+ assert_equal '++', find('#issue_description').value
+
+ # Clear textarea value
+ fill_in 'Description', :with => ''
+ find('#issue_description').send_keys([modifier_key, 'i'])
+ assert_equal '__', find('#issue_description').value
+ end
+ end
+
+ def test_keyboard_shortcuts_for_wiki_toolbar_buttons_using_markdown
+ with_settings :text_formatting => 'markdown' do
+ log_user('jsmith', 'jsmith')
+ visit 'issues/new'
+
+ find('#issue_description').click.send_keys([modifier_key, 'b'])
+ assert_equal '****', find('#issue_description').value
+
+ # Clear textarea value
+ fill_in 'Description', :with => ''
+ find('#issue_description').send_keys([modifier_key, 'u'])
+ assert_equal '__', find('#issue_description').value
+
+ # Clear textarea value
+ fill_in 'Description', :with => ''
+ find('#issue_description').send_keys([modifier_key, 'i'])
+ assert_equal '**', find('#issue_description').value
+ end
+ end
+
+ def test_keyboard_shortcuts_keys_should_be_shown_in_button_title
+ log_user('jsmith', 'jsmith')
+ visit 'issues/new'
+
+ within('.jstBlock .jstElements') do
+ assert_equal "Strong (#{modifier_key_title}B)", find('button.jstb_strong')['title']
+ assert_equal "Italic (#{modifier_key_title}I)", find('button.jstb_em')['title']
+ assert_equal "Underline (#{modifier_key_title}U)", find('button.jstb_ins')['title']
+ end
+ end
+
+ private
+
+ def modifier_key
+ modifier = osx? ? "command" : "control"
+ modifier.to_sym
+ end
+
+ def modifier_key_title
+ osx? ? "⌘" : "Ctrl+"
+ end
end