cmvr-wms/ruoyi-ui-vue3/tests/unit/pending-receipts-theme.test.mjs
lixiaolong a82258561b feat(auth): 添加认证cookie名称配置并优化表单布局
- 在 .env.production 中新增 VITE_AUTH_COOKIE_NAME 配置项用于设置认证cookie名称
- 将 AcceptanceException.vue 中的表单标签宽度从固定90px改为自动适配
- 在 ActionDialog.vue 中将多个表单项标记为必填项并调整标签宽度为自动适配
- 重构 ActionHistory.vue 中的按钮布局结构并添加表格列样式类名
- 更新 api-contract-audit.cjs 添加生产任务和BOM相关接口的契约测试
- 修改 auth.js 使用动态认证cookie键名替换硬编码的Admin-Token
- 调整系统角色授权用户页面的表单布局和表格样式类名
- 优化 ReceiptDialog Batch 组件的对话框尺寸、表单验证和分页功能
2026-10-16 15:30:10 +08:00

25 lines
1.5 KiB
JavaScript

import test from 'node:test'
import assert from 'node:assert/strict'
import { readFileSync } from 'node:fs'
const source = readFileSync(new URL('../../src/components/PendingReceipts/index.vue', import.meta.url), 'utf8')
const rule = selector => source.match(new RegExp(`${selector.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}\\{([^}]+)\\}`))?.[1] || ''
test('pending batch sidebar overrides the legacy global aside decoration with theme-aware styles', () => {
const sidebar = rule('.pending-sources')
for (const declaration of ['padding:0', 'margin:0', 'background:var(--el-bg-color)', 'color:var(--el-text-color-primary)', 'font:inherit', 'line-height:normal']) {
assert.ok(sidebar.includes(declaration), `Missing sidebar reset: ${declaration}`)
}
assert.doesNotMatch(sidebar, /#[0-9a-f]{3,8}\b|\b(?:white|black)\b/i)
assert.match(source, /<aside class="pending-sources" aria-label="待入库批次">/)
})
test('pending batch buttons retain theme-aware normal, hover, active and keyboard focus states', () => {
assert.match(rule('.pending-source'), /background:var\(--el-bg-color\)/)
assert.match(rule('.pending-source'), /color:var\(--el-text-color-regular\)/)
assert.match(rule('.pending-source:hover'), /background:var\(--el-fill-color-light\)/)
assert.match(rule('.pending-source.is-active'), /background:var\(--el-color-primary-light-9\)/)
assert.match(rule('.pending-source:focus-visible'), /outline:2px solid var\(--el-color-primary\)/)
assert.match(source, /:aria-pressed="activeKey==='ALL'"/)
})