Files
mindfulness/client/src/features/textWrap/golden/fixtures.ts
2026-02-10 11:39:33 +08:00

57 lines
1.4 KiB
TypeScript
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
export type GoldenCase = {
id: string;
text: string;
lang: 'TC' | 'EN';
context: 'APP' | 'WIDGET';
availableWidth: number;
maxLines: number;
expected: { lines: string[]; wrappedText: string };
};
/**
* Golden fixtures首版最小可运行集
*
* 说明:
* - APP测量 mock=string.length因此 availableWidth 也是“字符数单位”
* - WIDGETwidthMode=APPROX因此 availableWidth 是“token 数单位”
*/
export const GOLDEN_CASES: GoldenCase[] = [
{
id: 'en_app_simple_2lines',
text: 'I am so tired',
lang: 'EN',
context: 'APP',
availableWidth: 7,
maxLines: 2,
expected: { lines: ['I am so', 'tired'], wrappedText: 'I am so\ntired' },
},
{
id: 'en_app_punct_keyword',
text: 'but, still ok',
lang: 'EN',
context: 'APP',
availableWidth: 9,
maxLines: 2,
expected: { lines: ['but,', 'still ok'], wrappedText: 'but,\nstill ok' },
},
{
id: 'tc_app_punct_2lines',
text: '我好累,😮‍💨',
lang: 'TC',
context: 'APP',
availableWidth: 6,
maxLines: 2,
expected: { lines: ['我好累,', '😮‍💨'], wrappedText: '我好累,\n😮💨' },
},
{
id: 'tc_widget_approx_2lines',
text: '我好累',
lang: 'TC',
context: 'WIDGET',
availableWidth: 2,
maxLines: 2,
expected: { lines: ['我', '好累'], wrappedText: '我\n好累' },
},
];