import test from 'node:test' import assert from 'node:assert/strict' import { readSource } from './helpers.ts' // 维护修复:页面自定义 modal-mask(z-index:3000) / 导出等待遮罩(3100) 高于 Element 默认 // 弹层计数(自 2000 递增),遮罩弹窗内触发的 ElMessage 警告会被浮层挡住看不见—— // 已在整站层面把消息提示抬到 4000、消息盒确认弹窗抬到 4100,统一高于全部自定义浮层。 test('el_message_above_custom_overlays', () => { const css = readSource('src/styles/main.css') assert.match( css, /\.el-message\s*\{[^}]*z-index:\s*4000\s*!important/, '消息提示需抬升到 4000 且 !important(覆盖 Element 实例内联层级)', ) assert.match( css, /\.el-overlay\.is-message-box\s*\{[^}]*z-index:\s*4100\s*!important/, '消息盒确认弹窗需抬升到 4100(z-index 落在 .el-overlay.is-message-box 内联样式)', ) }) // 同一条根因的另一半:Element popper(el-select 下拉面板)同样自 2000 递增,弹窗内下拉点开时 // 面板落在 modal-mask(3000)/导出等待遮罩(3100) 之下 ⇒ 用户看到的是"点开什么都没有"。 // z-index 写在 popper 内联 style 上,缺 !important 就整条规则不生效(静默判绿)。 test('el_popper_above_custom_overlays', () => { const css = readSource('src/styles/main.css') const matched = css.match(/\.el-popper\s*\{[^}]*z-index:\s*(\d+)\s*!important/) assert.ok(matched, '下拉面板层级需 .el-popper z-index … !important(不加 !important 覆盖不住内联层级)') const popperZ = Number(matched[1]) assert.ok(popperZ > 3100, `下拉面板 z-index 需高于全部自定义浮层(遮罩 3000 / 导出等待 3100),当前 ${popperZ}`) assert.ok(popperZ < 4000, `下拉面板 z-index 需低于 ElMessage(4000),否则提示会被下拉挡住,当前 ${popperZ}`) }) test('dedupe_overlay_and_warning_kept', () => { const page = readSource('src/pages/asin/DedupeRegistryPage.vue', true) assert.match(page, /\.modal-mask\s*\{[^}]*z-index:\s*3000/, '页内遮罩仍为 3000,消息 4000 需保持在其上') assert.match(page, /\.dedupe-export-wait-mask\s*\{[^}]*z-index:\s*3100/, '导出等待遮罩 3100 同样低于消息 4000') assert.match(page, /请选择数据权限分组|请选择分组/, '导入/编辑未选分组需保留警告岔口') }) test('records_preview_overlay_below_message', () => { const page = readSource('src/pages/records/RecordsHistoryPage.vue') assert.match(page, /\.modal-mask\s*\{[^}]*z-index:\s*3000/, '记录预览遮罩 3000 同样低于消息 4000') })