import test from 'node:test' import assert from 'node:assert/strict' import { readSource } from './helpers.ts' /** 对齐旧版 .btn-sm:account 域行内操作统一实心小按钮(不再 link/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_users_row_buttons_old_btn', () => { const s = readSource('src/pages/account/UsersPage.vue') assert.match(s, /class="btn btn-sm"[^>]*@click="openEdit\(row\)"/, '编辑用旧版 btn-sm 实心小按钮') assert.match(s, /class="btn btn-sm btn-danger"[^>]*@click="removeUser\(row\)"/, '删除用旧版 btn-sm btn-danger') assert.doesNotMatch(s, /el-button/, '用户页已自绘,无 EP 按钮') assert.match(s, /window\.confirm\(deleteConfirmMessage\(row\)\)/, '删除确认走原生 confirm 对齐旧版') }) test('align_groups_row_buttons_old_btn', () => { const s = readSource('src/pages/account/GroupsPage.vue') assert.match(s, /class="btn btn-sm"[^>]*@click="openEdit\(group\)"/, '编辑用旧版 btn-sm 实心小按钮') assert.match(s, /class="btn btn-sm btn-danger"[^>]*@click="removeGroup\(group\)"/, '删除用旧版 btn-sm btn-danger') assert.doesNotMatch(s, /el-button[^>]*@click="openEdit/, '行内不再用 EP 按钮') }) test('align_menus_row_buttons_old_btn', () => { const s = readSource('src/pages/account/MenusPage.vue') assert.match(s, /class="btn btn-sm"[^>]*@click="openEdit\(row\)"/, '编辑用旧版 btn-sm 实心小按钮') assert.match(s, /class="btn btn-sm btn-danger"[^>]*@click="removeMenu\(row\)"/, '删除用旧版 btn-sm btn-danger') assert.doesNotMatch(s, /el-button[^>]*@click="openEdit/, '行内不再用 EP 按钮') assert.match(s, /window\.confirm\(`确定删除菜单/, '删除确认走原生 confirm 对齐旧版') })