47 lines
1.8 KiB
JavaScript
47 lines
1.8 KiB
JavaScript
import assert from "node:assert/strict";
|
|
import fs from "node:fs";
|
|
import path from "node:path";
|
|
|
|
const root = process.cwd();
|
|
|
|
const sourceFiles = [
|
|
"src/views/InventoryLedgerView.vue",
|
|
"src/views/PurchaseReceiptView.vue",
|
|
"src/components/StocktakeDialog.vue",
|
|
"src/views/MasterDataImportView.vue",
|
|
"src/views/SupplierManagementView.vue",
|
|
"src/views/SupplierMaterialLiteView.vue",
|
|
"src/views/SalesPlanningView.vue"
|
|
];
|
|
|
|
for (const relativeFile of sourceFiles) {
|
|
const source = fs.readFileSync(path.join(root, relativeFile), "utf8");
|
|
const fileInputs = source.match(/<input\b[\s\S]*?>/g)?.filter((input) => /type=["']file["']/.test(input)) || [];
|
|
for (const input of fileInputs) {
|
|
assert.match(
|
|
input,
|
|
/class=["'][^"']*(hidden-file-input|modern-upload-input)[^"']*["']/,
|
|
`${relativeFile} 的文件上传不能暴露浏览器原生“选择文件”控件:${input}`
|
|
);
|
|
}
|
|
}
|
|
|
|
const inventorySource = fs.readFileSync(path.join(root, "src/views/InventoryLedgerView.vue"), "utf8");
|
|
assert.match(
|
|
inventorySource,
|
|
/class="workflow-mode-switch delivery-mode-switch"/,
|
|
"成品库销售出库方式必须使用统一分段切换控件"
|
|
);
|
|
assert.doesNotMatch(
|
|
inventorySource,
|
|
/purchase-choice-card|purchase-choice-grid|choice-check|choice-main/,
|
|
"仓库抽屉不能复用采购订单 scoped 样式类,否则会退化成老式裸按钮"
|
|
);
|
|
|
|
const cssSource = fs.readFileSync(path.join(root, "src/styles/main.css"), "utf8");
|
|
assert.match(cssSource, /\.modern-upload-pill/, "需要保留现代上传胶囊样式");
|
|
assert.match(cssSource, /\.workflow-mode-switch/, "需要保留统一分段切换样式");
|
|
assert.match(cssSource, /\.import-dropzone input\[type="file"\]/, "导入 dropzone 需要兜底隐藏原生 file input");
|
|
|
|
console.log("legacy native UI cleanup checks passed");
|