等待后端更新接口

This commit is contained in:
2026-08-03 16:49:26 +08:00
parent ac5823547a
commit 5b79893650
131 changed files with 5324 additions and 1392 deletions
+29 -4
View File
@@ -19,7 +19,7 @@ function feedbackFixture(overrides) {
appUserPhone: '19100000000',
feedbackType: 'bug',
feedbackContent: '页面按钮无响应',
contactInfo: '19181970173',
contactInfo: '测试联系方式',
handleStatus: '2',
handleResult: '已经修复',
handlerId: '2062179707935264702',
@@ -33,14 +33,14 @@ test('反馈请求只构造 AppFeedbackBody 并裁剪文本', () => {
assert.deepEqual(FeedbackPages.buildFeedbackBody({
feedbackType: ' bug ',
feedbackContent: ' 页面按钮无响应 ',
contactInfo: ' 19181970173 ',
contactInfo: ' 测试联系方式 ',
feedbackTitle: 'must-drop',
appUserId: 'must-drop',
handlerId: 'must-drop'
}), {
feedbackType: 'bug',
feedbackContent: '页面按钮无响应',
contactInfo: '19181970173'
contactInfo: '测试联系方式'
});
assert.deepEqual(FeedbackPages.buildFeedbackBody({
feedbackType: '',
@@ -69,7 +69,7 @@ test('FeedbackVo 只保留用户可见字段并保持长 ID 字符串', () => {
feedbackId,
feedbackType: 'bug',
feedbackContent: '页面按钮无响应',
contactInfo: '19181970173',
contactInfo: '测试联系方式',
handleStatus: '2',
handleResult: '已经修复',
handleTime: '2026-07-29 13:00:00',
@@ -137,10 +137,12 @@ test('两个提交页只提供 AppFeedbackBody 字段并加载真实脚本', ()
assert.doesNotMatch(source, /data-feature-status="pending"|pending-pages\.js/);
assert.match(source, /data-feedback-form/);
assert.match(source, /data-feedback-form novalidate/);
assert.match(source, /name="feedbackType"/);
assert.match(source, /name="feedbackContent"/);
assert.match(source, /name="contactInfo"/);
assert.match(source, /public\/js\/feedback-pages\.js/);
assert.match(source, /role="status"[^>]*data-feedback-status/);
assert.doesNotMatch(source, /name="(?:feedbackTitle|feedbackId|appUserId|handlerId)"/);
});
});
@@ -154,8 +156,10 @@ test('我的工单和详情页读取同一反馈集合且不制造处理动作',
assert.match(source, /public\/js\/feedback-pages\.js/);
});
assert.match(listPage, /data-feedback-list/);
assert.match(listPage, /data-api-state="loading"/);
assert.match(listPage, /data-feedback-refresh/);
assert.match(detailPage, /data-feedback-detail/);
assert.match(detailPage, /data-api-state="loading"/);
assert.doesNotMatch(detailPage, /回复|追问|删除|关闭工单|name="feedbackId"/);
});
@@ -167,3 +171,24 @@ test('反馈运行时提交后重读同一 ID,详情不存在时不回退', ()
assert.match(source, /提交后无法读取同一反馈记录/);
assert.match(source, /反馈记录不存在或无权查看/);
});
test('反馈请求的 403 显式归类为无权限,而不是登录失效', () => {
assert.equal(FeedbackPages.isForbidden({ status: 403 }), true);
assert.equal(FeedbackPages.isForbidden({ code: '403' }), true);
assert.equal(FeedbackPages.isForbidden({ status: 401 }), false);
});
test('反馈表单与列表使用可见标签和统一加载、空数据、失败状态', () => {
const ticket = read('submit-ticket.html');
const script = read('public/js/feedback-pages.js');
assert.match(ticket, /<label for="ticketContactInfo">联系方式(可选)<\/label>/);
assert.match(ticket, /<label for="ticketFeedbackType">反馈类型<\/label>/);
assert.match(ticket, /<label for="ticketFeedbackContent">问题描述/);
assert.match(script, /root\.ProfileUI && root\.ProfileUI\.setApiState/);
assert.match(script, /setApiState\(list, 'loading', '正在读取反馈记录…'\)/);
assert.match(script, /setApiState\(list, 'empty', '当前没有反馈记录。'\)/);
assert.match(script, /setApiState\(detail, isForbidden\(error\) \? 'forbidden' : 'error'/);
assert.match(script, /setPendingButton\(button, true, '正在提交…'\)/);
assert.match(script, /isForbidden\(error\) \? 'forbidden' : 'error'/);
});