import AppKit import OrgCore import Testing @testable import OrgEditorAppKit @MainActor struct CompletionPopupTests { func at(_ text: String) -> Harness { let h = Harness(text) h.caret(at: text.utf16.count) return h } @Test func oneCandidateIsInserted() { let h = at("#+TI") h.editor.run("editor.complete") #expect(h.editor.document.text == "#+TITLE: " && h.caret == 9) let tags = at("* H :work:\n* I :") tags.editor.run("editor.complete") #expect(tags.editor.document.text == "* H :work:\n* I :work:") let template = at("