summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhil Hughes <me@iamphill.com>2018-07-05 07:43:16 +0000
committerPhil Hughes <me@iamphill.com>2018-07-05 07:43:16 +0000
commit3bc202020565a575b4ab494adb082b6a998f1192 (patch)
treebc1ee6831f8fe7b05008f5b0a2d958f518fb30c5
parenta43b7d4a33491a040432229ab91742d3a5981c0a (diff)
parent6af7397f600b004d47acab2eb797903da5cf302d (diff)
downloadgitlab-ce-3bc202020565a575b4ab494adb082b6a998f1192.tar.gz
Merge branch 'close-revoke-deploy-token-modal-on-escape-keypress' into 'master'
Close revoke deploy token modal on escape keypress See merge request gitlab-org/gitlab-ce!20347
-rw-r--r--app/views/projects/deploy_tokens/_revoke_modal.html.haml2
-rw-r--r--changelogs/unreleased/close-revoke-deploy-token-modal-on-escape-keypress.yml5
-rw-r--r--spec/features/projects/settings/user_sees_revoke_deploy_token_modal_spec.rb25
3 files changed, 31 insertions, 1 deletions
diff --git a/app/views/projects/deploy_tokens/_revoke_modal.html.haml b/app/views/projects/deploy_tokens/_revoke_modal.html.haml
index a67c3a0c841..35eacae2c2e 100644
--- a/app/views/projects/deploy_tokens/_revoke_modal.html.haml
+++ b/app/views/projects/deploy_tokens/_revoke_modal.html.haml
@@ -1,4 +1,4 @@
-.modal{ id: "revoke-modal-#{token.id}" }
+.modal{ id: "revoke-modal-#{token.id}", tabindex: -1 }
.modal-dialog
.modal-content
.modal-header
diff --git a/changelogs/unreleased/close-revoke-deploy-token-modal-on-escape-keypress.yml b/changelogs/unreleased/close-revoke-deploy-token-modal-on-escape-keypress.yml
new file mode 100644
index 00000000000..98316cae406
--- /dev/null
+++ b/changelogs/unreleased/close-revoke-deploy-token-modal-on-escape-keypress.yml
@@ -0,0 +1,5 @@
+---
+title: Close revoke deploy token modal on escape keypress
+merge_request: 20347
+author: George Tsiolis
+type: changed
diff --git a/spec/features/projects/settings/user_sees_revoke_deploy_token_modal_spec.rb b/spec/features/projects/settings/user_sees_revoke_deploy_token_modal_spec.rb
new file mode 100644
index 00000000000..069704a1305
--- /dev/null
+++ b/spec/features/projects/settings/user_sees_revoke_deploy_token_modal_spec.rb
@@ -0,0 +1,25 @@
+require 'rails_helper'
+
+describe 'Repository Settings > User sees revoke deploy token modal', :js do
+ let(:project) { create(:project, :public, :repository) }
+ let(:user) { project.creator }
+ let(:role) { :developer }
+ let!(:deploy_token) { create(:deploy_token, :gitlab_deploy_token, projects: [project]) }
+
+ before do
+ project.add_role(user, role)
+ sign_in(user)
+ visit(project_settings_repository_path(project))
+ click_link('Revoke')
+ end
+
+ it 'shows the revoke deploy token modal' do
+ expect(page).to have_content('You are about to revoke')
+ end
+
+ it 'closes the revoke deploy token modal with escape keypress' do
+ find('.modal.show').send_keys(:escape)
+
+ expect(page).not_to have_content('You are about to revoke')
+ end
+end