Skip to content

Commit

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

This commit optimization in compose_validate.js manages cases where text.length exceeds max_length, displaying exceeded messages and negative exceeded characters, and tooltip message is updated to 'Maximum message length: 10000 characters.’This simplification enhances clarity by displaying only the remaining characters.
  • Loading branch information
amaranand360 committed Feb 14, 2024
1 parent 7d4487b commit 08bb845
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions web/tests/compose_validate.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -588,7 +588,7 @@ test_ui("test_check_overflow_text", ({mock_template}) => {
$textarea.val("a".repeat(10000 + 1));
compose_validate.check_overflow_text();
assert.ok($indicator.hasClass("over_limit"));
assert.equal(limit_indicator_html, "-100\n");
assert.equal(limit_indicator_html, "-1\n\n");
assert.ok($textarea.hasClass("over_limit"));
assert.ok(banner_rendered);
assert.ok($(".message-send-controls").hasClass("disabled-message-send-controls"));
Expand All @@ -598,7 +598,7 @@ test_ui("test_check_overflow_text", ({mock_template}) => {
$textarea.val("a".repeat(9000 + 1));
compose_validate.check_overflow_text();
assert.ok(!$indicator.hasClass("over_limit"));
assert.equal(limit_indicator_html, "9001\n");
assert.equal(limit_indicator_html, "999\n\n");
assert.ok(!$textarea.hasClass("over_limit"));
assert.ok(!$(".message-send-controls").hasClass("disabled-message-send-controls"));
assert.ok(!banner_rendered);
Expand Down

0 comments on commit 08bb845

Please sign in to comment.