refactor(测试跟踪): 脑图用例子节点超过2层时保存提示

--bug=1010712 --user=陈建星 【测试跟踪】github#9470,脑图用例子层级超过2层时,希望加上提示 无法保存 https://www.tapd.cn/55049933/s/1167696
This commit is contained in:
chenjianxing 2022-05-30 11:06:26 +08:00 committed by jianxing
parent 2859095284
commit 4fcdb6b8e8
1 changed files with 18 additions and 2 deletions

View File

@ -397,8 +397,14 @@ name: "TestCaseMinder",
if (childData.type === 'issue') return; if (childData.type === 'issue') return;
if (childData.resource && childData.resource.indexOf(this.$t('test_track.case.prerequisite')) > -1) { if (childData.resource && childData.resource.indexOf(this.$t('test_track.case.prerequisite')) > -1) {
testCase.prerequisite = childData.text; testCase.prerequisite = childData.text;
if (childNode.children && childNode.children.length > 0) {
this.throwError('[' + testCase.name + ']前置条件下不能添加子节点!');
}
} else if (childData.resource && childData.resource.indexOf(this.$t('commons.remark')) > -1) { } else if (childData.resource && childData.resource.indexOf(this.$t('commons.remark')) > -1) {
testCase.remark = childData.text; testCase.remark = childData.text;
if (childNode.children && childNode.children.length > 0) {
this.throwError('[' + testCase.name + ']备注下不能添加子节点!');
}
} else { } else {
// //
let step = {}; let step = {};
@ -408,7 +414,9 @@ name: "TestCaseMinder",
let result = ""; let result = "";
childNode.children.forEach((child) => { childNode.children.forEach((child) => {
result += child.data.text; result += child.data.text;
if (child.data.changed) isChange = true; if (child.data.changed) {
isChange = true;
}
}) })
step.result = result; step.result = result;
} }
@ -419,7 +427,15 @@ name: "TestCaseMinder",
testCase.expectedResult = step.result; testCase.expectedResult = step.result;
} }
} }
if (childData.changed) isChange = true; if (childData.changed) {
isChange = true;
}
childNode.children.forEach((child) => {
if (child.children && child.children.length > 0) {
this.throwError('['+ testCase.name + ']用例下子节点不能超过两层!');
}
});
}) })
} }
testCase.steps = JSON.stringify(steps); testCase.steps = JSON.stringify(steps);