Files
crawler-plugin/admin-frontend-vue/tests/align-account-row-buttons.test.ts
T
huangzd1997 898e8a5ea9 feat(admin): 批量删除并入筛选行省一整行+公司管理加删除/批量删除(2026-11-23 用户口径)
- BatchDeleteActions margin-left:auto 右对齐、不再独占一行,14 页迁入各自筛选/工具行(Users/Groups/Menus/UserSecrets/QueryAsin/AsinInvalid/SkipPrice/DedupeRegistry/ProductCategory/DeviceLogs/DigitalHuman/ShopManage/ShopKeys/BrandGating);主按钮沿用全局 34px 同高,align-batch-toolbar-inline.test.ts 钉形状防回归
- 公司删除:DELETE /api/admin/companies/{id}(仅超管,名下有账号拒并带数量),只收公司行+columns 菜单树(PermissionMenuService.deleteTreeByCompany 与 copyTreeFromTemplate 对称),业务数据不级联;列表 VO 带 user_count 供前端置灰勾选/删除按钮;批量删除按用户管理同形走前端逐条循环
- CompaniesPage 加勾选列+行删除按钮(ops-cell 补 flex-wrap 过 ops-cell-must-wrap),删除后 refreshCompanyDirectory 同步 tab 条
- 测试:CompanyServiceDeleteTest 6+PermissionMenuServiceDeleteTreeTest 2+CompanyVoTest user_count 契约+CompanyControllerEndpointTest 翻转 exposesNoDeleteEndpoint→点名 DELETE 端点+CompanyReadPathMenuGateTest ensureSuperAdmin 3→4(delete 入册)+company-directory/row-buttons 补例;source-pin 基线重生成(265 文件/1859 例)
- 验证:admin-vue vue-tsc rc=0、node --test 1976 全绿、vitest mount 247 全绿;backend test-compile rc=0、Company*/PermissionMenu*/跨切守卫点名全绿(CatchSilenceRatchet 红因=另一路在飞件 JdPublishFillAiService 3 个 catch,归属京东窗不代抬)
2026-11-23 01:41:37 +08:00

46 lines
3.0 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
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(`<el-button[^>]*size="small"[^>]*@click="${action}`), `${action} 为 size=small 实心按钮`)
assert.doesNotMatch(source, new RegExp(`<el-button[^>]*link[^>]*@click="${action}`), `${action} 不再 link`)
assert.doesNotMatch(source, new RegExp(`<el-button[^>]*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, /openAdminConfirm\(\{ message: deleteConfirmMessage\(row\), danger: true \}\)/, '删除确认走统一确认出口,文案仍取旧版模型')
})
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, /openAdminConfirm\(\{ message: `确定删除菜单/, '删除确认走统一确认出口,文案对齐旧版')
})
test('align_companies_row_buttons_old_btn', () => {
const s = readSource('src/pages/account/CompaniesPage.vue')
assert.match(s, /class="btn btn-sm"[^>]*@click="openEdit\(company\)"/, '编辑用旧版 btn-sm 实心小按钮')
assert.match(s, /class="btn btn-sm btn-danger"[^>]*@click="removeCompany\(company\)"/, '删除用旧版 btn-sm btn-danger(2026-11-23 用户口径:公司管理加删除)')
assert.doesNotMatch(s, /el-button[^>]*@click="openEdit/, '行内不再用 EP 按钮')
assert.match(s, /openAdminConfirm\(\{ message: `确定删除公司/, '删除确认走统一确认出口')
// 名下有账号的公司删不得:勾选框与删除按钮共用同一份理由(deleteBlockReasonOf)
assert.match(s, /deleteBlockReasonOf\(company\)/, '删除按钮按理由置灰,悬停可见原因')
assert.match(s, /该公司名下还有 \$\{userCount\} 个账号/, '置灰文案带账号数')
})