import test from 'node:test' import assert from 'node:assert/strict' import { readSource } from './helpers.ts' /** 对齐旧版 .btn-sm:shop/records/任务 域主操作按钮(编辑/凭证/删除/查看/发布/设最新/下载/明细)统一实心 small;纯复制链接辅助仍可 text。 */ function assertRowButtonSolid(source: string, action: string) { assert.match(source, new RegExp(`]*size="small"[^>]*@click="${action}`), `${action} 为 size=small 实心按钮`) assert.doesNotMatch(source, new RegExp(`]*link[^>]*@click="${action}`), `${action} 不再 link`) assert.doesNotMatch(source, new RegExp(`]*text[^>]*@click="${action}`), `${action} 不再 text`) } test('align_shop_manage_row_buttons_solid', () => { const s = readSource('src/pages/shop/ShopManagePage.vue') assertRowButtonSolid(s, 'openEdit') assertRowButtonSolid(s, 'showCredential') assertRowButtonSolid(s, 'remove') }) test('align_shop_keys_row_buttons_solid', () => { const s = readSource('src/pages/shop/ShopKeysPage.vue') assertRowButtonSolid(s, 'openEdit') assertRowButtonSolid(s, 'remove') }) test('align_records_history_preview_old_btn', () => { 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 按钮') }) test('align_digital_human_row_buttons_solid', () => { const s = readSource('src/pages/records/RecordsDigitalHumanVersionPage.vue') assertRowButtonSolid(s, 'release') assertRowButtonSolid(s, 'setLatest') assertRowButtonSolid(s, 'download') assertRowButtonSolid(s, 'remove') }) test('align_image_video_detail_and_download_solid', () => { const s = readSource('src/pages/tasks/ImageVideoTasksPage.vue') assertRowButtonSolid(s, 'openDetail') assertRowButtonSolid(s, 'downloadVideo') }) test('align_copy_link_aux_kept_text', () => { // 辅助"复制链接"保留 text(非破坏主操作),避免被误伤。 const s = readSource('src/pages/tasks/ImageVideoTasksPage.vue') assert.match(s, /]*text[^>]*@click="copyLink/, '复制链接保留 text') })