upload: Simplify the query for the "send_button".

This commit is contained in:
Daniil Fadeev 2023-06-15 13:03:46 +03:00 committed by Tim Abbott
parent cbd4aad0a5
commit c959ac5849
2 changed files with 5 additions and 7 deletions

View File

@ -73,9 +73,7 @@ export function get_item(key, config, file_id) {
case "textarea": case "textarea":
return $(`#edit_form_${CSS.escape(config.row)} .message_edit_content`); return $(`#edit_form_${CSS.escape(config.row)} .message_edit_content`);
case "send_button": case "send_button":
return $(`#edit_form_${CSS.escape(config.row)} .message_edit_content`) return $(`#edit_form_${CSS.escape(config.row)}`).find(".message_edit_save");
.closest(".message_edit_form")
.find(".message_edit_save");
case "banner_container": case "banner_container":
return $(`#edit_form_${CSS.escape(config.row)} .edit_form_banners`); return $(`#edit_form_${CSS.escape(config.row)} .edit_form_banners`);
case "upload_banner_identifier": case "upload_banner_identifier":

View File

@ -73,10 +73,10 @@ test("get_item", () => {
$(`#edit_form_${CSS.escape(1)} .message_edit_content`), $(`#edit_form_${CSS.escape(1)} .message_edit_content`),
); );
$(`#edit_form_${CSS.escape(2)} .message_edit_content`).closest = () => { $(`#edit_form_${CSS.escape(2)}`).set_find_results(
$(".message_edit_form").set_find_results(".message_edit_save", $(".message_edit_save")); ".message_edit_save",
return $(".message_edit_form"); $(".message_edit_save"),
}; );
assert.equal(upload.get_item("send_button", {mode: "edit", row: 2}), $(".message_edit_save")); assert.equal(upload.get_item("send_button", {mode: "edit", row: 2}), $(".message_edit_save"));
assert.equal( assert.equal(