discourse/test/javascripts/lib/text-direction-test.js.es6

23 lines
550 B
Plaintext
Raw Normal View History

2018-06-15 23:03:24 +08:00
import { isRTL, isLTR } from "discourse/lib/text-direction";
2018-01-30 11:16:35 +08:00
2018-06-15 23:03:24 +08:00
QUnit.module("lib:text-direction");
2018-01-30 11:16:35 +08:00
QUnit.test("isRTL", assert => {
// Hebrew
2018-06-15 23:03:24 +08:00
assert.equal(isRTL("זה מבחן"), true);
2018-01-30 11:16:35 +08:00
// Arabic
2018-06-15 23:03:24 +08:00
assert.equal(isRTL("هذا اختبار"), true);
2018-01-30 11:16:35 +08:00
// Persian
2018-06-15 23:03:24 +08:00
assert.equal(isRTL("این یک امتحان است"), true);
2018-01-30 11:16:35 +08:00
2018-06-15 23:03:24 +08:00
assert.equal(isRTL("This is a test"), false);
assert.equal(isRTL(""), false);
2018-01-30 11:16:35 +08:00
});
QUnit.test("isLTR", assert => {
2018-06-15 23:03:24 +08:00
assert.equal(isLTR("This is a test"), true);
assert.equal(isLTR("זה מבחן"), false);
2018-01-30 11:16:35 +08:00
});