From e2b0a4cba1523edc47d51720fe46f49f5b879359 Mon Sep 17 00:00:00 2001 From: Rohitt Vashishtha Date: Wed, 13 May 2020 00:14:05 +0530 Subject: [PATCH] list-widget: Rename settings_list_widget => dropdown_list_widget. We want to use this widget outside of the settings panels as well. --- .eslintrc.json | 2 +- frontend_tests/node_tests/settings_org.js | 10 +++++----- static/js/bundles/app.js | 2 +- ...settings_list_widget.js => dropdown_list_widget.js} | 2 +- static/js/settings_org.js | 6 +++--- tools/test-js-with-node | 2 +- 6 files changed, 12 insertions(+), 12 deletions(-) rename static/js/{settings_list_widget.js => dropdown_list_widget.js} (98%) diff --git a/.eslintrc.json b/.eslintrc.json index 8e6f15bdcc..7ce1a519f5 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -255,6 +255,7 @@ "csrf_token": false, "current_msg_list": true, "drafts": false, + "dropdown_list_widget": false, "echo": false, "emoji": false, "emoji_picker": false, @@ -348,7 +349,6 @@ "settings_display": false, "settings_emoji": false, "settings_exports": false, - "settings_list_widget": false, "settings_linkifiers": false, "settings_invites": false, "settings_muting": false, diff --git a/frontend_tests/node_tests/settings_org.js b/frontend_tests/node_tests/settings_org.js index a1c4842eba..3d44e53b4e 100644 --- a/frontend_tests/node_tests/settings_org.js +++ b/frontend_tests/node_tests/settings_org.js @@ -80,7 +80,7 @@ zrequire('stream_data'); zrequire('settings_account'); zrequire('settings_org'); zrequire('settings_ui'); -zrequire('settings_list_widget'); +zrequire('dropdown_list_widget'); run_test('unloaded', () => { // This test mostly gets us line coverage, and makes @@ -795,8 +795,8 @@ run_test('set_up', () => { upload_realm_icon = f; }; - const settings_list_widget_backup = settings_list_widget; - settings_list_widget = () => { // eslint-disable-line no-native-reassign + const dropdown_list_widget_backup = dropdown_list_widget; + dropdown_list_widget = () => { // eslint-disable-line no-native-reassign return { render: noop, update: noop, @@ -840,7 +840,7 @@ run_test('set_up', () => { test_parse_time_limit(); test_discard_changes_button(discard_changes); - settings_list_widget = settings_list_widget_backup; // eslint-disable-line no-native-reassign + dropdown_list_widget = dropdown_list_widget_backup; // eslint-disable-line no-native-reassign }); run_test('test get_organization_settings_options', () => { @@ -1022,7 +1022,7 @@ run_test('misc', () => { return arr; }; - // Set stubs for settings_list_widget: + // Set stubs for dropdown_list_widget: const widget_settings = ['realm_notifications_stream_id', 'realm_signup_notifications_stream_id', 'realm_default_code_block_language']; diff --git a/static/js/bundles/app.js b/static/js/bundles/app.js index d8b6d82ab6..5d8014444e 100644 --- a/static/js/bundles/app.js +++ b/static/js/bundles/app.js @@ -163,7 +163,7 @@ import "../realm_icon.js"; import "../realm_logo.js"; import "../reminder.js"; import "../confirm_dialog.js"; -import "../settings_list_widget.js"; +import "../dropdown_list_widget.js"; import "../settings_account.js"; import "../settings_display.js"; import "../settings_notifications.js"; diff --git a/static/js/settings_list_widget.js b/static/js/dropdown_list_widget.js similarity index 98% rename from static/js/settings_list_widget.js rename to static/js/dropdown_list_widget.js index d593e2864a..e096db120c 100644 --- a/static/js/settings_list_widget.js +++ b/static/js/dropdown_list_widget.js @@ -120,4 +120,4 @@ const DropdownListWidget = function (opts) { }; }; -window.settings_list_widget = DropdownListWidget; +window.dropdown_list_widget = DropdownListWidget; diff --git a/static/js/settings_org.js b/static/js/settings_org.js index 1131432057..b78ea1baac 100644 --- a/static/js/settings_org.js +++ b/static/js/settings_org.js @@ -556,13 +556,13 @@ exports.init_dropdown_widgets = () => { render_text: (x) => {return `#${x}`;}, null_value: -1, }; - exports.notifications_stream_widget = settings_list_widget( + exports.notifications_stream_widget = dropdown_list_widget( Object.assign({setting_name: 'realm_notifications_stream_id'}, notification_stream_options)); - exports.signup_notifications_stream_widget = settings_list_widget( + exports.signup_notifications_stream_widget = dropdown_list_widget( Object.assign({setting_name: 'realm_signup_notifications_stream_id'}, notification_stream_options)); - exports.default_code_language_widget = settings_list_widget({ + exports.default_code_language_widget = dropdown_list_widget({ setting_name: 'realm_default_code_block_language', data: Object.keys(pygments_data.langs).map(x => { return { diff --git a/tools/test-js-with-node b/tools/test-js-with-node index 1ae8cb9b4c..fe304469d6 100755 --- a/tools/test-js-with-node +++ b/tools/test-js-with-node @@ -107,7 +107,7 @@ EXEMPT_FILES = { 'static/js/search_pill_widget.js', 'static/js/sent_messages.js', 'static/js/server_events.js', - 'static/js/settings_list_widget.js', + 'static/js/dropdown_list_widget.js', 'static/js/settings_account.js', 'static/js/settings_bots.js', 'static/js/settings_config.js',