tests: Pass missing data to Handlebars templates.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg 2023-03-22 02:12:58 -07:00 committed by Tim Abbott
parent 73d400e4a3
commit a1f530fcc0
2 changed files with 33 additions and 28 deletions

View File

@ -69,19 +69,12 @@ run_test("$tr", () => {
run_test("t_tag", ({mock_template}) => {
const args = {
message: {
is_stream: true,
id: "99",
stream: "devel",
subject: "testing",
sender_full_name: "King Lear",
},
message_id: "99",
should_display_quote_and_reply: true,
can_edit_message: true,
can_mute_topic: true,
narrowed: true,
topic: "testing",
not_spectator: true,
editability_menu_item: true,
should_display_hide_option: true,
conversation_time_uri:
"http://zulip.zulipdev.com/#narrow/stream/101-devel/topic/testing/near/99",
};
mock_template("actions_popover_content.hbs", true, (data, html) => {
@ -94,23 +87,26 @@ run_test("t_tag", ({mock_template}) => {
run_test("tr_tag", ({mock_template}) => {
const args = {
botserverrc: "botserverrc",
date_joined_text: "Mar 21, 2022",
display_settings: {
settings: {},
},
notification_settings: {},
page_params: {
full_name: "John Doe",
password_auth_enabled: false,
avatar_url: "http://example.com",
delivery_email: "john@zulip.com",
},
user_settings: {
twenty_four_hour_time: false,
enable_stream_desktop_notifications: false,
enable_stream_push_notifications: false,
enable_stream_audible_notifications: false,
enable_desktop_notifications: false,
enable_sounds: false,
enable_offline_email_notifications: false,
enable_offline_push_notifications: false,
enable_online_push_notifications: false,
enable_digest_emails: false,
settings_object: {},
settings_label: {
desktop_icon_count_display:
"Unread count badge (appears in desktop sidebar and browser tab)",
realm_name_in_email_notifications_policy:
"Include organization name in subject of message notification emails",
twenty_four_hour_time: "Time format",
},
show_push_notifications_tooltip: false,
user_role_text: "Member",
};
mock_template("settings_tab.hbs", true, (data, html) => {

View File

@ -161,8 +161,17 @@ const rt = zrequire("recent_topics_ui");
const recent_topics_util = zrequire("recent_topics_util");
const rt_data = zrequire("recent_topics_data");
people.is_my_user_id = (id) => id === 1;
people.sender_info_for_recent_topics_row = (ids) => ids;
people.add_active_user({
email: "alice@zulip.com",
user_id: 1,
full_name: "Alice Smith",
});
people.add_active_user({
email: "fred@zulip.com",
user_id: 2,
full_name: "Fred Flintstone",
});
people.initialize_current_user(1);
let id = 0;
@ -287,7 +296,7 @@ function generate_topic_data(topic_info_array) {
last_msg_time: "Just now",
last_msg_url: "https://www.example.com",
full_last_msg_date_time: "date at time",
senders: [1, 2],
senders: people.sender_info_for_recent_topics_row([1, 2]),
stream: "stream" + stream_id,
stream_color: "",
stream_id,