fix: prevent cached task loading mask from sticking
parent
3dfb390f22
commit
3f0493452b
@ -0,0 +1,23 @@
|
||||
const assert = require("assert");
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
|
||||
const root = path.join(__dirname, "..");
|
||||
const appMain = fs.readFileSync(path.join(root, "src", "layout", "components", "AppMain.vue"), "utf8");
|
||||
const trainingTaskApi = fs.readFileSync(path.join(root, "src", "api", "trainingTask.js"), "utf8");
|
||||
|
||||
assert(
|
||||
appMain.includes("studentTaskLoading.value = false;"),
|
||||
"切回已缓存的学生实训页时,旧加载遮罩必须先清除"
|
||||
);
|
||||
assert(
|
||||
!appMain.includes("studentTaskLoading.value = Boolean(taskKey);"),
|
||||
"路由切换不能在没有真实请求时强制显示实训加载遮罩"
|
||||
);
|
||||
assert.match(
|
||||
trainingTaskApi,
|
||||
/if \(pendingTaskRequests\.has\(normalizedTaskKey\)\) \{[\s\S]*?notifyStudentTaskConfigLoading\(normalizedTaskKey, true\);[\s\S]*?return pendingTaskRequests\.get\(normalizedTaskKey\);/,
|
||||
"复用进行中的任务配置请求时,必须重新广播加载状态"
|
||||
);
|
||||
|
||||
console.log("student task loading lifecycle static checks passed");
|
||||
Loading…
Reference in New Issue