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
5ee5203d
Commit
5ee5203d
authored
Dec 13, 2018
by
Sam Bigelow
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove beforeunload listener for cancel button
parent
07e079e8
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
0 deletions
+17
-0
app/assets/javascripts/blob_edit/blob_bundle.js
app/assets/javascripts/blob_edit/blob_bundle.js
+5
-0
changelogs/unreleased/55344-only-prompt-user-once-when-navigating-away-from-file-editor.yml
...rompt-user-once-when-navigating-away-from-file-editor.yml
+5
-0
spec/javascripts/blob_edit/blob_bundle_spec.js
spec/javascripts/blob_edit/blob_bundle_spec.js
+7
-0
No files found.
app/assets/javascripts/blob_edit/blob_bundle.js
View file @
5ee5203d
...
...
@@ -17,6 +17,11 @@ export default () => {
const
currentAction
=
$
(
'
.js-file-title
'
).
data
(
'
currentAction
'
);
const
projectId
=
editBlobForm
.
data
(
'
project-id
'
);
const
commitButton
=
$
(
'
.js-commit-button
'
);
const
cancelLink
=
$
(
'
.btn.btn-cancel
'
);
cancelLink
.
on
(
'
click
'
,
()
=>
{
window
.
onbeforeunload
=
null
;
});
commitButton
.
on
(
'
click
'
,
()
=>
{
window
.
onbeforeunload
=
null
;
...
...
changelogs/unreleased/55344-only-prompt-user-once-when-navigating-away-from-file-editor.yml
0 → 100644
View file @
5ee5203d
---
title
:
Only prompt user once when navigating away from file editor
merge_request
:
23820
author
:
Sam Bigelow
type
:
fixed
spec/javascripts/blob_edit/blob_bundle_spec.js
View file @
5ee5203d
...
...
@@ -14,6 +14,7 @@ describe('EditBlob', () => {
setFixtures
(
`
<div class="js-edit-blob-form">
<button class="js-commit-button"></button>
<a class="btn btn-cancel" href="#"></a>
</div>`
);
blobBundle
();
});
...
...
@@ -27,4 +28,10 @@ describe('EditBlob', () => {
expect
(
window
.
onbeforeunload
).
toBeNull
();
});
it
(
'
removes beforeunload listener when cancel link is clicked
'
,
()
=>
{
$
(
'
.btn.btn-cancel
'
).
click
();
expect
(
window
.
onbeforeunload
).
toBeNull
();
});
});
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