mirror of https://github.com/zulip/zulip.git
node tests: Directly test how we add/remove rtl class.
This commit is contained in:
parent
ea2e5de54f
commit
886e419731
|
@ -4,6 +4,7 @@ const {strict: assert} = require("assert");
|
|||
|
||||
const {zrequire} = require("../zjsunit/namespace");
|
||||
const {run_test} = require("../zjsunit/test");
|
||||
const $ = require("../zjsunit/zjquery");
|
||||
|
||||
const rtl = zrequire("rtl");
|
||||
|
||||
|
@ -126,3 +127,22 @@ run_test("get_direction", () => {
|
|||
"ltr",
|
||||
);
|
||||
});
|
||||
|
||||
run_test("set_rtl_class_for_textarea rtl", () => {
|
||||
const textarea = $.create("some-textarea");
|
||||
assert(!textarea.hasClass("rtl"));
|
||||
const text = "```quote\nمرحبا";
|
||||
textarea.val(text);
|
||||
rtl.set_rtl_class_for_textarea(textarea);
|
||||
assert(textarea.hasClass("rtl"));
|
||||
});
|
||||
|
||||
run_test("set_rtl_class_for_textarea ltr", () => {
|
||||
const textarea = $.create("some-textarea");
|
||||
textarea.addClass("rtl");
|
||||
assert(textarea.hasClass("rtl"));
|
||||
const text = "```quote\nEnglish text";
|
||||
textarea.val(text);
|
||||
rtl.set_rtl_class_for_textarea(textarea);
|
||||
assert(!textarea.hasClass("rtl"));
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue