diff options
Diffstat (limited to 'spec/features/issuables/shortcuts_issuable_spec.rb')
-rw-r--r-- | spec/features/issuables/shortcuts_issuable_spec.rb | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/spec/features/issuables/shortcuts_issuable_spec.rb b/spec/features/issuables/shortcuts_issuable_spec.rb index e25fd1a6249..0a19086ffbd 100644 --- a/spec/features/issuables/shortcuts_issuable_spec.rb +++ b/spec/features/issuables/shortcuts_issuable_spec.rb @@ -12,6 +12,15 @@ feature 'Blob shortcuts', :js do sign_in(user) end + shared_examples "quotes the selected text" do + it "quotes the selected text" do + select_element('.note-text') + find('body').native.send_key('r') + + expect(find('.js-main-target-form .js-vue-comment-form').value).to include(note_text) + end + end + describe 'pressing "r"' do describe 'On an Issue' do before do @@ -20,12 +29,7 @@ feature 'Blob shortcuts', :js do wait_for_requests end - it 'quotes the selected text' do - select_element('.note-text') - find('body').native.send_key('r') - - expect(find('.js-main-target-form .js-vue-comment-form').value).to include(note_text) - end + include_examples 'quotes the selected text' end describe 'On a Merge Request' do @@ -35,12 +39,7 @@ feature 'Blob shortcuts', :js do wait_for_requests end - it 'quotes the selected text' do - select_element('.note-text') - find('body').native.send_key('r') - - expect(find('.js-main-target-form #note_note').value).to include(note_text) - end + include_examples 'quotes the selected text' end end end |