57 lines
1.4 KiB
TypeScript
57 lines
1.4 KiB
TypeScript
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 也是“字符数单位”
|
||
* - WIDGET:widthMode=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好累' },
|
||
},
|
||
];
|
||
|