align(生成记录样办·反馈): 还原旧版交互——去掉重置/清理数据/查看大图按钮,点击缩略图直接放大预览;按钮间距统一10px;前端 clearHistory 适配移除(后端 DELETE /history 端点保留)
This commit is contained in:
@@ -2,29 +2,23 @@ import test from 'node:test'
|
||||
import assert from 'node:assert/strict'
|
||||
import { readSource } from './helpers.ts'
|
||||
|
||||
// 验收反馈:生成记录的数据要可清理。
|
||||
// 契约:页面有「清理数据」入口(二次确认)、前端 DELETE /api/admin/history、后端清空端点与日志。
|
||||
// 用户反馈(round2 像素复刻样办):生成记录页还原旧版交互——「清理数据」为旧版没有的新增入口,从页面移除。
|
||||
// 契约:页面无清理入口、无二次确认文案;前端适配层不再暴露 clearHistory;后端 DELETE /history 端点保留(非破坏性,供后续需要时再接线)。
|
||||
|
||||
test('align_history_clear_normal_primary_path', () => {
|
||||
test('align_history_clear_removed_from_page', () => {
|
||||
const page = readSource('src/pages/records/RecordsHistoryPage.vue')
|
||||
assert.match(page, /清理数据/, '页头有清理数据按钮')
|
||||
assert.match(page, /确定清空全部生成记录吗/, '清理前需二次确认')
|
||||
assert.match(page, /clearHistory\(\)/, '页面调用清理 API')
|
||||
assert.doesNotMatch(page, /清理数据/, '页面不再有「清理数据」按钮')
|
||||
assert.doesNotMatch(page, /clearAll|clearHistory/, '页面不再调用清理逻辑')
|
||||
assert.doesNotMatch(page, /确定清空全部生成记录吗/, '无清理二次确认文案')
|
||||
})
|
||||
|
||||
test('align_history_clear_normal_variant_input', () => {
|
||||
test('align_history_clear_api_no_longer_exposed', () => {
|
||||
const api = readSource('src/pages/records/history-api.ts')
|
||||
assert.match(api, /http\.delete<unknown>\(HISTORY_ENDPOINT\)/, '清理走 DELETE /api/admin/history')
|
||||
assert.match(api, /clearHistory/, '暴露 clearHistory 适配函数')
|
||||
assert.doesNotMatch(api, /clearHistory/, '前端适配层不再暴露 clearHistory')
|
||||
})
|
||||
|
||||
test('align_history_clear_boundary_empty_input', () => {
|
||||
const page = readSource('src/pages/records/RecordsHistoryPage.vue')
|
||||
assert.match(page, /已清空 \$\{removed\} 条生成记录/, '成功提示含清理条数')
|
||||
})
|
||||
|
||||
test('align_history_clear_dependency_failure_returns_actionable_message', () => {
|
||||
// 后端契约:DELETE /history 端点 + service 清空 + 中文排查日志。
|
||||
test('align_history_clear_backend_endpoint_kept', () => {
|
||||
// 后端契约保留:DELETE /history 端点 + service 清空 + 中文排查日志(从前端摘除入口,不动后端)。
|
||||
const ctrl = readSource('../backend-java/src/main/java/com/nanri/aiimage/modules/imagehistory/controller/ImageHistoryController.java')
|
||||
assert.match(ctrl, /@DeleteMapping\("\/history"\)/, '后端有 DELETE /api/admin/history 端点')
|
||||
assert.match(ctrl, /admin_history/, '清理端点沿用生成记录模块权限')
|
||||
|
||||
@@ -23,10 +23,10 @@ test('align_shop_keys_row_buttons_solid', () => {
|
||||
assertRowButtonSolid(s, 'remove')
|
||||
})
|
||||
|
||||
test('align_records_history_preview_old_btn', () => {
|
||||
test('align_records_history_thumb_click_opens_preview', () => {
|
||||
const s = readSource('src/pages/records/RecordsHistoryPage.vue')
|
||||
assert.match(s, /class="btn btn-sm"[^>]*@click="openPreview/, '查看大图用旧版 btn-sm 小按钮')
|
||||
assert.doesNotMatch(s, /el-button[^>]*openPreview/, '生成记录已自绘,无 EP 按钮')
|
||||
assert.match(s, /class="thumb"[^>]*@click="openPreview\(h\)"/, '点击缩略图直接放大预览')
|
||||
assert.doesNotMatch(s, /查看大图/, '无行内「查看大图」按钮')
|
||||
})
|
||||
|
||||
test('align_digital_human_row_buttons_solid', () => {
|
||||
|
||||
Reference in New Issue
Block a user