const assert = require("assert"); const fs = require("fs"); const path = require("path"); const componentPath = path.resolve( __dirname, "../../src/views/ccdiProject/components/detail/UploadData.vue" ); const source = fs.readFileSync(componentPath, "utf8"); const tableBlockMatch = source.match( //m ); assert(tableBlockMatch, "未找到上传数据文件列表表格"); assert( !/\sborder(\s|>)/.test(tableBlockMatch[0]), "上传数据文件列表表格不应再启用边框" ); assert( !/\sstripe(\s|>)/.test(tableBlockMatch[0]), "上传数据文件列表表格不应再启用斑马纹" ); const tableHeaderStyleMatch = source.match( /::v-deep \.el-table th\s*\{([^}]*)\}/ ); assert(tableHeaderStyleMatch, "未找到文件上传列表表头样式"); assert( /font-weight:\s*600;/.test(tableHeaderStyleMatch[1]) && !/background:/.test(tableHeaderStyleMatch[1]) && !/color:/.test(tableHeaderStyleMatch[1]), "文件上传列表表头应移除自定义颜色,仅保留基础字重" ); assert(source.includes("sourceProjectName"), "文件列表应展示来源项目名称字段"); assert(source.includes("历史导入"), "文件列表应展示历史导入来源文案"); console.log("upload-data-file-list-table test passed");