mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-20 19:16:08 +00:00
fix(mobile): Arabic reads in its direction: arrows turn round, Latin names keep their ends, figures stay whole
In the touch shell the back, forward, disclosure, date-range and flow arrows kept pointing right in Arabic, so Settle up showed the debt the wrong way round and Vacay's year arrows pointed inward. The shell now mirrors lucide's direction arrows in right-to-left languages; an icon that names its own treatment keeps it, and the lightbox arrows stay on their physical sides. Latin user text in Arabic rows lost its beginning when cut and moved its punctuation to the wrong end. Names, titles, addresses and file names take their direction from their own text (dir=auto) and still line up with the row; markdown paragraphs, chat messages, poll options and journal stories are isolated; signed balances, amounts, sizes, rates and leg figures read as one left-to-right run; URL fields read left to right. Name pairs joined by an arrow isolate each name and point from the first to the second. The hero progress and poll result bars fill from the start edge. Arabic and Hebrew uppercase caption labels grow a step and take the muted ink, and a todo's due date in a notification is written in the reader's language instead of as YYYY-MM-DD.
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
/**
|
||||
* FE-UTIL-FLOW-001 to FE-UTIL-FLOW-003
|
||||
*
|
||||
* "A → B" as one string that reads in the direction of the UI.
|
||||
*/
|
||||
import { afterEach, describe, expect, it } from 'vitest';
|
||||
|
||||
import { flowText, isRtlDocument } from './flowText';
|
||||
|
||||
const FSI = '';
|
||||
const PDI = '';
|
||||
|
||||
describe('flowText', () => {
|
||||
afterEach(() => {
|
||||
document.documentElement.dir = '';
|
||||
});
|
||||
|
||||
it('FE-UTIL-FLOW-001: a left-to-right UI gets the plain arrow between the names', () => {
|
||||
expect(flowText(['Sam Carter', 'Ada'], false)).toBe('Sam Carter → Ada');
|
||||
expect(flowText(['Kyoto', 'Osaka', 'Nara'], false)).toBe('Kyoto → Osaka → Nara');
|
||||
});
|
||||
|
||||
it('FE-UTIL-FLOW-002: in Arabic each name is isolated and the arrow points left, from the first to the second', () => {
|
||||
expect(flowText(['Sam Carter', 'أنت'], true)).toBe(`${FSI}Sam Carter${PDI} ← ${FSI}أنت${PDI}`);
|
||||
});
|
||||
|
||||
it('FE-UTIL-FLOW-003: without an explicit direction it follows the document', () => {
|
||||
expect(isRtlDocument()).toBe(false);
|
||||
expect(flowText(['A', 'B'])).toBe('A → B');
|
||||
document.documentElement.dir = 'rtl';
|
||||
expect(isRtlDocument()).toBe(true);
|
||||
expect(flowText(['A', 'B'])).toBe(`${FSI}A${PDI} ← ${FSI}B${PDI}`);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user