Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
b40c468b
Commit
b40c468b
authored
6 years ago
by
Jamie Schembri
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix #48934 - Focus on text input on danger confirmation
parent
b14b31b8
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
29 additions
and
2 deletions
+29
-2
app/assets/javascripts/confirm_danger_modal.js
app/assets/javascripts/confirm_danger_modal.js
+4
-1
changelogs/unreleased/48934.yml
changelogs/unreleased/48934.yml
+5
-0
spec/features/groups_spec.rb
spec/features/groups_spec.rb
+6
-0
spec/features/projects/settings/user_transfers_a_project_spec.rb
...atures/projects/settings/user_transfers_a_project_spec.rb
+8
-1
spec/features/projects_spec.rb
spec/features/projects_spec.rb
+6
-0
No files found.
app/assets/javascripts/confirm_danger_modal.js
View file @
b40c468b
...
@@ -2,13 +2,16 @@ import $ from 'jquery';
...
@@ -2,13 +2,16 @@ import $ from 'jquery';
import
{
rstrip
}
from
'
./lib/utils/common_utils
'
;
import
{
rstrip
}
from
'
./lib/utils/common_utils
'
;
function
openConfirmDangerModal
(
$form
,
text
)
{
function
openConfirmDangerModal
(
$form
,
text
)
{
const
$input
=
$
(
'
.js-confirm-danger-input
'
);
$input
.
val
(
''
);
$
(
'
.js-confirm-text
'
).
text
(
text
||
''
);
$
(
'
.js-confirm-text
'
).
text
(
text
||
''
);
$
(
'
.js-confirm-danger-input
'
).
val
(
''
);
$
(
'
#modal-confirm-danger
'
).
modal
(
'
show
'
);
$
(
'
#modal-confirm-danger
'
).
modal
(
'
show
'
);
const
confirmTextMatch
=
$
(
'
.js-confirm-danger-match
'
).
text
();
const
confirmTextMatch
=
$
(
'
.js-confirm-danger-match
'
).
text
();
const
$submit
=
$
(
'
.js-confirm-danger-submit
'
);
const
$submit
=
$
(
'
.js-confirm-danger-submit
'
);
$submit
.
disable
();
$submit
.
disable
();
$input
.
focus
();
$
(
'
.js-confirm-danger-input
'
).
off
(
'
input
'
).
on
(
'
input
'
,
function
handleInput
()
{
$
(
'
.js-confirm-danger-input
'
).
off
(
'
input
'
).
on
(
'
input
'
,
function
handleInput
()
{
const
confirmText
=
rstrip
(
$
(
this
).
val
());
const
confirmText
=
rstrip
(
$
(
this
).
val
());
...
...
This diff is collapsed.
Click to expand it.
changelogs/unreleased/48934.yml
0 → 100644
View file @
b40c468b
---
title
:
Improve danger confirmation modals by focusing input field
merge_request
:
author
:
Jamie Schembri
type
:
added
This diff is collapsed.
Click to expand it.
spec/features/groups_spec.rb
View file @
b40c468b
...
@@ -154,6 +154,12 @@ describe 'Group' do
...
@@ -154,6 +154,12 @@ describe 'Group' do
end
end
end
end
it
'focuses confirmation field on remove group'
do
click_button
(
'Remove group'
)
expect
(
page
).
to
have_selector
'#confirm_name_input:focus'
end
it
'removes group'
do
it
'removes group'
do
expect
{
remove_with_confirm
(
'Remove group'
,
group
.
path
)
}.
to
change
{
Group
.
count
}.
by
(
-
1
)
expect
{
remove_with_confirm
(
'Remove group'
,
group
.
path
)
}.
to
change
{
Group
.
count
}.
by
(
-
1
)
expect
(
group
.
members
.
all
.
count
).
to
be_zero
expect
(
group
.
members
.
all
.
count
).
to
be_zero
...
...
This diff is collapsed.
Click to expand it.
spec/features/projects/settings/user_transfers_a_project_spec.rb
View file @
b40c468b
...
@@ -10,7 +10,7 @@ describe 'Projects > Settings > User transfers a project', :js do
...
@@ -10,7 +10,7 @@ describe 'Projects > Settings > User transfers a project', :js do
sign_in
(
user
)
sign_in
(
user
)
end
end
def
transfer_project
(
project
,
group
)
def
transfer_project
(
project
,
group
,
confirm:
true
)
visit
edit_project_path
(
project
)
visit
edit_project_path
(
project
)
page
.
within
(
'.js-project-transfer-form'
)
do
page
.
within
(
'.js-project-transfer-form'
)
do
...
@@ -21,6 +21,8 @@ describe 'Projects > Settings > User transfers a project', :js do
...
@@ -21,6 +21,8 @@ describe 'Projects > Settings > User transfers a project', :js do
click_button
(
'Transfer project'
)
click_button
(
'Transfer project'
)
return
unless
confirm
fill_in
'confirm_name_input'
,
with:
project
.
name
fill_in
'confirm_name_input'
,
with:
project
.
name
click_button
'Confirm'
click_button
'Confirm'
...
@@ -28,6 +30,11 @@ describe 'Projects > Settings > User transfers a project', :js do
...
@@ -28,6 +30,11 @@ describe 'Projects > Settings > User transfers a project', :js do
wait_for_requests
wait_for_requests
end
end
it
'focuses on the confirmation field'
do
transfer_project
(
project
,
group
,
confirm:
false
)
expect
(
page
).
to
have_selector
'#confirm_name_input:focus'
end
it
'allows transferring a project to a group'
do
it
'allows transferring a project to a group'
do
old_path
=
project_path
(
project
)
old_path
=
project_path
(
project
)
transfer_project
(
project
,
group
)
transfer_project
(
project
,
group
)
...
...
This diff is collapsed.
Click to expand it.
spec/features/projects_spec.rb
View file @
b40c468b
...
@@ -155,6 +155,12 @@ describe 'Project' do
...
@@ -155,6 +155,12 @@ describe 'Project' do
visit
edit_project_path
(
project
)
visit
edit_project_path
(
project
)
end
end
it
'focuses on the confirmation field'
do
click_button
'Remove project'
expect
(
page
).
to
have_selector
'#confirm_name_input:focus'
end
it
'removes a project'
do
it
'removes a project'
do
expect
{
remove_with_confirm
(
'Remove project'
,
project
.
path
)
}.
to
change
{
Project
.
count
}.
by
(
-
1
)
expect
{
remove_with_confirm
(
'Remove project'
,
project
.
path
)
}.
to
change
{
Project
.
count
}.
by
(
-
1
)
expect
(
page
).
to
have_content
"Project '
#{
project
.
full_name
}
' is in the process of being deleted."
expect
(
page
).
to
have_content
"Project '
#{
project
.
full_name
}
' is in the process of being deleted."
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment