避免 Iconify/el-icon 在部分浏览器不绘制,并去掉可关闭开关以免按钮被关掉。 Co-authored-by: Cursor <cursoragent@cursor.com>
55 lines
2.1 KiB
TypeScript
55 lines
2.1 KiB
TypeScript
/**
|
||
* #26 回归:
|
||
* 1) ArtSvgIcon 的 el-icon 不得带 Tailwind `inline`(生产 CSS 会覆盖 display)
|
||
* 2) 运输归档列展示含 planNo,且表格列受 isColumnVisible 控制
|
||
*/
|
||
import test from 'node:test'
|
||
import assert from 'node:assert/strict'
|
||
import { readFileSync } from 'node:fs'
|
||
import { dirname, join } from 'node:path'
|
||
import { fileURLToPath } from 'node:url'
|
||
import { parse } from '@vue/compiler-sfc'
|
||
|
||
const root = join(dirname(fileURLToPath(import.meta.url)), '..')
|
||
|
||
test('ArtSvgIcon: icon roots must not use Tailwind inline class', () => {
|
||
const src = readFileSync(join(root, 'src/components/core/base/art-svg-icon/index.vue'), 'utf8')
|
||
const { descriptor } = parse(src)
|
||
const template = descriptor.template?.content || ''
|
||
assert.match(template, /<el-icon\b[^>]*class="[^"]*art-svg-icon/)
|
||
assert.doesNotMatch(
|
||
template,
|
||
/<(?:el-icon|Icon)\b[^>]*class="[^"]*\binline\b/,
|
||
'icon roots must not include Tailwind inline (breaks display in prod CSS order)'
|
||
)
|
||
})
|
||
|
||
test('header fold button uses inline SVG button (Chrome-safe)', () => {
|
||
const src = readFileSync(
|
||
join(root, 'src/components/core/layouts/art-header-bar/index.vue'),
|
||
'utf8'
|
||
)
|
||
const { descriptor } = parse(src)
|
||
const template = descriptor.template?.content || ''
|
||
assert.match(template, /class="menu-fold-btn/)
|
||
assert.match(template, /menu-fold-btn__icon/)
|
||
assert.match(template, /<svg[\s\S]*viewBox="0 0 24 24"/)
|
||
assert.doesNotMatch(
|
||
template,
|
||
/<ArtIconButton[\s\S]*menu-fold/,
|
||
'fold control must not rely on ArtIconButton/iconify in Chrome'
|
||
)
|
||
assert.match(template, /<button[\s\S]*class="menu-fold-btn/)
|
||
})
|
||
|
||
test('plan-archive: planNo is in column defs and table visibility gate', () => {
|
||
const src = readFileSync(join(root, 'src/views/pl/plan-archive/index.vue'), 'utf8')
|
||
assert.match(src, /prop:\s*'planNo',\s*label:\s*'计划编号'/)
|
||
assert.match(src, /pl-plan-archive-list-columns-v17/)
|
||
assert.match(
|
||
src,
|
||
/v-if="isColumnVisible\('planNo'\)"[\s\S]*?prop="planNo"/,
|
||
'planNo table column must be gated by isColumnVisible'
|
||
)
|
||
})
|