Beautiful, AI-native markdown IDE and LLM wiki
TypeScript 2nd-brainagent-skillsclaudecodexcompany-braindocsknowledge-knowledge-baseknowledge-managementllmllm-wikillm-wiki-karpathymarkdownmarkdown-editormdmdxnotespkmsecond-brainskills
import { readFileSync } from 'node:fs';
import { join } from 'node:path';
import { describe, expect, test } from 'vitest';
import { OK_TRAILING_AFFORDANCE_CLASS } from './editor/extensions/trailing-affordance.ts';
const SRC_PATH = join(__dirname, 'globals.css');
const src = readFileSync(SRC_PATH, 'utf-8');
describe('globals.css drag-region neutralization (Popper outside-click in Electron)', () => {
test('declares a `:has()`-gated rule targeting `data-electron-drag`', () => {
expect(src).toMatch(/@supports\s+selector\(\s*:has\(\*\)\s*\)/);
expect(src).toMatch(/\[data-electron-drag\]\s*\{\s*-webkit-app-region:\s*no-drag\s*;/);
});
test('the rule fires for every Popper-based slot that needs outside-click dismissal', () => {
const requiredSlots = [
'popover-content',
'dropdown-menu-content',
'dropdown-menu-sub-content',
'context-menu-content',
'context-menu-sub-content',
'select-content',
'menubar-content',
'menubar-sub-content',
];
for (const slot of requiredSlots) {
expect(src).toContain(`[data-slot="${slot}"][data-state="open"]`);
}
});
test('does not target tooltip- or hover-card slots (drag stays live during hover)', () => {
expect(src).not.toMatch(/\[data-slot="tooltip-content"\]/);
expect(src).not.toMatch(/\[data-slot="hover-card-content"\]/);
});
});
describe('globals.css agent-flash widget exclusion', () => {
test('the append filter names the class the trailing-affordance plugin renders', () => {
expect(src).toContain(`of :not(.${OK_TRAILING_AFFORDANCE_CLASS},`);
});
test('the append filter also names the gap cursor', () => {
expect(src).toContain('.ProseMirror-gapcursor)');
});
});