import { test, expect } from '@playwright/test'; import { launchApp, resetWorkspace, type LaunchedApp, openNote, } from './appFixture'; const popup = '.cm-tooltip-autocomplete'; async function focusEndOfDoc( window: Awaited>['window'], ) { await window.locator('.cm-content').first().click(); await window.keyboard.press( process.platform === 'darwin' ? 'Meta+End' : 'Control+End', ); await window.keyboard.press('Enter'); } test.describe('[[ completion popup', () => { let app: LaunchedApp; let window: LaunchedApp['window']; test.beforeAll(async () => { app = await launchApp(); window = app.window; }); test.afterAll(async () => { await app.close(); }); test.beforeEach(async () => { await resetWorkspace(app); }); test('offers note names, in the app font rather than monospace', async () => { await openNote(window, 'Other.md'); await focusEndOfDoc(window); await window.keyboard.type('[['); await expect(window.locator(popup)).toBeVisible(); await expect(window.locator(`${popup} li`).first()).toBeVisible(); await expect(window.locator(popup)).toContainText('Target'); // CM's base theme hardcodes monospace here; our override has to out-specify it. const fontFamily = await window .locator(`${popup} > ul`) .evaluate((el) => getComputedStyle(el).fontFamily); expect(fontFamily.toLowerCase()).not.toContain('monospace'); }); test('shows the modifier hints pinned below the option list', async () => { await openNote(window, 'Other.md'); await focusEndOfDoc(window); await window.keyboard.type('[['); const footer = window.locator('.cm-wikilink-completion-footer'); await expect(footer).toBeVisible(); await expect(footer).toContainText('heading'); await expect(footer).toContainText('display text'); // CM re-appends the