fix(web-admin): 顶栏菜单折叠按钮改为内联 SVG 并始终可见。

避免 Iconify/el-icon 在部分浏览器不绘制,并去掉可关闭开关以免按钮被关掉。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
wuzilongandCursor committed 2026-11-16 15:42:03 +08:00
1 parent 8ac835fa96
commit 82c21262ed
9 files changed
+143 -31

No files matched your search

@@ -0,0 +1,46 @@
/**
* 顶栏侧栏收起按钮必须始终可见:
* - persist afterRestore 强制 ensureMenuButtonVisible(禁止 toggle)
* - AppLayout 挂载时再次兜底
* - 设置面板不再提供可关闭开关
*/
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'
const root = join(dirname(fileURLToPath(import.meta.url)), '..')
test('setting store forces menu button visible on restore', () => {
const src = readFileSync(join(root, 'src/store/modules/setting.ts'), 'utf8')
assert.match(src, /ensureMenuButtonVisible\s*=\s*\(\)\s*=>\s*\{[\s\S]*?showMenuButton\.value\s*=\s*true/)
assert.match(src, /afterRestore:\s*\(ctx\)\s*=>\s*\{[\s\S]*?ensureMenuButtonVisible\(\)/)
assert.doesNotMatch(
src,
/afterRestore:[\s\S]*?if\s*\(\s*!ctx\.store\.showMenuButton\s*\)[\s\S]*?setButton\(\)/,
'afterRestore must not rely on setButton toggle'
)
assert.match(
src,
/const setButton = \(\) => \{\s*showMenuButton\.value = true/,
'setButton must assign true, not toggle'
)
})
test('AppLayout mount ensures menu button visible', () => {
const src = readFileSync(join(root, 'src/views/index/index.vue'), 'utf8')
assert.match(src, /ensureMenuButtonVisible\(\)/)
})
test('settings panel does not expose showMenuButton switch', () => {
const src = readFileSync(
join(root, 'src/components/core/layouts/art-settings-panel/composables/useSettingsConfig.ts'),
'utf8'
)
assert.doesNotMatch(
src,
/key:\s*'showMenuButton'/,
'settings UI must not allow turning off the fold control'
)
})
@@ -12,18 +12,36 @@ import { parse } from '@vue/compiler-sfc'
const root = join(dirname(fileURLToPath(import.meta.url)), '..')
test('ArtSvgIcon: el-icon branch must not use Tailwind inline class', () => {
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\b[^>]*class="[^"]*\binline\b/,
'el-icon must not include Tailwind inline (breaks display:inline-flex in prod CSS order)'
/<(?: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*'计划编号'/)