align(全局+asin): 每面板操作提示条(guides对齐旧版admin-interactions.js原文);asin域行内按钮统一实心small(对齐.btn-sm);商品类目树折叠钮靛蓝#6366f1改蓝白token

This commit is contained in:
2026-09-06 21:38:16 +08:00
parent 26e062d32c
commit 4742a2e3b5
10 changed files with 315 additions and 13 deletions
@@ -0,0 +1,60 @@
import test from 'node:test'
import assert from 'node:assert/strict'
import { readSource } from './helpers.ts'
/** 对齐旧版 .btn-sm:asin 域 5 页表格行内操作(编辑/删除/配置)统一为实心小按钮(type primary/danger + size small),不再用 link/text;类目树折叠钮由靛蓝改为蓝白 token。 */
// 实心小按钮:同一 el-button 内同时含 size="small" 与 @click="<action>",且不含 link/text 修饰。
const SOLID_ACTION = (action: string) => new RegExp(`<el-button[^>]*size="small"[^>]*@click="${action}`)
const NO_MODIFIER = (action: string, mod: 'link' | 'text') =>
new RegExp(`<el-button[^>]*${mod}[^>]*@click="${action}`)
function assertRowButtonSolid(source: string, action: string) {
assert.match(source, SOLID_ACTION(action), `${action} 为 size=small 实心按钮`)
assert.doesNotMatch(source, NO_MODIFIER(action, 'link'), `${action} 不再 link`)
assert.doesNotMatch(source, NO_MODIFIER(action, 'text'), `${action} 不再 text`)
}
test('align_dedupe_registry_row_buttons_solid', () => {
const s = readSource('src/pages/asin/DedupeRegistryPage.vue')
assertRowButtonSolid(s, 'openEdit')
assertRowButtonSolid(s, 'removeRow')
})
test('align_invalid_asin_row_buttons_solid', () => {
const s = readSource('src/pages/asin/AsinInvalidPage.vue')
assertRowButtonSolid(s, 'openEdit')
assertRowButtonSolid(s, 'remove')
})
test('align_query_asin_config_solid', () => {
assertRowButtonSolid(readSource('src/pages/asin/QueryAsinPage.vue'), 'openConfig')
})
test('align_skip_price_config_solid', () => {
assertRowButtonSolid(readSource('src/pages/asin/SkipPricePage.vue'), 'openConfig')
})
test('align_product_category_tree_row_buttons_solid', () => {
const s = readSource('src/pages/asin/ProductCategoryPage.vue')
assertRowButtonSolid(s, 'openEdit')
assertRowButtonSolid(s, 'removeCategory')
})
test('align_product_category_no_indigo_left', () => {
const s = readSource('src/pages/asin/ProductCategoryPage.vue')
assert.doesNotMatch(s, /#6366f1|#eef0fe|6366f1|eef0fe/, '靛蓝色点已清')
assert.match(s, /--admin-primary-soft/, '折叠钮改用蓝白主色 soft token')
})
test('align_product_category_search_and_tree_edits_both_solid', () => {
const s = readSource('src/pages/asin/ProductCategoryPage.vue')
const opens = s.match(/<el-button[^>]*size="small"[^>]*@click="openEdit/g) || []
assert.ok(opens.length >= 2, `树/搜索两处编辑均实心(${opens.length}`)
})
test('align_product_category_load_more_kept_link', () => {
// 类目"加载更多"是非行内操作的树加载行,保留 link 不误伤。
const s = readSource('src/pages/asin/ProductCategoryPage.vue')
assert.match(s, /link size="small" type="primary"[^>]*loadMoreChildren/, '加载更多保留 link')
})