- 将 Account 组件中的 Text 导入移动到顶部 - 移除 App.tsx 中的 expo-updates 相关代码 - 添加 PackageUpdates 相关组件和 hooks - 更新应用名称从 "CMVR 物资管理" 为 "车研物资" - 添加应用图标和自适应图标配置 - 更新 Android 权限配置,添加 REQUEST_INSTALL_PACKAGES 权限 - 修改堆栈导航数据结构,支持路由参数传递 - 添加阅读尺寸偏好设置功能 - 重构登录界面为独立组件 LoginView - 添加文件库界面组件 FileLibrary - 更新状态栏样式逻辑 - 调整 Tab 栏样式和尺寸 - 集成包更新和应用更新对话框 - 修复导入语句顺序和类型引用 - 优化业务列表组件的路由参数处理 - 添加作用域参数用于 API 请求区分
22 lines
2.1 KiB
JavaScript
22 lines
2.1 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','AppUpdates.tsx','AppUpdateDialog.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','screens/BusinessList.tsx','screens/BatchOperation.tsx','screens/NoticeContent.tsx','screens/FileLibrary.tsx','controls/Choice.tsx','controls/DateField.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('screens/BusinessList.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/);
|
|
});
|