实现项目归档功能
This commit is contained in:
40
ruoyi-ui/tests/unit/project-detail-archive-tab-lock.test.js
Normal file
40
ruoyi-ui/tests/unit/project-detail-archive-tab-lock.test.js
Normal file
@@ -0,0 +1,40 @@
|
||||
const assert = require("assert");
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
|
||||
const componentPath = path.resolve(
|
||||
__dirname,
|
||||
"../../src/views/ccdiProject/detail.vue"
|
||||
);
|
||||
const source = fs.readFileSync(componentPath, "utf8");
|
||||
|
||||
assert(
|
||||
source.includes('index="upload"') &&
|
||||
source.includes(`:disabled="isArchiveLockedTab('upload')"`) &&
|
||||
source.includes('index="config"') &&
|
||||
source.includes(`:disabled="isArchiveLockedTab('config')"`),
|
||||
"上传数据和参数配置页签应支持归档态禁用"
|
||||
);
|
||||
|
||||
assert(
|
||||
/isProjectArchived\(\)\s*\{\s*return String\(this\.projectInfo\.projectStatus\) === "2";\s*\}/.test(
|
||||
source
|
||||
),
|
||||
"详情页应声明归档态判断"
|
||||
);
|
||||
|
||||
assert(
|
||||
/initActiveTabFromRoute\(\)\s*\{[\s\S]*?this\.resolveAccessibleTab\(targetTab\)/.test(
|
||||
source
|
||||
),
|
||||
"详情页应在路由初始化时校正归档态不可访问页签"
|
||||
);
|
||||
|
||||
assert(
|
||||
/handleMenuSelect\(index\)\s*\{[\s\S]*?if\s*\(this\.isArchiveLockedTab\(index\)\)\s*\{\s*return;\s*\}/.test(
|
||||
source
|
||||
),
|
||||
"点击禁用页签时不应切换"
|
||||
);
|
||||
|
||||
console.log("project-detail-archive-tab-lock test passed");
|
||||
Reference in New Issue
Block a user