fix: dismiss active launcher window on Escape

This commit is contained in:
2026-10-17 00:05:20 +02:00
parent bc7e4fd013
commit a891d49bb1
10 changed files with 98 additions and 50 deletions
+6 -3
View File
@@ -202,7 +202,7 @@ import Testing
}
}
@Test @MainActor func emojiCommandRestoresLauncherSearchOnEscape() throws {
@Test @MainActor func emojiCommandBackNavigationRestoresLauncherSearch() throws {
_ = NSApplication.shared
let suite = "ConjureEmojiCommand.\(UUID().uuidString)"
let defaults = UserDefaults(suiteName: suite)!
@@ -215,6 +215,9 @@ import Testing
search.stringValue = "emoji"
launcher.controlTextDidChange(Notification(name: NSControl.textDidChangeNotification, object: search))
_ = launcher.control(search, textView: NSTextView(), doCommandBy: #selector(NSResponder.insertNewline(_:)))
let back = try #require(descendants(content).compactMap { $0 as? NSButton }.first {
!$0.isHidden && $0.accessibilityLabel() == "Back to applications"
})
let grid = try #require(descendants(content).compactMap { $0 as? NSCollectionView }.first)
search.stringValue = ":woman_technologist:"
launcher.controlTextDidChange(Notification(name: NSControl.textDidChangeNotification, object: search))
@@ -224,12 +227,12 @@ import Testing
$0.title == "Actions" && $0.target is EmojiPickerController
})
(actionsButton.target as? EmojiPickerController)?.showActions()
_ = launcher.control(search, textView: NSTextView(), doCommandBy: #selector(NSResponder.cancelOperation(_:)))
back.performClick(nil)
#expect(descendants(content).contains { $0 === grid })
#expect(search.stringValue == ":woman_technologist:")
let copyButton = try #require(descendants(content).compactMap { $0 as? NSButton }.first { $0.title == "Copy and Paste" })
#expect(copyButton.keyEquivalent == "\r")
_ = launcher.control(search, textView: NSTextView(), doCommandBy: #selector(NSResponder.cancelOperation(_:)))
back.performClick(nil)
#expect(!descendants(content).contains { $0 === grid })
#expect(search.stringValue == "emoji")
let table = try #require(descendants(content).compactMap { $0 as? NSTableView }.first)