upload: Rename the switch case of close button to hide button.

With the previous commit, we now have two buttons. One button cancels
the upload, while the other simply hides the upload banner. This
commit renames the switch case inside upload.js so that instead of
'upload_banner_close_button', it is now called
'upload_banner_hide_button', which appears to be more aligned with
the actual functionality of the icon.
This commit is contained in:
palashb01 2023-06-23 04:38:44 +05:30 committed by Tim Abbott
parent 624fea2e8e
commit 4ce720f0da
2 changed files with 5 additions and 5 deletions

View File

@ -46,7 +46,7 @@ export function get_item(key, config, file_id) {
file_id,
)} .upload_banner_cancel_button`,
);
case "upload_banner_close_button":
case "upload_banner_hide_button":
return $(
`#compose_banners .upload_banner.file_${CSS.escape(
file_id,
@ -94,7 +94,7 @@ export function get_item(key, config, file_id) {
file_id,
)} .upload_banner_cancel_button`,
);
case "upload_banner_close_button":
case "upload_banner_hide_button":
return $(
`#edit_form_${CSS.escape(config.row)} .upload_banner.file_${CSS.escape(
file_id,
@ -232,7 +232,7 @@ export async function upload_files(uppy, config, files) {
uppy.removeFile(file.id);
hide_upload_banner(uppy, config, file.id);
});
get_item("upload_banner_close_button", config, file.id).one("click", () => {
get_item("upload_banner_hide_button", config, file.id).one("click", () => {
hide_upload_banner(uppy, config, file.id);
});
}

View File

@ -54,7 +54,7 @@ test("get_item", () => {
$("#compose_banners .upload_banner.file_id_2 .upload_banner_cancel_button"),
);
assert.equal(
upload.get_item("upload_banner_close_button", {mode: "compose"}, "id_2"),
upload.get_item("upload_banner_hide_button", {mode: "compose"}, "id_2"),
$("#compose_banners .upload_banner.file_id_2 .main-view-banner-close-button"),
);
assert.equal(
@ -102,7 +102,7 @@ test("get_item", () => {
$(".main-view-banner-close-button"),
);
assert.equal(
upload.get_item("upload_banner_close_button", {mode: "edit", row: 2}, "id_34"),
upload.get_item("upload_banner_hide_button", {mode: "edit", row: 2}, "id_34"),
$(`#edit_form_${CSS.escape(2)} .upload_banner.file_id_34 .main-view-banner-close-button`),
);