2019-10-12 21:52:04 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
require 'spec_helper'
|
|
|
|
|
2018-11-08 19:23:39 +05:30
|
|
|
describe 'Blob shortcuts', :js do
|
2018-03-17 18:26:18 +05:30
|
|
|
let(:user) { create(:user) }
|
|
|
|
let(:project) { create(:project, :public, :repository) }
|
|
|
|
let(:issue) { create(:issue, project: project, author: user) }
|
|
|
|
let(:merge_request) { create(:merge_request, source_project: project) }
|
|
|
|
let(:note_text) { 'I got this!' }
|
|
|
|
|
|
|
|
before do
|
|
|
|
project.add_developer(user)
|
|
|
|
sign_in(user)
|
|
|
|
end
|
|
|
|
|
2018-11-08 19:23:39 +05:30
|
|
|
shared_examples "quotes the selected text" do
|
2019-07-31 22:56:46 +05:30
|
|
|
it "quotes the selected text", :quarantine do
|
2018-11-08 19:23:39 +05:30
|
|
|
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
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
describe 'pressing "r"' do
|
|
|
|
describe 'On an Issue' do
|
|
|
|
before do
|
|
|
|
create(:note, noteable: issue, project: project, note: note_text)
|
|
|
|
visit project_issue_path(project, issue)
|
|
|
|
wait_for_requests
|
|
|
|
end
|
|
|
|
|
2018-11-08 19:23:39 +05:30
|
|
|
include_examples 'quotes the selected text'
|
2018-03-17 18:26:18 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
describe 'On a Merge Request' do
|
|
|
|
before do
|
|
|
|
create(:note, noteable: merge_request, project: project, note: note_text)
|
|
|
|
visit project_merge_request_path(project, merge_request)
|
|
|
|
wait_for_requests
|
|
|
|
end
|
|
|
|
|
2018-11-08 19:23:39 +05:30
|
|
|
include_examples 'quotes the selected text'
|
2018-03-17 18:26:18 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|