Commit 2ecf9851 authored by Rémy Coutable's avatar Rémy Coutable

Merge branch 'close-revert-and-cherry-pick-modal-on-escape-keypress' into 'master'

Close revert and cherry pick modal on escape keypress

See merge request gitlab-org/gitlab-ce!20341
parents 9c1a3bce 4201d428
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
- branch_label = s_('ChangeTypeActionLabel|Pick into branch') - branch_label = s_('ChangeTypeActionLabel|Pick into branch')
- title = commit.merged_merge_request(current_user) ? _('Cherry-pick this merge request') : _('Cherry-pick this commit') - title = commit.merged_merge_request(current_user) ? _('Cherry-pick this merge request') : _('Cherry-pick this commit')
.modal{ id: "modal-#{type}-commit" } .modal{ id: "modal-#{type}-commit", tabindex: -1 }
.modal-dialog .modal-dialog
.modal-content .modal-content
.modal-header .modal-header
......
---
title: Close revert and cherry pick modal on escape keypress
merge_request: 20341
author: George Tsiolis
type: changed
require 'rails_helper' require 'rails_helper'
describe 'Merge request > User sees Check out branch modal', :js do describe 'Merge request > User sees check out branch modal', :js do
let(:project) { create(:project, :public, :repository) } let(:project) { create(:project, :public, :repository) }
let(:user) { project.creator } let(:user) { project.creator }
let(:merge_request) { create(:merge_request, source_project: project) } let(:merge_request) { create(:merge_request, source_project: project) }
...@@ -16,7 +16,7 @@ describe 'Merge request > User sees Check out branch modal', :js do ...@@ -16,7 +16,7 @@ describe 'Merge request > User sees Check out branch modal', :js do
expect(page).to have_content('Check out, review, and merge locally') expect(page).to have_content('Check out, review, and merge locally')
end end
it 'closes the check out branch model with Escape keypress' do it 'closes the check out branch modal with escape keypress' do
find('#modal_merge_info').send_keys(:escape) find('#modal_merge_info').send_keys(:escape)
expect(page).not_to have_content('Check out, review, and merge locally') expect(page).not_to have_content('Check out, review, and merge locally')
......
...@@ -21,7 +21,7 @@ describe 'Merge request > User cherry-picks', :js do ...@@ -21,7 +21,7 @@ describe 'Merge request > User cherry-picks', :js do
end end
# Fast-forward merge, or merged before GitLab 8.5. # Fast-forward merge, or merged before GitLab 8.5.
context 'Without a merge commit' do context 'without a merge commit' do
before do before do
merge_request.merge_commit_sha = nil merge_request.merge_commit_sha = nil
merge_request.save merge_request.save
...@@ -34,7 +34,7 @@ describe 'Merge request > User cherry-picks', :js do ...@@ -34,7 +34,7 @@ describe 'Merge request > User cherry-picks', :js do
end end
end end
context 'With a merge commit' do context 'with a merge commit' do
it 'shows a Cherry-pick button' do it 'shows a Cherry-pick button' do
visit project_merge_request_path(project, merge_request) visit project_merge_request_path(project, merge_request)
...@@ -49,5 +49,23 @@ describe 'Merge request > User cherry-picks', :js do ...@@ -49,5 +49,23 @@ describe 'Merge request > User cherry-picks', :js do
expect(page).not_to have_link 'Cherry-pick' expect(page).not_to have_link 'Cherry-pick'
end end
end end
context 'and seeing the cherry-pick modal' do
before do
visit project_merge_request_path(project, merge_request)
click_link('Cherry-pick')
end
it 'shows the cherry-pick modal' do
expect(page).to have_content('Cherry-pick this merge request')
end
it 'closes the cherry-pick modal with escape keypress' do
find('#modal-cherry-pick-commit').send_keys(:escape)
expect(page).not_to have_content('Start a new merge request with these changes')
end
end
end end
end end
require 'rails_helper'
describe 'Merge request > User sees revert modal', :js do
let(:project) { create(:project, :public, :repository) }
let(:user) { project.creator }
let(:merge_request) { create(:merge_request, source_project: project) }
before do
sign_in(user)
visit(project_merge_request_path(project, merge_request))
click_button('Merge')
visit(merge_request_path(merge_request))
click_link('Revert')
end
it 'shows the revert modal' do
expect(page).to have_content('Revert this merge request')
end
it 'closes the revert modal with escape keypress' do
find('#modal-revert-commit').send_keys(:escape)
expect(page).not_to have_content('Revert this merge request')
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment