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}) => { run_test("t_tag", ({mock_template}) => {
const args = { const args = {
message: { message_id: "99",
is_stream: true,
id: "99",
stream: "devel",
subject: "testing",
sender_full_name: "King Lear",
},
should_display_quote_and_reply: true, should_display_quote_and_reply: true,
can_edit_message: true, editability_menu_item: true,
can_mute_topic: true, should_display_hide_option: true,
narrowed: true, conversation_time_uri:
topic: "testing", "http://zulip.zulipdev.com/#narrow/stream/101-devel/topic/testing/near/99",
not_spectator: true,
}; };
mock_template("actions_popover_content.hbs", true, (data, html) => { 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}) => { run_test("tr_tag", ({mock_template}) => {
const args = { const args = {
botserverrc: "botserverrc",
date_joined_text: "Mar 21, 2022",
display_settings: {
settings: {},
},
notification_settings: {},
page_params: { page_params: {
full_name: "John Doe", full_name: "John Doe",
password_auth_enabled: false, delivery_email: "john@zulip.com",
avatar_url: "http://example.com",
}, },
user_settings: { settings_object: {},
twenty_four_hour_time: false, settings_label: {
enable_stream_desktop_notifications: false, desktop_icon_count_display:
enable_stream_push_notifications: false, "Unread count badge (appears in desktop sidebar and browser tab)",
enable_stream_audible_notifications: false, realm_name_in_email_notifications_policy:
enable_desktop_notifications: false, "Include organization name in subject of message notification emails",
enable_sounds: false, twenty_four_hour_time: "Time format",
enable_offline_email_notifications: false,
enable_offline_push_notifications: false,
enable_online_push_notifications: false,
enable_digest_emails: false,
}, },
show_push_notifications_tooltip: false,
user_role_text: "Member",
}; };
mock_template("settings_tab.hbs", true, (data, html) => { 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 recent_topics_util = zrequire("recent_topics_util");
const rt_data = zrequire("recent_topics_data"); const rt_data = zrequire("recent_topics_data");
people.is_my_user_id = (id) => id === 1; people.add_active_user({
people.sender_info_for_recent_topics_row = (ids) => ids; 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; let id = 0;
@ -287,7 +296,7 @@ function generate_topic_data(topic_info_array) {
last_msg_time: "Just now", last_msg_time: "Just now",
last_msg_url: "https://www.example.com", last_msg_url: "https://www.example.com",
full_last_msg_date_time: "date at time", 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: "stream" + stream_id,
stream_color: "", stream_color: "",
stream_id, stream_id,