js: Rename night_mode.ts to dark_theme.ts.

This commit is contained in:
Sahil Batra 2021-11-26 13:06:54 +05:30 committed by Tim Abbott
parent 88e21d0387
commit 0a949274e9
5 changed files with 12 additions and 12 deletions

View File

@ -30,6 +30,7 @@ const attachments_ui = mock_esm("../../static/js/attachments_ui");
const bot_data = mock_esm("../../static/js/bot_data");
const compose = mock_esm("../../static/js/compose");
const composebox_typeahead = mock_esm("../../static/js/composebox_typeahead");
const dark_theme = mock_esm("../../static/js/dark_theme");
const emoji_picker = mock_esm("../../static/js/emoji_picker");
const hotspots = mock_esm("../../static/js/hotspots");
const linkifiers = mock_esm("../../static/js/linkifiers");
@ -39,7 +40,6 @@ const message_list = mock_esm("../../static/js/message_list");
const message_lists = mock_esm("../../static/js/message_lists");
const muted_topics_ui = mock_esm("../../static/js/muted_topics_ui");
const muted_users_ui = mock_esm("../../static/js/muted_users_ui");
const night_mode = mock_esm("../../static/js/night_mode");
const notifications = mock_esm("../../static/js/notifications");
const reactions = mock_esm("../../static/js/reactions");
const realm_icon = mock_esm("../../static/js/realm_icon");
@ -732,7 +732,7 @@ run_test("user_settings", ({override}) => {
const stub = make_stub();
event = event_fixtures.user_settings__color_scheme_dark;
user_settings.color_scheme = 1;
override(night_mode, "enable", stub.f); // automatically checks if called
override(dark_theme, "enable", stub.f); // automatically checks if called
dispatch(event);
assert.equal(stub.num_calls, 1);
assert.equal(user_settings.color_scheme, 2);
@ -742,7 +742,7 @@ run_test("user_settings", ({override}) => {
const stub = make_stub();
event = event_fixtures.user_settings__color_scheme_light;
user_settings.color_scheme = 1;
override(night_mode, "disable", stub.f); // automatically checks if called
override(dark_theme, "disable", stub.f); // automatically checks if called
dispatch(event);
assert.equal(stub.num_calls, 1);
assert.equal(user_settings.color_scheme, 3);
@ -766,7 +766,7 @@ run_test("user_settings", ({override}) => {
const stub = make_stub();
event = event_fixtures.user_settings__color_scheme_automatic;
user_settings.color_scheme = 2;
override(night_mode, "default_preference_checker", stub.f); // automatically checks if called
override(dark_theme, "default_preference_checker", stub.f); // automatically checks if called
dispatch(event);
assert.equal(stub.num_calls, 1);
assert.equal(user_settings.color_scheme, 1);

View File

@ -13,6 +13,7 @@ import * as compose_actions from "./compose_actions";
import * as compose_fade from "./compose_fade";
import * as compose_pm_pill from "./compose_pm_pill";
import * as composebox_typeahead from "./composebox_typeahead";
import * as dark_theme from "./dark_theme";
import * as emoji_picker from "./emoji_picker";
import * as giphy from "./giphy";
import * as hotspots from "./hotspots";
@ -26,7 +27,6 @@ import * as muted_topics_ui from "./muted_topics_ui";
import * as muted_users_ui from "./muted_users_ui";
import * as narrow_state from "./narrow_state";
import * as navbar_alerts from "./navbar_alerts";
import * as night_mode from "./night_mode";
import * as notifications from "./notifications";
import * as overlays from "./overlays";
import {page_params} from "./page_params";
@ -624,13 +624,13 @@ export function dispatch_normal_event(event) {
$("body").fadeOut(300);
setTimeout(() => {
if (event.value === settings_config.color_scheme_values.night.code) {
night_mode.enable();
dark_theme.enable();
realm_logo.render();
} else if (event.value === settings_config.color_scheme_values.day.code) {
night_mode.disable();
dark_theme.disable();
realm_logo.render();
} else {
night_mode.default_preference_checker();
dark_theme.default_preference_checker();
realm_logo.render();
}
$("body").fadeIn(300);

View File

@ -4,9 +4,9 @@ import marked from "../third/marked/lib/marked";
import * as channel from "./channel";
import * as common from "./common";
import * as dark_theme from "./dark_theme";
import * as feedback_widget from "./feedback_widget";
import {$t} from "./i18n";
import * as night_mode from "./night_mode";
import * as scroll_bar from "./scroll_bar";
/*
@ -63,7 +63,7 @@ export function enter_day_mode() {
send({
command: "/day",
on_success(data) {
night_mode.disable();
dark_theme.disable();
feedback_widget.show({
populate(container) {
const rendered_msg = marked(data.msg).trim();
@ -85,7 +85,7 @@ export function enter_night_mode() {
send({
command: "/night",
on_success(data) {
night_mode.enable();
dark_theme.enable();
feedback_widget.show({
populate(container) {
const rendered_msg = marked(data.msg).trim();

View File

@ -59,6 +59,7 @@ EXEMPT_FILES = {
"static/js/copy_and_paste.js",
"static/js/csrf.ts",
"static/js/css_variables.js",
"static/js/dark_theme.ts",
"static/js/debug.js",
"static/js/deprecated_feature_notice.js",
"static/js/desktop_integration.js",
@ -101,7 +102,6 @@ EXEMPT_FILES = {
"static/js/muted_users_ui.js",
"static/js/narrow.js",
"static/js/navigate.js",
"static/js/night_mode.ts",
"static/js/notifications.js",
"static/js/overlays.js",
"static/js/padded_widget.ts",