修复批量上传流水弹窗重复文件列表
This commit is contained in:
@@ -245,6 +245,7 @@
|
|||||||
multiple
|
multiple
|
||||||
:auto-upload="false"
|
:auto-upload="false"
|
||||||
:on-change="handleBatchFileChange"
|
:on-change="handleBatchFileChange"
|
||||||
|
:show-file-list="false"
|
||||||
:file-list="selectedFiles"
|
:file-list="selectedFiles"
|
||||||
>
|
>
|
||||||
<i class="el-icon-upload"></i>
|
<i class="el-icon-upload"></i>
|
||||||
|
|||||||
31
ruoyi-ui/tests/unit/upload-data-batch-upload.test.js
Normal file
31
ruoyi-ui/tests/unit/upload-data-batch-upload.test.js
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
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 dialogIndex = source.indexOf(':visible.sync="batchUploadDialogVisible"');
|
||||||
|
assert.notStrictEqual(dialogIndex, -1, "未找到批量上传流水文件弹窗");
|
||||||
|
|
||||||
|
const dialogEndIndex = source.indexOf("</el-dialog>", dialogIndex);
|
||||||
|
assert.notStrictEqual(dialogEndIndex, -1, "未找到批量上传流水文件弹窗结束标签");
|
||||||
|
|
||||||
|
const dialogSource = source.slice(dialogIndex, dialogEndIndex);
|
||||||
|
const uploadMatch = dialogSource.match(/<el-upload([\s\S]*?)>/);
|
||||||
|
assert(uploadMatch, "未找到批量上传区域的 el-upload 组件");
|
||||||
|
|
||||||
|
assert(
|
||||||
|
/(:show-file-list|show-file-list)\s*=\s*"false"/.test(uploadMatch[1]),
|
||||||
|
"批量上传区域必须关闭 el-upload 默认文件列表,避免与自定义文件列表重复显示"
|
||||||
|
);
|
||||||
|
|
||||||
|
assert(
|
||||||
|
/class="selected-files"/.test(dialogSource),
|
||||||
|
"批量上传弹窗应保留自定义已选文件列表"
|
||||||
|
);
|
||||||
|
|
||||||
|
console.log("upload-data-batch-upload test passed");
|
||||||
Reference in New Issue
Block a user