settings: Improve enable_or_disable_save_button method code.

This commit reorganizes the code in enable_or_disable_save_button
method, and improves its readability. It also replaces the previous
tooltip logic for the disabled save button in the save/discard widget
with the more standardized methods to handle the same from ui_util.ts.
This commit is contained in:
Sayam Samal
2025-05-14 13:27:28 +05:30
committed by Tim Abbott
parent 30bfabb2eb
commit 0914732387
2 changed files with 34 additions and 33 deletions

View File

@@ -22,6 +22,10 @@ mock_esm("../src/buttons", {
modify_action_button_style: noop,
});
mock_esm("../src/scroll_util", {scroll_element_into_container: noop});
mock_esm("../src/ui_util", {
disable_element_and_add_tooltip: noop,
enable_element_and_remove_tooltip: noop,
});
set_global("document", "document-stub");
set_global("requestAnimationFrame", (func) => func());
@@ -95,6 +99,7 @@ function createSaveButtons(subsection) {
$stub_save_button_header.set_find_results(".time-limit-setting", []);
$stub_save_button_header.set_find_results(".pill-container", []);
$stub_save_button_header.set_find_results(".subsection-changes-save button", $stub_save_button);
$stub_save_button_header.set_find_results(".save-button", $stub_save_button);
return {
props,