"use strict"; const {strict: assert} = require("assert"); const _ = require("lodash"); const {unmock_module, zrequire} = require("./lib/namespace"); const {run_test} = require("./lib/test"); const {page_params} = require("./lib/zpage_params"); // We download our translations in `page_params` (which // are for the user's chosen language), so we simulate // that here for the tests. page_params.request_language = "en"; page_params.translation_data = { "Quote and reply": "Citer et répondre", "Notification triggers": "Déclencheurs de notification", "You subscribed to stream {stream}": "Vous n'êtes pas abonnés au canal {stream}", "
The stream {stream_name} does not exist.
Manage your subscriptions
Le canal {stream_name} n'existe pas.
Gérez vos abonnements
The stream {stream_name} does not exist.
Manage your subscriptions
The stream {stream_name} does not exist.
Manage your subscriptions
Le canal l'abonnement n'existe pas.
Gérez vos abonnements sur votre page canaux.
", ); }); run_test("t_tag", ({mock_template}) => { const args = { message_id: "99", should_display_quote_and_reply: true, editability_menu_item: true, should_display_hide_option: true, conversation_time_url: "http://zulip.zulipdev.com/#narrow/stream/101-devel/topic/testing/near/99", }; mock_template("popovers/actions_popover.hbs", true, (data, html) => { assert.equal(data, args); assert.ok(html.indexOf("Citer et répondre") > 0); }); require("../templates/popovers/actions_popover.hbs")(args); }); 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", delivery_email: "john@zulip.com", }, 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", automatically_follow_topics_policy: "Automatically follow topics", automatically_unmute_topics_in_muted_streams_policy: "Automatically unmute topics in muted streams", }, show_push_notifications_tooltip: false, user_role_text: "Member", }; mock_template("settings_tab.hbs", true, (data, html) => { assert.equal(data, args); assert.ok(html.indexOf("Déclencheurs de notification") > 0); }); require("../templates/settings_tab.hbs")(args); }); run_test("language_list", () => { const language_list = [ { code: "en", locale: "en", name: "English", }, { code: "en-gb", locale: "en_GB", name: "British English", percent_translated: 99, }, { code: "id", locale: "id", name: "Bahasa Indonesia", percent_translated: 32, }, ]; initialize({language_list}); assert.equal(get_language_name("en"), "English"); const successful_formatted_list = [ { name: "English", code: "en", name_with_percent: "English", selected: true, }, { name: "British English", code: "en-gb", name_with_percent: "British English (99%)", selected: false, }, { name: "Bahasa Indonesia", code: "id", name_with_percent: "Bahasa Indonesia (32%)", selected: false, }, ]; const formatted_list = get_language_list_columns("en"); for (const element of _.range(0, formatted_list.length)) { assert.equal(formatted_list[element].name, successful_formatted_list[element].name); assert.equal(formatted_list[element].code, successful_formatted_list[element].code); assert.equal( formatted_list[element].name_with_percent, successful_formatted_list[element].name_with_percent, ); assert.equal(formatted_list[element].selected, successful_formatted_list[element].selected); } });