Commit ee6d90b3 authored by GitLab Bot's avatar GitLab Bot

Automatic merge of gitlab-org/gitlab-ce master

parents bda2f7e0 72feadce
......@@ -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;
......
---
title: Only prompt user once when navigating away from file editor
merge_request: 23820
author: Sam Bigelow
type: fixed
......@@ -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();
});
});
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