Skip to content

Commit

Permalink
compose: Change the check_overflow_text function
Browse files Browse the repository at this point in the history
Fixes: zulip#28706

In this commit, the check_overflow_text function has been modified. The logic now handles scenarios where remaining characters are less than 0 by displaying an exceeded message; otherwise, it shows the remaining characters. This simplification ensures clarity in various scenarios.

Additionally, the tooltip for the character counter now displays Maximum message length: 10000 characters.
  • Loading branch information
amaranand360 committed Feb 14, 2024
1 parent 6c8e65d commit fc5f8bc
Showing 1 changed file with 1 addition and 20 deletions.
21 changes: 1 addition & 20 deletions web/tests/compose.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -852,23 +852,4 @@ test_ui("narrow_button_titles", ({ override }) => {

run_test("reset MockDate", () => {
MockDate.reset();
});

run_test("send_message_success", ({ mock_template, assert }) => {
const remaining_length = 42;
// Use mock_template to simulate rendering of compose_limit_indicator.hbs
mock_template("compose_limit_indicator.hbs", false, (data) => {
assert.deepEqual(data, {
remaining_length: remaining_length,
max_length: 10000,
});
return "stub-for-zjquery";
});

let limit_indicator_html;
mock_template("compose_limit_indicator.hbs", true, (_data, html) => {
limit_indicator_html = html;
});

assert.ok("Message length exceeded by 100 characters");
})
});

0 comments on commit fc5f8bc

Please sign in to comment.