Fix cancel button not working when uploading a file on the new issue page
This commit is contained in:
parent
0b8b631ad9
commit
0c49b5eb17
|
@ -119,11 +119,9 @@ export default function dropzoneInput(form) {
|
||||||
// removeAllFiles(true) stops uploading files (if any)
|
// removeAllFiles(true) stops uploading files (if any)
|
||||||
// and remove them from dropzone files queue.
|
// and remove them from dropzone files queue.
|
||||||
$cancelButton.on('click', (e) => {
|
$cancelButton.on('click', (e) => {
|
||||||
const target = e.target.closest('.js-main-target-form').querySelector('.div-dropzone');
|
|
||||||
|
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
Dropzone.forElement(target).removeAllFiles(true);
|
Dropzone.forElement($formDropzone.get(0)).removeAllFiles(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
// If 'error' event is fired, we store a failed files,
|
// If 'error' event is fired, we store a failed files,
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
title: Fix cancel button not working while uploading on the new issue page
|
||||||
|
merge_request: 15137
|
||||||
|
author:
|
||||||
|
type: fixed
|
|
@ -583,6 +583,16 @@ describe 'Issues' do
|
||||||
|
|
||||||
expect(page.find_field("issue_description").value).not_to match /\n\n$/
|
expect(page.find_field("issue_description").value).not_to match /\n\n$/
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "cancels a file upload correctly" do
|
||||||
|
dropzone_file([Rails.root.join('spec', 'fixtures', 'dk.png')], 0, false)
|
||||||
|
|
||||||
|
click_button 'Cancel'
|
||||||
|
|
||||||
|
expect(page).to have_button('Attach a file')
|
||||||
|
expect(page).not_to have_button('Cancel')
|
||||||
|
expect(page).not_to have_selector('.uploading-progress-container', visible: true)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'form filled by URL parameters' do
|
context 'form filled by URL parameters' do
|
||||||
|
|
Loading…
Reference in New Issue