style: use shared notes browsing and actions panels

This commit is contained in:
Valdemar Lorenzen
2026-10-19 10:51:45 +02:00
parent 0b5d27752c
commit 9ce2997c19
8 changed files with 487 additions and 128 deletions
@@ -3,7 +3,7 @@ import ConjureKit
import Testing
@testable import Conjure
@Test(arguments: ["launcher", "launcher-actions", "emoji", "emoji-actions", "translate-input", "translate-output", "translate-actions", "translate-providers", "notes-editor"])
@Test(arguments: ["launcher", "launcher-actions", "emoji", "emoji-actions", "translate-input", "translate-output", "translate-actions", "translate-providers", "notes-editor", "notes-browse", "notes-actions"])
@MainActor func escapeClosesPickerBeforeDismissingLauncher(_ destination: String) throws {
_ = NSApplication.shared
let suite = "ConjureEscape.\(UUID().uuidString)"
@@ -58,6 +58,14 @@ import Testing
$0.accessibilityLabel() == "Japanese translation"
})
window.makeFirstResponder(output)
} else if destination == "notes-browse" || destination == "notes-actions" {
let shortcut = try #require(NSEvent.keyEvent(
with: .keyDown, location: .zero, modifierFlags: .command, timestamp: 1,
windowNumber: window.windowNumber, context: nil,
characters: destination == "notes-browse" ? "p" : "k",
charactersIgnoringModifiers: destination == "notes-browse" ? "p" : "k",
isARepeat: false, keyCode: destination == "notes-browse" ? 35 : 40))
#expect(window.performKeyEquivalent(with: shortcut))
} else if destination == "notes-editor" {
let editor = try #require(descendants(content).compactMap { $0 as? NSTextView }.first {
$0.accessibilityLabel() == "Note editor"
@@ -70,11 +78,21 @@ import Testing
windowNumber: window.windowNumber, context: nil, characters: "\u{1b}",
charactersIgnoringModifiers: "\u{1b}", isARepeat: false, keyCode: 53))
window.sendEvent(escape)
if destination.hasSuffix("-actions") || destination == "translate-providers" {
if destination.hasSuffix("-actions") || destination == "translate-providers" || destination == "notes-browse" {
#expect(window.isVisible)
#expect(window.firstResponder === search.currentEditor())
if destination.hasPrefix("notes") {
let editor = try #require(descendants(content).compactMap { $0 as? NSTextView }.first {
$0.accessibilityLabel() == "Note editor"
})
#expect(window.firstResponder === editor)
} else {
#expect(window.firstResponder === search.currentEditor())
}
window.sendEvent(escape)
}
#expect(!window.isVisible)
#expect(!descendants(content).contains { $0 is NSCollectionView })
#expect(!descendants(content).compactMap { $0 as? NSSearchField }.contains {
$0.accessibilityLabel() == "Search notes" || $0.accessibilityLabel() == "Search notes actions"
})
}