/** Issue 65 static interaction guard: card identity, handler, and nested button propagation stay aligned. */ import assert from 'node:assert/strict' import fs from 'node:fs' const panel = fs.readFileSync(new URL('../src/modules/cockpit/components/PanelBlocks.vue', import.meta.url), 'utf8') const shell = fs.readFileSync(new URL('../src/modules/cockpit/CockpitShell.vue', import.meta.url), 'utf8') const drawer = fs.readFileSync(new URL('../src/modules/cockpit/components/EntityDetailDrawer.vue', import.meta.url), 'utf8') const warning = fs.readFileSync(new URL('../src/modules/cockpit/components/WarningResponsePane.vue', import.meta.url), 'utf8') assert.ok(panel.includes(`:class="{ 'panel-item--clickable': cardAction(row).kind !== CARD_ACTION.NONE }"`)) assert.ok(panel.includes(`:tabindex="cardAction(row).kind !== CARD_ACTION.NONE ? 0 : null"`)) assert.ok(panel.includes(`@click="cardAction(row).kind !== CARD_ACTION.NONE ? onCardClick(row, $event) : null"`)) assert.ok(panel.includes(`@click.stop="emit('locate', point.pointCode)"`)) assert.ok(panel.includes(`@keydown.enter.stop`)) assert.ok(panel.includes(`@keydown.space.stop`)) assert.ok(panel.includes(`event.target.closest('button')`)) assert.ok(warning.includes(`const id = (action && action.code) || ''`)) assert.ok(!warning.includes(`row.workOrderCode || row.code || (action && action.code)`)) assert.ok(shell.includes(`@locate-device="locateDeviceFromDetail"`)) assert.ok(shell.includes(`function locateDeviceFromDetail(deviceCode)`)) assert.ok(shell.includes(`monitoringStore.locateCode(deviceCode)`), '关联设备定位必须复用设备台账的定位方法') assert.ok(drawer.includes(`position: absolute`)) assert.ok(drawer.includes(`.entity-drawer.is-left { left: calc(var(--rail-w)`)) assert.ok(drawer.includes(`.entity-drawer.is-right { right: calc(var(--rail-w)`)) console.log('t65-card-interactions: 22/22') // 维护者 2026-10-29:详情面板必须与其他面板同一套磨砂语言(同一组 token + blur)。 assert.ok(drawer.includes(`backdrop-filter: blur(16px) saturate(115%);`)) assert.ok(drawer.includes(`var(--panel-top`)) assert.ok(drawer.includes(`var(--panel-line`)) // 左右判定只认目录单源,组件与外壳都不得硬编码 'left'/'right'。 assert.ok(shell.includes(`panelSideFor(mode.value, panelId)`)) assert.ok(shell.includes(`panelSideOf(panelId)`)) assert.ok(!shell.includes(`handleCardAction(action, 'left')`)) assert.ok(!shell.includes(`handleCardAction(action, 'right')`)) assert.ok(warning.includes(`panelSideFor('warningResponse', props.panelId)`)) assert.ok(!warning.includes(`{ side: 'right' }`))