diff --git a/frontend_tests/node_tests/upload.js b/frontend_tests/node_tests/upload.js index 0933a828be..81e198ea7a 100644 --- a/frontend_tests/node_tests/upload.js +++ b/frontend_tests/node_tests/upload.js @@ -145,7 +145,7 @@ run_test('show_error_message', () => { }); run_test('upload_files', () => { - let cancel_all_counter = 0; + let uppy_cancel_all_called = false; const files = [ { name: "budapest.png", @@ -155,7 +155,7 @@ run_test('upload_files', () => { let uppy_add_file_called = false; const uppy = { cancelAll: () => { - cancel_all_counter += 1; + uppy_cancel_all_called = true; }, addFile: (params) => { uppy_add_file_called = true; @@ -171,10 +171,9 @@ run_test('upload_files', () => { assert(config.mode, "compose"); }; const config = {mode: "compose"}; - + $("#compose-send-button").attr("disabled", false); upload.upload_files(uppy, config, []); - assert.equal(cancel_all_counter, 1); - assert(hide_upload_status_called); + assert.equal($("#compose-send-button").attr("disabled"), false); page_params.max_file_upload_size = 0; let show_error_message_called = false; @@ -217,8 +216,9 @@ run_test('upload_files', () => { func(); }); hide_upload_status_called = false; + uppy_cancel_all_called = false; on_click_close_button_callback(); - assert.equal(cancel_all_counter, 2); + assert(uppy_cancel_all_called); assert(hide_upload_status_called); }); diff --git a/static/js/upload.js b/static/js/upload.js index 3ac9b35655..4ae627fc0f 100644 --- a/static/js/upload.js +++ b/static/js/upload.js @@ -91,8 +91,6 @@ exports.show_error_message = function (config, message) { exports.upload_files = function (uppy, config, files) { if (files.length === 0) { - uppy.cancelAll(); - exports.hide_upload_status(config); return; } if (page_params.max_file_upload_size === 0) {