29 lines
1.6 KiB
TypeScript
29 lines
1.6 KiB
TypeScript
import test from 'node:test'
|
|
import assert from 'node:assert/strict'
|
|
import { readSource } from './helpers.ts'
|
|
import { historyEmptyText } from '../src/pages/records/history-feedback.ts'
|
|
|
|
/** 对齐 admin.html:5769-5770(类型/创建时间列名) 与 admin.js:2866(暂无记录)。 */
|
|
|
|
test('align_history_column_labels', () => {
|
|
const page = readSource('src/pages/records/RecordsHistoryPage.vue')
|
|
assert.match(page, /<th[^>]*>类型<\/th>/, '列名对齐参考「类型」(自绘 th)')
|
|
assert.match(page, /<th[^>]*>创建时间<\/th>/, '列名对齐参考「创建时间」(自绘 th)')
|
|
assert.doesNotMatch(page, /记录类型/, '去掉“记录类型”列名')
|
|
assert.doesNotMatch(page, /label="生成时间"/, '去掉“生成时间”列名')
|
|
})
|
|
|
|
test('align_history_empty_text', () => {
|
|
assert.equal(historyEmptyText({ hasFilter: true, total: 0 }), '暂无记录')
|
|
assert.equal(historyEmptyText({ hasFilter: false, total: 0 }), '暂无记录')
|
|
assert.equal(historyEmptyText({ hasFilter: false, total: 2 }), '')
|
|
})
|
|
|
|
test('align_history_form_group_no_global_margin_leak', () => {
|
|
// 修复按钮与筛选输入框不对齐:全局 .form-group{margin-bottom:20px} 由登录页非 scoped 样式泄漏;登录页样式收窄为 scoped,页面内显式重置。
|
|
const login = readSource('src/pages/login/LoginPage.vue')
|
|
assert.match(login, /<style scoped>/, '登录页样式 scoped,不再全局泄漏 .form-group')
|
|
const page = readSource('src/pages/records/RecordsHistoryPage.vue')
|
|
assert.match(page, /\.form-group \{[^}]*margin-bottom: 0/, '页面内 form-group 显式重置 margin')
|
|
})
|