Files
Starlight_Launcher/apps/app-frontend/src/components/ui/context-menu-lifecycle.test.ts
T

13 lines
623 B
TypeScript

import assert from 'node:assert/strict'
import { readFileSync } from 'node:fs'
import test from 'node:test'
test('context menu removes global listeners from their registration targets', () => {
const source = readFileSync(new URL('./ContextMenu.vue', import.meta.url), 'utf8')
assert.match(source, /window\.addEventListener\('click', handleClickOutside\)/)
assert.match(source, /window\.removeEventListener\('click', handleClickOutside\)/)
assert.match(source, /document\.body\.addEventListener\('keyup', onEscKeyRelease\)/)
assert.match(source, /document\.body\.removeEventListener\('keyup', onEscKeyRelease\)/)
})