45 lines
1.2 KiB
JavaScript
45 lines
1.2 KiB
JavaScript
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");
|
|
|
|
assert(
|
|
/<el-button[\s\S]*?:disabled="card\.disabled"[\s\S]*?@click="handleUploadClick\(card\.key\)"/.test(
|
|
source
|
|
),
|
|
"上传卡片按钮应绑定禁用状态"
|
|
);
|
|
|
|
assert(
|
|
/uploadCards:\s*\[[\s\S]*?key:\s*"transaction"[\s\S]*?btnText:\s*"上传流水"[\s\S]*?disabled:\s*false[\s\S]*?\],/.test(
|
|
source
|
|
),
|
|
"上传卡片区应只保留一张默认可用的流水导入卡片"
|
|
);
|
|
|
|
assert(
|
|
/syncUploadCardDisabledState\(\)\s*\{[\s\S]*?card\.key === "transaction"[\s\S]*?disabled:\s*this\.isProjectTagging/.test(
|
|
source
|
|
),
|
|
"流水导入卡片应在项目打标中时同步置灰"
|
|
);
|
|
|
|
assert(
|
|
!/key:\s*"credit"/.test(source) && !/key:\s*"namelist"/.test(source),
|
|
"上传卡片区不应再保留征信导入或名单库选择卡片配置"
|
|
);
|
|
|
|
assert(
|
|
/handleUploadClick\(key\)\s*\{[\s\S]*?if\s*\(!card\s*\|\|\s*card\.disabled\)\s*return;/.test(
|
|
source
|
|
),
|
|
"禁用卡片点击后不应继续执行上传逻辑"
|
|
);
|
|
|
|
console.log("upload-data-disabled-cards test passed");
|