settings: Rename show_spinner and hide_spinner.

Change show_spinner to show_button_spinner and hide_spinner to
hide_button_spinner.
This commit is contained in:
Maneesh Shukla 2024-11-02 21:21:48 +05:30
parent 017dd39382
commit bc27fd2a27
5 changed files with 17 additions and 11 deletions

View File

@ -92,7 +92,7 @@ export function hide_dialog_spinner(): void {
const $spinner = $(`${dialog_widget_selector} .modal__spinner`);
$(`${dialog_widget_selector} .modal__button`).prop("disabled", false);
loading.hide_spinner($(".dialog_submit_button"), $spinner);
loading.hide_button_spinner($(".dialog_submit_button"), $spinner);
}
export function show_dialog_spinner(): void {
@ -102,7 +102,7 @@ export function show_dialog_spinner(): void {
const $spinner = $(`${dialog_widget_selector} .modal__spinner`);
loading.show_spinner($(".dialog_submit_button"), $spinner);
loading.show_button_spinner($(".dialog_submit_button"), $spinner);
}
// Supports a callback to be called once the modal finishes closing.

View File

@ -81,7 +81,7 @@ export function destroy_indicator($container: JQuery): void {
$container.css({width: 0, height: 0});
}
export function show_spinner($button_element: JQuery, $spinner: JQuery): void {
export function show_button_spinner($button_element: JQuery, $spinner: JQuery): void {
const span_width = $button_element.find(".submit-button-text").width();
const span_height = $button_element.find(".submit-button-text").height();
@ -96,7 +96,7 @@ export function show_spinner($button_element: JQuery, $spinner: JQuery): void {
});
}
export function hide_spinner($button_element: JQuery, $spinner: JQuery): void {
export function hide_button_spinner($button_element: JQuery, $spinner: JQuery): void {
// Show the span
$button_element.find(".submit-button-text").show();

View File

@ -345,7 +345,7 @@ export function hide_message_edit_spinner($row: JQuery): void {
}
export function show_message_edit_spinner($row: JQuery): void {
loading.show_spinner($row, $row.find(".modal__spinner"));
loading.show_button_spinner($row, $row.find(".modal__spinner"));
$row.find(".message_edit_save span").hide();
$row.find(".message_edit_save").addClass("message-edit-button-disabled");
$row.find(".message_edit_cancel").addClass("message-edit-button-disabled");

View File

@ -89,13 +89,13 @@ const EMBEDDED_BOT_TYPE = "4";
export function show_button_spinner($button: JQuery): void {
const $spinner = $button.find(".modal__spinner");
$button.prop("disabled", true);
loading.show_spinner($button, $spinner);
loading.show_button_spinner($button, $spinner);
}
export function hide_button_spinner($button: JQuery): void {
const $spinner = $button.find(".modal__spinner");
$button.prop("disabled", false);
loading.hide_spinner($button, $spinner);
loading.hide_button_spinner($button, $spinner);
}
function compare_by_name(

View File

@ -401,8 +401,11 @@ test_ui("enter_with_preview_open", ({override, override_rewire}) => {
override_rewire(compose_banner, "clear_message_sent_banners", noop);
override(document, "to_$", () => $("document-stub"));
let show_button_spinner_called = false;
override(loading, "show_button_spinner", ($spinner) => {
assert.equal($spinner.selector, ".compose-submit-button .loader");
override(loading, "show_button_spinner", ($button_element, $spinner) => {
// Check that the correct button and spinner elements are passed
assert.equal($button_element.selector, ".compose-submit-button");
assert.equal($spinner.selector, ".compose-submit-button .modal__spinner");
show_button_spinner_called = true;
});
@ -449,8 +452,11 @@ test_ui("finish", ({override, override_rewire}) => {
override_rewire(compose_banner, "clear_message_sent_banners", noop);
override(document, "to_$", () => $("document-stub"));
let show_button_spinner_called = false;
override(loading, "show_button_spinner", ($spinner) => {
assert.equal($spinner.selector, ".compose-submit-button .loader");
override(loading, "show_button_spinner", ($button_element, $spinner) => {
// Check that the correct button and spinner elements are passed
assert.equal($button_element.selector, ".compose-submit-button");
assert.equal($spinner.selector, ".compose-submit-button .modal__spinner");
show_button_spinner_called = true;
});