Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

textDirection.test.ts

26 lines1.0 KB

1import { describe, expect, it } from "vite-plus/test";
2​
3import { textDirection } from "./textDirection";
4​
5describe("textDirection", () => {
6 it.each([
7 ["Arabic", "اكتب دالة تجمع الأرقام", "rtl"],
8 ["Hebrew", "תקן את הבאג", "rtl"],
9 ["English", "fix the failing test", "ltr"],
10 [
11 "Arabic that opens with an English term",
12 "StrictMode: يعيد الـ render مرتين في التطوير",
13 "rtl",
14 ],
15 ["English quoting one Arabic word", "translate the label مرحبا for the login screen", "ltr"],
16 ["a tie, by its first word", "React مكتبة", "ltr"],
17 ["a tie that opens in Arabic", "مكتبة React", "rtl"],
18 ["Arabic around numbers and punctuation", "عدّل السطر 42، ثم شغّل الاختبارات (3)", "rtl"],
19 ])("reads %s", (_, text, direction) => {
20 expect(textDirection(text)).toBe(direction);
21 });
22​
23 it("leaves text without letters to its surroundings", () => {
24 expect(textDirection("42 — 7 ✓")).toBeUndefined();
25 });
26});