cmvr-wms/mobile-app/tests/ui-contract.test.mjs
lixiaolong 6ae0682546 feat(workspace): 优化工作空间页面布局并改进到货管理功能
- 新增 ArrivalListTools 和 ArrivalCard 组件用于到货列表管理
- 集成 arrivalListQuery 查询逻辑优化数据加载
- 调整页面标题文字样式增加最小宽度和行高
- 更新底部标签栏字体大小和行高设置
- 重构到货操作界面添加键盘避让视图支持
- 优化到货操作按钮状态管理增加次要按钮样式
- 实现助手组件分页功能支持动态页面大小
- 扩展文件存储区域配置支持项目工作空间
- 增加文件流式上传下载方法支持大文件处理
- 优化采购表格单元格键盘输入体验
- 修复移动端到货操作界面键盘遮挡问题
- 调整测试用例数据量验证分页功能正确性
2026-10-21 15:13:39 +08:00

22 lines
1.9 KiB
JavaScript

import test from 'node:test';
import assert from 'node:assert/strict';
import {readFileSync} from 'node:fs';
import ts from 'typescript';
const source=name=>readFileSync(new URL(`../src/${name}`,import.meta.url),'utf8');
test('mobile JSX has no unexpected literal text below a native View',()=>{
for(const file of ['App.tsx','ui.tsx','files.tsx','dialogs.tsx','screens/Account.tsx','screens/Feedback.tsx','screens/Workspace.tsx','screens/Assistant.tsx','screens/ArrivalOperation.tsx','screens/ArrivalActions.tsx','screens/ArrivalListParts.tsx','screens/ServerConnection.tsx']){
const parsed=ts.createSourceFile(file,source(file),ts.ScriptTarget.Latest,true,ts.ScriptKind.TSX);
function walk(node){if(ts.isJsxElement(node)&&['View','ScrollView','Pressable','KeyboardAvoidingView','SafeAreaView'].includes(node.openingElement.tagName.getText(parsed)))for(const child of node.children)if(ts.isJsxText(child))assert.equal(child.text.trim(),'',`${file} has bare native text`);ts.forEachChild(node,walk);}walk(parsed);
}
assert.match(source('App.tsx'),/\{!!module\.search&&/,'an empty search key must not render a raw string in View');
});
test('mobile feedback is always scoped to my records and never calls administrative handling',()=>{
const file=source('screens/Feedback.tsx');assert.match(file,/all:false/);assert.doesNotMatch(file,/all:true|\/handle/);
assert.match(file,/setUncertain\(unknown\)/);assert.match(file,/lock\.current\|\|uncertain/);
});
test('AI stays mounted across tab switches; no implicit business submit or reload on update',()=>{
const app=source('App.tsx');assert.match(app,/aiVisited&&ai/);assert.match(app,/display:!page&&tab==='assistant'\?'flex':'none'/);
assert.match(source('screens/Assistant.tsx'),/onAction=\{draftAction\}/);assert.match(source('screens/Assistant.tsx'),/onAction\(draft,'execute'\)/);assert.match(source('screens/Assistant.tsx'),/Alert\.alert\('确认执行业务'/);
assert.doesNotMatch(app,/reloadAsync/);
});