cmvr-wms/ruoyi-ui-vue3/tests/unit/business-layout.test.mjs
lixiaolong 149bde836f feat(assistant): 扩展业务助手功能支持更多文档类型和业务场景
- 新增 PDF 文档支持,包括格式校验和完整性检查
- 扩展 Word、TXT 和 ZIP 格式附件处理能力
- 添加 Excel 附件可选择仅作为业务文件不解析行数据
- 实现业务助手表格布局配置新增库存和预算字段
- 集成通知、反馈通知等新的业务助手动作类型
- 完善部门管理包含父级部门和排序字段支持
- 增强业务规则校验涵盖更多系统管理场景
- 优化附件上传限制提示信息更准确
- 添加生成文件下载的安全性校验机制
- 扩展测试覆盖确保各业务动作规则正确性
2026-10-18 08:49:30 +08:00

31 lines
1.7 KiB
JavaScript

import test from 'node:test'
import assert from 'node:assert/strict'
import { readFileSync } from 'node:fs'
import { compileString } from 'sass'
import { businessDescriptionColumns } from '../../src/utils/business-layout.js'
test('description columns use actual content width, keeping a readable label-value pair', () => {
for (const [width, expected] of [[0,1],[335,1],[559,1],[599,1],[600,2],[632,2],[899,2],[900,3],[1366,3],[2560,3]])
assert.equal(businessDescriptionColumns(width), expected, `width=${width}`)
for (const width of [undefined, null, NaN, Infinity, -1, 'not a width']) assert.equal(businessDescriptionColumns(width),1)
})
test('responsive form rules are opt-in and collapse columns using the form container', () => {
const source=readFileSync(new URL('../../src/assets/styles/business-forms.scss',import.meta.url),'utf8')
const css=compileString(source).css
assert.match(css,/container:\s*business-form\s*\/\s*inline-size/)
assert.match(css,/@container business-form \(max-width: 520px\)/)
assert.match(css,/\.business-responsive-form \.el-row > \.el-col-12/)
assert.match(css,/white-space:\s*nowrap/)
assert.doesNotMatch(css,/\.el-dialog\s+\.el-col-12/)
})
test('our two-column editors opt in without changing collaboration source', () => {
for(const path of ['project/info','system/user','system/menu','system/dept','system/notice','warehouse/purchase']) {
const source=readFileSync(new URL(`../../src/views/${path}/index.vue`,import.meta.url),'utf8')
assert.match(source,/<el-form[^>]*class="business-responsive-form"[^>]*label-width="auto"/,path)
}
const styles=readFileSync(new URL('../../src/assets/styles/business-ui.scss',import.meta.url),'utf8')
assert.match(styles,/@use '\.\/business-forms\.scss'/)
})