From 4d8e18e58f7fb0471b7fa444d66e7f0b8355271d Mon Sep 17 00:00:00 2001 From: Tim Abbott Date: Sun, 4 Mar 2018 18:13:29 -0800 Subject: [PATCH] settings: Move display_checkmark to settings_ui.js. --- static/js/settings_display.js | 11 ++--------- static/js/settings_ui.js | 7 +++++++ tools/test-js-with-node | 3 ++- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/static/js/settings_display.js b/static/js/settings_display.js index 5a362a24bd..c3823e52f7 100644 --- a/static/js/settings_display.js +++ b/static/js/settings_display.js @@ -7,13 +7,6 @@ var exports = {}; // string within it. var strings = {}; -exports.display_checkmark = function ($elem) { - var check_mark = document.createElement("img"); - check_mark.src = "/static/images/checkbox-green.svg"; - $elem.prepend(check_mark); - $(check_mark).css("width","13px"); -}; - function change_display_setting(data, status_element, success_msg) { var spinner = $(status_element).expectOne(); loading.make_indicator(spinner, {text: strings.saving}); @@ -26,7 +19,7 @@ function change_display_setting(data, status_element, success_msg) { data: data, success: function () { ui_report.success(success_msg, $(status_element).expectOne()); - exports.display_checkmark(spinner); + settings_ui.display_checkmark(spinner); }, error: function (xhr) { ui_report.error(strings.failure, xhr, $(status_element).expectOne()); @@ -151,7 +144,7 @@ exports.report_emojiset_change = function () { ui_report.success(i18n.t("Emojiset changed successfully!"), $('#emoji-settings-status').expectOne()); var spinner = $("#emoji-settings-status").expectOne(); - exports.display_checkmark(spinner); + settings_ui.display_checkmark(spinner); } } diff --git a/static/js/settings_ui.js b/static/js/settings_ui.js index 6ff5494f9c..1c24c285ff 100644 --- a/static/js/settings_ui.js +++ b/static/js/settings_ui.js @@ -2,6 +2,13 @@ var settings_ui = (function () { var exports = {}; +exports.display_checkmark = function ($elem) { + var check_mark = document.createElement("img"); + check_mark.src = "/static/images/checkbox-green.svg"; + $elem.prepend(check_mark); + $(check_mark).css("width", "13px"); +}; + // This function is used to disable sub-setting when main setting is checked or unchecked // or two settings are inter-dependent on their values values. // * is_checked is boolean, shows if the main setting is checked or not. diff --git a/tools/test-js-with-node b/tools/test-js-with-node index fe72d5aba3..cc5115f9de 100755 --- a/tools/test-js-with-node +++ b/tools/test-js-with-node @@ -49,7 +49,8 @@ enforce_fully_covered = { 'static/js/recent_senders.js', 'static/js/rtl.js', 'static/js/search_suggestion.js', - 'static/js/settings_ui.js', + # Removed because we're migrating code from uncovered other settings pages to here. + # 'static/js/settings_ui.js', 'static/js/settings_user_groups.js', 'static/js/stream_data.js', 'static/js/stream_events.js',